mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 06:21:31 +00:00
pid: Implement PIDTYPE_TGID
Everywhere except in the pid array we distinguish between a tasks pid and a tasks tgid (thread group id). Even in the enumeration we want that distinction sometimes so we have added __PIDTYPE_TGID. With leader_pid we almost have an implementation of PIDTYPE_TGID in struct signal_struct. Add PIDTYPE_TGID as a first class member of the pid_type enumeration and into the pids array. Then remove the __PIDTYPE_TGID special case and the leader_pid in signal_struct. The net size increase is just an extra pointer added to struct pid and an extra pair of pointers of an hlist_node added to task_struct. The effect on code maintenance is the removal of a number of special cases today and the potential to remove many more special cases as PIDTYPE_TGID gets used to it's fullest. The long term potential is allowing zombie thread group leaders to exit, which will remove a lot more special cases in the code. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
parent
2c4704756c
commit
6883f81aac
14 changed files with 19 additions and 19 deletions
|
@ -1946,6 +1946,7 @@ static __latent_entropy struct task_struct *copy_process(
|
|||
|
||||
init_task_pid(p, PIDTYPE_PID, pid);
|
||||
if (thread_group_leader(p)) {
|
||||
init_task_pid(p, PIDTYPE_TGID, pid);
|
||||
init_task_pid(p, PIDTYPE_PGID, task_pgrp(current));
|
||||
init_task_pid(p, PIDTYPE_SID, task_session(current));
|
||||
|
||||
|
@ -1954,7 +1955,6 @@ static __latent_entropy struct task_struct *copy_process(
|
|||
p->signal->flags |= SIGNAL_UNKILLABLE;
|
||||
}
|
||||
|
||||
p->signal->leader_pid = pid;
|
||||
p->signal->tty = tty_kref_get(current->signal->tty);
|
||||
/*
|
||||
* Inherit has_child_subreaper flag under the same
|
||||
|
@ -1965,6 +1965,7 @@ static __latent_entropy struct task_struct *copy_process(
|
|||
p->real_parent->signal->is_child_subreaper;
|
||||
list_add_tail(&p->sibling, &p->real_parent->children);
|
||||
list_add_tail_rcu(&p->tasks, &init_task.tasks);
|
||||
attach_pid(p, PIDTYPE_TGID);
|
||||
attach_pid(p, PIDTYPE_PGID);
|
||||
attach_pid(p, PIDTYPE_SID);
|
||||
__this_cpu_inc(process_counts);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue