Complexity of reallocating storage (was users command crap)

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Fri Feb 1 19:50:47 AEST 1991


In article <19010 at rpp386.cactus.org>, jfh at rpp386.cactus.org (John F Haugh II) writes:
> 	fd = open ("/etc/utmp", O_RDONLY);
> 	fstat (fd, &statb);
> 	users = (struct utmp *) malloc (statb.st_size);
> 	read (fd, (char *) users, statb.st_size);

That's what I used.  /etc/utmp appears to be a fixed size file anyway,
and the number of slots in that file doesn't seem to bear any obvious
relation to the number of entries in /etc/ttys (other than being bigger).
But I've been wondering whether a super-user editing /etc/ttys and then
sending SIGHUP to 'init' might break this and what would be the best way
to tell.  If it was my own file, I could use locks.
-- 
The Marxists have merely _interpreted_ Marxism in various ways;
the point, however, is to _change_ it.		-- R. Hochhuth.



More information about the Comp.lang.c mailing list