summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Le Goater <clg@fr.ibm.com>2006-12-08 02:37:55 -0800
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 08:28:51 -0800
commit1ec320afdc9552c92191d5f89fcd1ebe588334ca (patch)
treee526fb29f9487f1ea34aa9ccdf14c318aea2159f
parent937949d9edbf4049bd41af6c9f92c26280584564 (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.c2
-rw-r--r--fs/proc/array.c2
-rw-r--r--include/linux/init_task.h11
-rw-r--r--include/linux/sched.h19
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/fork.c2
6 files changed, 27 insertions, 11 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 4ebba7ca1dc..48cee2004e9 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3855,7 +3855,7 @@ EXPORT_SYMBOL(proc_clear_tty);
void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty)
{
if (tty) {
- tty->session = tsk->signal->session;
+ tty->session = process_session(tsk);
tty->pgrp = process_group(tsk);
}
tsk->signal->tty = tty;
diff --git a/fs/proc/array.c b/fs/proc/array.c
index b0cd014a39b..70e4fab117b 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)
stime = cputime_add(stime, sig->stime);
}
- sid = sig->session;
+ sid = signal_session(sig);
pgid = process_group(task);
ppid = rcu_dereference(task->real_parent)->tgid;
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 733790d4f7d..848a68af3d4 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -57,17 +57,18 @@
.cpu_vm_mask = CPU_MASK_ALL, \
}
-#define INIT_SIGNALS(sig) { \
- .count = ATOMIC_INIT(1), \
+#define INIT_SIGNALS(sig) { \
+ .count = ATOMIC_INIT(1), \
.wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
- .shared_pending = { \
+ .shared_pending = { \
.list = LIST_HEAD_INIT(sig.shared_pending.list), \
- .signal = {{0}}}, \
+ .signal = {{0}}}, \
.posix_timers = LIST_HEAD_INIT(sig.posix_timers), \
.cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \
.rlim = INIT_RLIMITS, \
.pgrp = 1, \
- .session = 1, \
+ .tty_old_pgrp = 0, \
+ { .__session = 1}, \
}
extern struct nsproxy init_nsproxy;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 270d864a8ff..6fec1d41971 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -436,7 +436,12 @@ struct signal_struct {
/* job control IDs */
pid_t pgrp;
pid_t tty_old_pgrp;
- pid_t session;
+
+ union {
+ pid_t session __deprecated;
+ pid_t __session;
+ };
+
/* boolean value for session group leader */
int leader;
@@ -1047,9 +1052,19 @@ static inline pid_t process_group(struct task_struct *tsk)
return tsk->signal->pgrp;
}
+static inline pid_t signal_session(struct signal_struct *sig)
+{
+ return sig->__session;
+}
+
static inline pid_t process_session(struct task_struct *tsk)
{
- return tsk->signal->session;
+ return signal_session(tsk->signal);
+}
+
+static inline void set_signal_session(struct signal_struct *sig, pid_t session)
+{
+ sig->__session = session;
}
static inline struct pid *task_pid(struct task_struct *task)
diff --git a/kernel/exit.c b/kernel/exit.c
index 8d289bfc13d..6267a6cc611 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -304,7 +304,7 @@ void __set_special_pids(pid_t session, pid_t pgrp)
if (process_session(curr) != session) {
detach_pid(curr, PIDTYPE_SID);
- curr->signal->session = session;
+ set_signal_session(curr->signal, session);
attach_pid(curr, PIDTYPE_SID, session);
}
if (process_group(curr) != pgrp) {
diff --git a/kernel/fork.c b/kernel/fork.c
index 298c4d6ab51..60d2644bfe8 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1259,7 +1259,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
if (thread_group_leader(p)) {
p->signal->tty = current->signal->tty;
p->signal->pgrp = process_group(current);
- p->signal->session = process_session(current);
+ set_signal_session(p->signal, process_session(current));
attach_pid(p, PIDTYPE_PGID, process_group(p));
attach_pid(p, PIDTYPE_SID, process_session(p));