How to find a father for orphans?

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

 



Hi,

According to LKD 2ed, the funciton forget_origianl_parent() is used to
find a father for orphans when their real father is being exit. The
relavent code:

struct task_struct *p, *reaper = father;
struct list_head *list;

if (father->exit_signal != -1)
        reaper = prev_thread(reaper);
else
        reaper = child_reaper;

if (reaper == father)
        reaper = child_reaper;

I wonder what the conditon "father->exit_signal != -1" means. IMO, in
a thread group, the leader's exit_signal is usually equal to SIGCHLD,
while other threads' exit_signal should be -1. If so, the above code
means that when the leader is being exit, another thread in this group
should be the reaper; otherwise, the init process is chosen. Actually,
a more logical seletion is that when the leader is exiting, the init
process is chosen because there is no other threads in this group
usually; otherwise, another thread would be the reaper because
probably the leader exists at least. That is the condition should be
father->exit_signal == -1. Is that so?

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[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