Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: PID after fork && exit

by smitz (Chaplain)
on May 12, 2003 at 16:00 UTC ( [id://257473]=note: print w/replies, xml ) Need Help??

in reply to PID after fork && exit

fork returns the child PID, or 0 for the parent, AFAIK


Replies are listed 'Best First'.
Re: PID after fork && exit
by Abigail-II (Bishop) on May 12, 2003 at 20:23 UTC
    That's very confusing what you write.

    If fork fails, undef is returned. If fork succeeds, different values are returned in the parent and the child. In the child, fork returns 0, while in the parent, the process ID of child is returned. This is the only convenient time for the parent to get the process ID of the child. A parent can get the process ID of the child when it's reaping the child with some form of wait call, but then the child has already finished. Otherwise, the parents rests nothing else than walking the process list.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://257473]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-06-15 10:55 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.