From: ddj@gradient.gradient.com (Dave Johnson)
Subject: Re: Fork bug in Sys5 (or similar) system
Date: 27 May 1994 08:59:57 -0400 [thread overview]
Message-ID: <ddj.770040899@gradient> (raw)
In-Reply-To: 2s4c5i$ndt@mail.fwi.uva.nl
casper@fwi.uva.nl (Casper H.S. Dik) writes:
>wja@cs.nott.ac.uk (William Armitage) writes:
>>This seems to be a change introduced to support Multi-Threading.
>>I hit this the other day while getting the Solaris 2 port of the Berkeley
>>spooler going on my 2.3 machine. At startup the deamon forks a copy of
>>itself for each printer to process any existing print jobs.
>It's found in standard SysVr4 libc and doesn't appear to have anything
>to do with MP support. It has one nice feature:
> (head -2; head -2) < foo
>now works as you'd (naively) expect. (It prints the first 4 lines,
>not the first 2 lines + 2 lines at offset blocksize)
>Casper
In looking around the fork(2) manual pages on a couple SysV-ish
systems, I found the note quoted earlier (always call fflush(3)
on open file descriptors before doing fork) on some of them.
Other systems (DG/UX and OSF/1) didn't mention the problem at all.
Solaris 2.3 mentions the "other" problem with fork/exit, which is
that you must call _exit(2) (instead of exit(3)) after a failed
exec* call, but none of the others do. The exit man pages just
say that _exit(2) will not perform the normal cleanup functions,
without saying why you might want to avoid them.
<Enter Old Fozzard mode>
I don't remember where I learned not to do exit() in a child that
hasn't exec'ed (maybe the BSTJ Nov '78 Unix paper?). This sort of
lore should be clearly stated in the manual pages (under both fork AND
exit in this case). Word-of-Net is nice, but you'd think after all
these years it would be officially noted.
<Exit Old Fozzard mode>
Just waiting for the coffee to kick in....
Dave Johnson
ddj@gradient.com
next prev parent reply other threads:[~1994-05-27 12:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-05-25 22:16 Fork bug in Sys5 (or similar) system Guojun Jin[ITG]
1994-05-26 7:52 ` Casper H.S. Dik
1994-05-26 18:16 ` William Armitage
1994-05-27 8:48 ` Casper H.S. Dik
1994-05-27 12:59 ` Dave Johnson [this message]
1994-05-27 13:40 ` Casper H.S. Dik
1994-05-28 2:51 ` Doug Gwyn (ACISD/MCSB) <gwyn>
1994-05-31 1:25 ` Peter da Silva
1994-05-26 18:08 ` Doug Gwyn (ACISD/MCSB) <gwyn>
1994-05-31 19:34 ` Guojun Jin[ITG]
1994-05-31 20:07 ` Casper H.S. Dik
1994-06-01 22:06 ` Peter da Silva
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox