aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorCedric Le Goater <clg@fr.ibm.com>2006-12-08 05:37:54 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:28:51 -0500
commit937949d9edbf4049bd41af6c9f92c26280584564 (patch)
treed0a28f503b082f890cfa1f7fe952fda8fc771752 /kernel/exit.c
parentef55d53caa055aedee13e77da82740987dd64f2d (diff)
[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>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index fa0495e167e9..8d289bfc13d1 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -193,14 +193,14 @@ int session_of_pgrp(int pgrp)
193 193
194 read_lock(&tasklist_lock); 194 read_lock(&tasklist_lock);
195 do_each_task_pid(pgrp, PIDTYPE_PGID, p) { 195 do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
196 if (p->signal->session > 0) { 196 if (process_session(p) > 0) {
197 sid = p->signal->session; 197 sid = process_session(p);
198 goto out; 198 goto out;
199 } 199 }
200 } while_each_task_pid(pgrp, PIDTYPE_PGID, p); 200 } while_each_task_pid(pgrp, PIDTYPE_PGID, p);
201 p = find_task_by_pid(pgrp); 201 p = find_task_by_pid(pgrp);
202 if (p) 202 if (p)
203 sid = p->signal->session; 203 sid = process_session(p);
204out: 204out:
205 read_unlock(&tasklist_lock); 205 read_unlock(&tasklist_lock);
206 206
@@ -225,8 +225,8 @@ static int will_become_orphaned_pgrp(int pgrp, struct task_struct *ignored_task)
225 || p->exit_state 225 || p->exit_state
226 || is_init(p->real_parent)) 226 || is_init(p->real_parent))
227 continue; 227 continue;
228 if (process_group(p->real_parent) != pgrp 228 if (process_group(p->real_parent) != pgrp &&
229 && p->real_parent->signal->session == p->signal->session) { 229 process_session(p->real_parent) == process_session(p)) {
230 ret = 0; 230 ret = 0;
231 break; 231 break;
232 } 232 }
@@ -302,7 +302,7 @@ void __set_special_pids(pid_t session, pid_t pgrp)
302{ 302{
303 struct task_struct *curr = current->group_leader; 303 struct task_struct *curr = current->group_leader;
304 304
305 if (curr->signal->session != session) { 305 if (process_session(curr) != session) {
306 detach_pid(curr, PIDTYPE_SID); 306 detach_pid(curr, PIDTYPE_SID);
307 curr->signal->session = session; 307 curr->signal->session = session;
308 attach_pid(curr, PIDTYPE_SID, session); 308 attach_pid(curr, PIDTYPE_SID, session);
@@ -647,10 +647,11 @@ reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
647 * outside, so the child pgrp is now orphaned. 647 * outside, so the child pgrp is now orphaned.
648 */ 648 */
649 if ((process_group(p) != process_group(father)) && 649 if ((process_group(p) != process_group(father)) &&
650 (p->signal->session == father->signal->session)) { 650 (process_session(p) == process_session(father))) {
651 int pgrp = process_group(p); 651 int pgrp = process_group(p);
652 652
653 if (will_become_orphaned_pgrp(pgrp, NULL) && has_stopped_jobs(pgrp)) { 653 if (will_become_orphaned_pgrp(pgrp, NULL) &&
654 has_stopped_jobs(pgrp)) {
654 __kill_pg_info(SIGHUP, SEND_SIG_PRIV, pgrp); 655 __kill_pg_info(SIGHUP, SEND_SIG_PRIV, pgrp);
655 __kill_pg_info(SIGCONT, SEND_SIG_PRIV, pgrp); 656 __kill_pg_info(SIGCONT, SEND_SIG_PRIV, pgrp);
656 } 657 }
@@ -784,7 +785,7 @@ static void exit_notify(struct task_struct *tsk)
784 t = tsk->real_parent; 785 t = tsk->real_parent;
785 786
786 if ((process_group(t) != process_group(tsk)) && 787 if ((process_group(t) != process_group(tsk)) &&
787 (t->signal->session == tsk->signal->session) && 788 (process_session(t) == process_session(tsk)) &&
788 will_become_orphaned_pgrp(process_group(tsk), tsk) && 789 will_become_orphaned_pgrp(process_group(tsk), tsk) &&
789 has_stopped_jobs(process_group(tsk))) { 790 has_stopped_jobs(process_group(tsk))) {
790 __kill_pg_info(SIGHUP, SEND_SIG_PRIV, process_group(tsk)); 791 __kill_pg_info(SIGHUP, SEND_SIG_PRIV, process_group(tsk));