fork() is returning > 0 ???
Richard A. O'Keefe
ok at goanna.cs.rmit.oz.au
Sat Nov 10 20:32:43 AEST 1990
In article <2691 at ux.acs.umn.edu>, eric at ux.acs.umn.edu (Merlinus Ambrosius) writes:
> Can you explain why in this piece of code, fork() is returning a value
> other than -1 or 0?
Because it ought to. RTFM. If you're talking about the UNIX fork(2)
system call, it yields one of three results:
-1 => something went wrong, we've still just one process and this is it
0 => forking worked, and _this_ process is the child
N => forking worked, _this_ process is the parent, and the
child process has process it N. If you are going to wait for
the child to finish, you _need_ this number.
(Look at the DIAGNOSTICS section of the fork(2) manual page.)
> |Eric (the "Mentat-Philosopher") Hendrickson University of Minnesota
Um, if you're a Mentat, how come you need a computer? Mentats were
supposed to be the human replacements for computers after the Butlerian Jihad.
--
The problem about real life is that moving one's knight to QB3
may always be replied to with a lob across the net. --Alasdair Macintyre.
More information about the Comp.lang.c
mailing list