Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

Smitz

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.

    Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-23 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found