Why would calling fork() in a child process return zero? >From what i understand about forking, a child can fork a child.
So therefore calling fork() from within a child shouldnt return zero...right? On Jan 19, 2013 6:41 PM, "Jeremy Visser" <[email protected]> wrote: > On 19/01/13 10:43, Del wrote: > > More specifically: The parent gets the PID of the child process. So if > > you need to fork a whole bunch of children and keep track of them, you > > can read back the return result of fork() and then shove it in some kind > > of array or structure. You can then send signals to the children as > > required. > > Just be careful with the above wording. > > You wrote “parent gets the PID of the child process”, but what you > really meant was “fork() on the parent returns the child’s PID, whereas > fork() on the child returns 0”. > > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
