mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
[PATCH] add process_session() helper routine
Replace occurences of task->signal->session by a new process_session() helper routine. It will be useful for pid namespaces to abstract the session pid number. Signed-off-by: Cedric Le Goater <clg@fr.ibm.com> Cc: Kirill Korotaev <dev@openvz.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Herbert Poetzl <herbert@13thfloor.at> Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
ef55d53caa
commit
937949d9ed
11 changed files with 35 additions and 29 deletions
|
@ -193,14 +193,14 @@ int session_of_pgrp(int pgrp)
|
|||
|
||||
read_lock(&tasklist_lock);
|
||||
do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
|
||||
if (p->signal->session > 0) {
|
||||
sid = p->signal->session;
|
||||
if (process_session(p) > 0) {
|
||||
sid = process_session(p);
|
||||
goto out;
|
||||
}
|
||||
} while_each_task_pid(pgrp, PIDTYPE_PGID, p);
|
||||
p = find_task_by_pid(pgrp);
|
||||
if (p)
|
||||
sid = p->signal->session;
|
||||
sid = process_session(p);
|
||||
out:
|
||||
read_unlock(&tasklist_lock);
|
||||
|
||||
|
@ -225,8 +225,8 @@ static int will_become_orphaned_pgrp(int pgrp, struct task_struct *ignored_task)
|
|||
|| p->exit_state
|
||||
|| is_init(p->real_parent))
|
||||
continue;
|
||||
if (process_group(p->real_parent) != pgrp
|
||||
&& p->real_parent->signal->session == p->signal->session) {
|
||||
if (process_group(p->real_parent) != pgrp &&
|
||||
process_session(p->real_parent) == process_session(p)) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ void __set_special_pids(pid_t session, pid_t pgrp)
|
|||
{
|
||||
struct task_struct *curr = current->group_leader;
|
||||
|
||||
if (curr->signal->session != session) {
|
||||
if (process_session(curr) != session) {
|
||||
detach_pid(curr, PIDTYPE_SID);
|
||||
curr->signal->session = session;
|
||||
attach_pid(curr, PIDTYPE_SID, session);
|
||||
|
@ -647,10 +647,11 @@ reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
|
|||
* outside, so the child pgrp is now orphaned.
|
||||
*/
|
||||
if ((process_group(p) != process_group(father)) &&
|
||||
(p->signal->session == father->signal->session)) {
|
||||
(process_session(p) == process_session(father))) {
|
||||
int pgrp = process_group(p);
|
||||
|
||||
if (will_become_orphaned_pgrp(pgrp, NULL) && has_stopped_jobs(pgrp)) {
|
||||
if (will_become_orphaned_pgrp(pgrp, NULL) &&
|
||||
has_stopped_jobs(pgrp)) {
|
||||
__kill_pg_info(SIGHUP, SEND_SIG_PRIV, pgrp);
|
||||
__kill_pg_info(SIGCONT, SEND_SIG_PRIV, pgrp);
|
||||
}
|
||||
|
@ -784,7 +785,7 @@ static void exit_notify(struct task_struct *tsk)
|
|||
t = tsk->real_parent;
|
||||
|
||||
if ((process_group(t) != process_group(tsk)) &&
|
||||
(t->signal->session == tsk->signal->session) &&
|
||||
(process_session(t) == process_session(tsk)) &&
|
||||
will_become_orphaned_pgrp(process_group(tsk), tsk) &&
|
||||
has_stopped_jobs(process_group(tsk))) {
|
||||
__kill_pg_info(SIGHUP, SEND_SIG_PRIV, process_group(tsk));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue