Path: utzoo!attcan!uunet!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: Complexity of reallocating storage (was users command crap) Message-ID: <4690@goanna.cs.rmit.oz.au> Date: 1 Feb 91 08:50:47 GMT References: <22870@well.sf.ca.us> <22311:Jan2502:34:1191@kramden.acf.nyu.edu> <19010@rpp386.cactus.org> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 15 In article <19010@rpp386.cactus.org>, jfh@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.