Re: how fork returns value

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

 





On Wed, Oct 1, 2008 at 6:12 PM, srimugunthan dhandapani <muggy.mit@xxxxxxxxx> wrote:
hi all,
I want to understand how the fork call return 0 in child and 'pid of child' in the parent.
Presently my (naive)understanding is that the %eax value is stored differently for the child and the parent.
Both the child and the parent returns from fork to the same instruction address, but will have different return values according to %eax.

as per my understanding child is not returning from the fork insted "wake_up_new_task" function will add the child process is runqueue.
And caller will return with the child process by "return nr";
 

Is my understanding correct?
Can somebody point out where exaclty in the source this is taken care of?

copy_process is called from the  do_fork. copy_process function is created new task_struct for the child process. get new process id for the child process

But still i am not getting where it is setting the pid value to 0 for child process.

please correct if i am wrong.

thanks,
mitul modi


Thanks,
Mugunthan


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux