Conventional daemons

Keith Packard keith at motel6.UUCP
Tue Mar 25 06:52:14 AEST 1986


In article <261 at bu-cs.UUCP> ccc at bu-cs.UUCP (Cameron Carson) writes:
>	int s;
>	for (s = 0; s < SOME_NUM; s++)
>		(void) close(s);
>	(void) open("/",0);
>	(void) dup2(0,1);
>	(void) dup2(0,2);
>My question is: why open "/" ?  Why not open something a little
>less vital like, say, /dev/null?

Well, I suspect the answer to this lies in the dim dark past when unix
ran on small machines.  The inode for "/" is always in memory, the
inode for "/dev/null" is only in memory when it is referenced.  So,
opening "/" instead of "/dev/null" will not cause another inode-table
entry to be filled up.  Useful when your system only has 50 or so
incore inodes, considering that the daemon will *always* be running.

Keith Packard
...!tektronix!reed!motel6!keith



More information about the Comp.unix.wizards mailing list