From bfbdd06ae4d97601d57b5e483d1fb3e04207b0c0 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Thu, 2 Apr 2009 16:58:39 -0700 Subject: [PATCH] --- yaml --- r: 139711 b: refs/heads/master c: 1b0f7ffd0ea27cd3a0b9ca04e3df9522048c32a3 h: refs/heads/master i: 139709: 1e47814fbe11608bb5aa3d3920486ae3e694b6cc 139707: 904ee6f07db8888a2bb4ddb1ac64d2b694558899 139703: 71c1c1031c6c9b259c6bc5560cb2e84701306c35 139695: 8c9d6a42ff8bbda8a0f7e94448dbecd2cb7da348 139679: f03449f8829a218e9518fb455d0e5305aa1784a5 139647: 138eab6fee5c199db58315c9ea06863436a038a3 v: v3 --- [refs] | 2 +- trunk/drivers/char/tty_io.c | 4 ++-- trunk/include/linux/sched.h | 43 ++++++------------------------------- trunk/kernel/exit.c | 10 +++------ trunk/kernel/fork.c | 2 -- trunk/kernel/sys.c | 4 +--- 6 files changed, 13 insertions(+), 52 deletions(-) diff --git a/[refs] b/[refs] index 294d14e2ddc9..0f3eb2562dcd 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 52ee2dfdd4f51cf422ea6a96a0846dc94244aa37 +refs/heads/master: 1b0f7ffd0ea27cd3a0b9ca04e3df9522048c32a3 diff --git a/trunk/drivers/char/tty_io.c b/trunk/drivers/char/tty_io.c index a44b701c5bba..66b99a2049e3 100644 --- a/trunk/drivers/char/tty_io.c +++ b/trunk/drivers/char/tty_io.c @@ -2681,7 +2681,7 @@ void __do_SAK(struct tty_struct *tty) /* Kill the entire session */ do_each_pid_task(session, PIDTYPE_SID, p) { printk(KERN_NOTICE "SAK: killed process %d" - " (%s): task_session_nr(p)==tty->session\n", + " (%s): task_session(p)==tty->session\n", task_pid_nr(p), p->comm); send_sig(SIGKILL, p, 1); } while_each_pid_task(session, PIDTYPE_SID, p); @@ -2691,7 +2691,7 @@ void __do_SAK(struct tty_struct *tty) do_each_thread(g, p) { if (p->signal->tty == tty) { printk(KERN_NOTICE "SAK: killed process %d" - " (%s): task_session_nr(p)==tty->session\n", + " (%s): task_session(p)==tty->session\n", task_pid_nr(p), p->comm); send_sig(SIGKILL, p, 1); continue; diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index 49df878a0cad..206ac003e8c0 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -547,25 +547,8 @@ struct signal_struct { struct list_head cpu_timers[3]; - /* job control IDs */ - - /* - * pgrp and session fields are deprecated. - * use the task_session_Xnr and task_pgrp_Xnr routines below - */ - - union { - pid_t pgrp __deprecated; - pid_t __pgrp; - }; - struct pid *tty_old_pgrp; - union { - pid_t session __deprecated; - pid_t __session; - }; - /* boolean value for session group leader */ int leader; @@ -1469,16 +1452,6 @@ static inline int rt_task(struct task_struct *p) return rt_prio(p->prio); } -static inline void set_task_session(struct task_struct *tsk, pid_t session) -{ - tsk->signal->__session = session; -} - -static inline void set_task_pgrp(struct task_struct *tsk, pid_t pgrp) -{ - tsk->signal->__pgrp = pgrp; -} - static inline struct pid *task_pid(struct task_struct *task) { return task->pids[PIDTYPE_PID].pid; @@ -1552,11 +1525,6 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk) } -static inline pid_t task_pgrp_nr(struct task_struct *tsk) -{ - return tsk->signal->__pgrp; -} - static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) { @@ -1569,11 +1537,6 @@ static inline pid_t task_pgrp_vnr(struct task_struct *tsk) } -static inline pid_t task_session_nr(struct task_struct *tsk) -{ - return tsk->signal->__session; -} - static inline pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) { @@ -1585,6 +1548,12 @@ static inline pid_t task_session_vnr(struct task_struct *tsk) return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL); } +/* obsolete, do not use */ +static inline pid_t task_pgrp_nr(struct task_struct *tsk) +{ + return task_pgrp_nr_ns(tsk, &init_pid_ns); +} + /** * pid_alive - check that a task structure is not stale * @p: Task structure to be checked. diff --git a/trunk/kernel/exit.c b/trunk/kernel/exit.c index 384f09caf2ef..3bec141c82f6 100644 --- a/trunk/kernel/exit.c +++ b/trunk/kernel/exit.c @@ -357,16 +357,12 @@ static void reparent_to_kthreadd(void) void __set_special_pids(struct pid *pid) { struct task_struct *curr = current->group_leader; - pid_t nr = pid_nr(pid); - if (task_session(curr) != pid) { + if (task_session(curr) != pid) change_pid(curr, PIDTYPE_SID, pid); - set_task_session(curr, nr); - } - if (task_pgrp(curr) != pid) { + + if (task_pgrp(curr) != pid) change_pid(curr, PIDTYPE_PGID, pid); - set_task_pgrp(curr, nr); - } } static void set_special_pids(struct pid *pid) diff --git a/trunk/kernel/fork.c b/trunk/kernel/fork.c index adbea16ec649..f74458231449 100644 --- a/trunk/kernel/fork.c +++ b/trunk/kernel/fork.c @@ -1265,8 +1265,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, p->signal->leader_pid = pid; tty_kref_put(p->signal->tty); p->signal->tty = tty_kref_get(current->signal->tty); - set_task_pgrp(p, task_pgrp_nr(current)); - set_task_session(p, task_session_nr(current)); attach_pid(p, PIDTYPE_PGID, task_pgrp(current)); attach_pid(p, PIDTYPE_SID, task_session(current)); list_add_tail_rcu(&p->tasks, &init_task.tasks); diff --git a/trunk/kernel/sys.c b/trunk/kernel/sys.c index 37f458e6882a..742cefa527e6 100644 --- a/trunk/kernel/sys.c +++ b/trunk/kernel/sys.c @@ -1013,10 +1013,8 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid) if (err) goto out; - if (task_pgrp(p) != pgrp) { + if (task_pgrp(p) != pgrp) change_pid(p, PIDTYPE_PGID, pgrp); - set_task_pgrp(p, pid_nr(pgrp)); - } err = 0; out: