New? idea
chris at umcp-cs.UUCP
chris at umcp-cs.UUCP
Mon Jan 16 09:43:17 AEST 1984
Something that network servers often do is
while ((netfd = netopen ()) >= 0) {
if ((pid = fork ()) == 0) {
if (fork ())
exit (0);
workhorse ();
exit (0);
}
close (netfd);
}
The purpose of the double-fork is to "disown" the actual worker and
let the server continue to accept network connections. Without the
"disownment", when the "workhorse" finishes and exit()s, it hangs around
forever taking up a process slot, just so that it can return its status
to its parent. But the server doesn't care, ergo the double-fork-be-
inherited-by-init trick.
So, my suggestion is a "disown" system call, to allow parents to give
up their children so that on exit they will vanish without a trace.
Does anyone know why this should not be implemented (other than because
you can do it without this)? Alternatively, does anyone have better
ideas?
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci
UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris.umcp-cs at CSNet-Relay
More information about the Comp.unix.wizards
mailing list