[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

return value by do_fork()!!




hi all,

A small query.

I'm going through the code of do_fork().[kernel 2.4.16] fork.c

Since fork() returns the pid of child to parent when it returns & child get a
return value of zero.

After going through the code, its clear that the 'retval' is made equal to the
new pid (i.e of child)
=============
retval = p->pid;
=============
so that parent gets the pid of child.

But how does child gets a return value of zero?

I'm not clear about this...can anyone help me out.
 
TIA

Regards
Ketan

***
'Ooohh.. "FreeBSD is faster over loopback, when compared to Linux over the wire". 
Film at 11.' 
***

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/