task_struct's real_parent vs parent members

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



Hi,

I am looking through kernel 3.2's task_struct, which has two pointers
for parents:  real_parent and parent
(http://lxr.free-electrons.com/source/include/linux/sched.h#L1313)   I
would like to know why there are two pointers, and how these two
differ.

init_task's parent and real_parent are initialised to point to itself.
 Since the main way processes are created is through fork()/clone(), I
tried following do_fork function to see where a newly created
process's parent is set, but I am unable to find it.  I see that
do_fork dups the current task_struct, and only updates the new
process's real_parent, depending on flags (passed via clone/fork
syscall).

The documentation in sched.h:1313 says that "parent" refers to the
parent task that would receive SIGCHLD (i.e., the one that issues
wait4()).  I followed the wait4() syscall to do_wait(), I still am not
able to find where the task's parent is updated.

Is there something I'm missing?

Thanks,
-- 
Vimal

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Networking]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

Add to Google Powered by Linux