Conventional daemons

Cameron Carson ccc at bu-cs.UUCP
Sat Mar 15 05:53:59 AEST 1986


[]

After an exhaustive examination of the code of the standard daemons
(well, I sort of glanced at rwhod and ftpd), I noticed that the
convention for disassociating the now-forked daemon from it's control
terminal seems to be something on the order:

	int s;
	for (s = 0; s < SOME_NUM; s++)
		(void) close(s);
	(void) open("/",0);
	(void) dup2(0,1);
	(void) dup2(0,2);
	s = open("dev/tty", 2);
	if (s >= 0) {
		ioctl(s, TIOCNOTTY, 0);
		(void) close(s);
	}

My question is: why open "/" ?  Why not open something a little
less vital like, say, /dev/null?

-- 
Cameron C. Carson
Distributed Systems Group
Boston University ACC

UUCP: ...!{harvard,allegra}!bu-cs!ccc
ARPA:  ccc%bu-cs at csnet-relay.arpa



More information about the Comp.unix.wizards mailing list