Article View: comp.protocols.iso.dev-environ
Article #473Re: Why do daemons fork five times?
From: harald.alvestrand
Date: Mon, 18 Feb 1991 11:42
Date: Mon, 18 Feb 1991 11:42
36 lines
1627 bytes
1627 bytes
You need to read this code carefully (I know, I missed!)
|>
|> if (!(debug = isatty (2))) {
|> for (i = 0; i < 5; i++) {
|> switch (fork ()) {
|> case NOTOK:
|> sleep (5);
|> continue;
Note that the CONTINUE matches the FOR, not the SWITCH....
|> case OK:
|> break;
This breaks out of the SWITCH.........
|> if child, _exit(0)........
|> default:
|> _exit (0);
|> }
|> break;
This breaks out of the FOR...............
|> }
|>
So, the code says "try five times to fork in intervals of 5 seconds".
One may suspect that ISODE was developed on a machine with limitations on
how many processes could be started at any one time, so that failed fork
calls were common.
You are right about the DUPs of course, but I would like to know what
errors can occur with a DUP, as long as /dev/null is a valid file...
Harald Tveit Alvestrand
Harald.Alvestrand@elab-runit.sintef.no
C=no;PRMD=uninett;O=sintef;OU=elab-runit;S=alvestrand;G=harald
+47 7 59 70 94
Technical Details
Message-ID:
<1991Feb18.114233.5473@ugle.unit.no>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!bloom-beacon!eru!hagbard!sunic!ugle.unit.no!isolde!htaReferences:
<91Feb15.173220est.57761@ugw.utcs.utoronto.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!bloom-beacon!eru!hagbard!sunic!ugle.unit.no!isolde!hta From: harald.alvestrand@elab-runit.sintef.no Newsgroups: comp.protocols.iso.dev-environ Subject: Re: Why do daemons fork five times? Message-ID: <1991Feb18.114233.5473@ugle.unit.no> Date: 18 Feb 91 11:42:33 GMT References: <91Feb15.173220est.57761@ugw.utcs.utoronto.ca> Sender: news@ugle.unit.no Reply-To: harald.alvestrand@elab-runit.sintef.no Distribution: inet Organization: ELAB-RUNIT, SINTEF, Norway Lines: 36