diff options
author | Cedric Le Goater <clg@fr.ibm.com> | 2006-12-08 05:37:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:51 -0500 |
commit | 1ec320afdc9552c92191d5f89fcd1ebe588334ca (patch) | |
tree | e526fb29f9487f1ea34aa9ccdf14c318aea2159f | |
parent | 937949d9edbf4049bd41af6c9f92c26280584564 (diff) |
[PATCH] add process_session() helper routine: deprecate old field
Add an anonymous union and ((deprecated)) to catch direct usage of the
session field.
[akpm@osdl.org: fix various missed conversions]
[jdike@addtoit.com: fix UML bug]
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/char/tty_io.c | 2 | ||||
-rw-r--r-- | fs/proc/array.c | 2 | ||||
-rw-r--r-- | include/linux/init_task.h | 11 | ||||
-rw-r--r-- | include/linux/sched.h | 19 | ||||
-rw-r--r-- | kernel/exit.c | 2 | ||||
-rw-r--r-- | kernel/fork.c | 2 |
6 files changed, 27 insertions, 11 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 4ebba7ca1dc9..48cee2004e97 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -3855,7 +3855,7 @@ EXPORT_SYMBOL(proc_clear_tty); | |||
3855 | void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty) | 3855 | void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty) |
3856 | { | 3856 | { |
3857 | if (tty) { | 3857 | if (tty) { |
3858 | tty->session = tsk->signal->session; | 3858 | tty->session = process_session(tsk); |
3859 | tty->pgrp = process_group(tsk); | 3859 | tty->pgrp = process_group(tsk); |
3860 | } | 3860 | } |
3861 | tsk->signal->tty = tty; | 3861 | tsk->signal->tty = tty; |
diff --git a/fs/proc/array.c b/fs/proc/array.c index b0cd014a39bd..70e4fab117b1 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -381,7 +381,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) | |||
381 | stime = cputime_add(stime, sig->stime); | 381 | stime = cputime_add(stime, sig->stime); |
382 | } | 382 | } |
383 | 383 | ||
384 | sid = sig->session; | 384 | sid = signal_session(sig); |
385 | pgid = process_group(task); | 385 | pgid = process_group(task); |
386 | ppid = rcu_dereference(task->real_parent)->tgid; | 386 | ppid = rcu_dereference(task->real_parent)->tgid; |
387 | 387 | ||
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 733790d4f7db..848a68af3d42 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -57,17 +57,18 @@ | |||
57 | .cpu_vm_mask = CPU_MASK_ALL, \ | 57 | .cpu_vm_mask = CPU_MASK_ALL, \ |
58 | } | 58 | } |
59 | 59 | ||
60 | #define INIT_SIGNALS(sig) { \ | 60 | #define INIT_SIGNALS(sig) { \ |
61 | .count = ATOMIC_INIT(1), \ | 61 | .count = ATOMIC_INIT(1), \ |
62 | .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ | 62 | .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ |
63 | .shared_pending = { \ | 63 | .shared_pending = { \ |
64 | .list = LIST_HEAD_INIT(sig.shared_pending.list), \ | 64 | .list = LIST_HEAD_INIT(sig.shared_pending.list), \ |
65 | .signal = {{0}}}, \ | 65 | .signal = {{0}}}, \ |
66 | .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \ | 66 | .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \ |
67 | .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \ | 67 | .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \ |
68 | .rlim = INIT_RLIMITS, \ | 68 | .rlim = INIT_RLIMITS, \ |
69 | .pgrp = 1, \ | 69 | .pgrp = 1, \ |
70 | .session = 1, \ | 70 | .tty_old_pgrp = 0, \ |
71 | { .__session = 1}, \ | ||
71 | } | 72 | } |
72 | 73 | ||
73 | extern struct nsproxy init_nsproxy; | 74 | extern struct nsproxy init_nsproxy; |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 270d864a8ff1..6fec1d419714 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -436,7 +436,12 @@ struct signal_struct { | |||
436 | /* job control IDs */ | 436 | /* job control IDs */ |
437 | pid_t pgrp; | 437 | pid_t pgrp; |
438 | pid_t tty_old_pgrp; | 438 | pid_t tty_old_pgrp; |
439 | pid_t session; | 439 | |
440 | union { | ||
441 | pid_t session __deprecated; | ||
442 | pid_t __session; | ||
443 | }; | ||
444 | |||
440 | /* boolean value for session group leader */ | 445 | /* boolean value for session group leader */ |
441 | int leader; | 446 | int leader; |
442 | 447 | ||
@@ -1047,9 +1052,19 @@ static inline pid_t process_group(struct task_struct *tsk) | |||
1047 | return tsk->signal->pgrp; | 1052 | return tsk->signal->pgrp; |
1048 | } | 1053 | } |
1049 | 1054 | ||
1055 | static inline pid_t signal_session(struct signal_struct *sig) | ||
1056 | { | ||
1057 | return sig->__session; | ||
1058 | } | ||
1059 | |||
1050 | static inline pid_t process_session(struct task_struct *tsk) | 1060 | static inline pid_t process_session(struct task_struct *tsk) |
1051 | { | 1061 | { |
1052 | return tsk->signal->session; | 1062 | return signal_session(tsk->signal); |
1063 | } | ||
1064 | |||
1065 | static inline void set_signal_session(struct signal_struct *sig, pid_t session) | ||
1066 | { | ||
1067 | sig->__session = session; | ||
1053 | } | 1068 | } |
1054 | 1069 | ||
1055 | static inline struct pid *task_pid(struct task_struct *task) | 1070 | static inline struct pid *task_pid(struct task_struct *task) |
diff --git a/kernel/exit.c b/kernel/exit.c index 8d289bfc13d1..6267a6cc6113 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -304,7 +304,7 @@ void __set_special_pids(pid_t session, pid_t pgrp) | |||
304 | 304 | ||
305 | if (process_session(curr) != 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 | set_signal_session(curr->signal, session); |
308 | attach_pid(curr, PIDTYPE_SID, session); | 308 | attach_pid(curr, PIDTYPE_SID, session); |
309 | } | 309 | } |
310 | if (process_group(curr) != pgrp) { | 310 | if (process_group(curr) != pgrp) { |
diff --git a/kernel/fork.c b/kernel/fork.c index 298c4d6ab512..60d2644bfe85 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1259,7 +1259,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1259 | if (thread_group_leader(p)) { | 1259 | if (thread_group_leader(p)) { |
1260 | p->signal->tty = current->signal->tty; | 1260 | p->signal->tty = current->signal->tty; |
1261 | p->signal->pgrp = process_group(current); | 1261 | p->signal->pgrp = process_group(current); |
1262 | p->signal->session = process_session(current); | 1262 | set_signal_session(p->signal, process_session(current)); |
1263 | attach_pid(p, PIDTYPE_PGID, process_group(p)); | 1263 | attach_pid(p, PIDTYPE_PGID, process_group(p)); |
1264 | attach_pid(p, PIDTYPE_SID, process_session(p)); | 1264 | attach_pid(p, PIDTYPE_SID, process_session(p)); |
1265 | 1265 | ||