]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] add process_session() helper routine: deprecate old field
authorCedric Le Goater <clg@fr.ibm.com>
Fri, 8 Dec 2006 10:37:55 +0000 (02:37 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 8 Dec 2006 16:28:51 +0000 (08:28 -0800)
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>
drivers/char/tty_io.c
fs/proc/array.c
include/linux/init_task.h
include/linux/sched.h
kernel/exit.c
kernel/fork.c

index 4ebba7ca1dc9982dbc7272de7f1c86c91c59dd7c..48cee2004e97f70cf1712b514babac396fb9ed21 100644 (file)
@@ -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;
index b0cd014a39bd7267707f95a264fe24a82b0eec08..70e4fab117b154ec0379aea1f924e5f021195e7e 100644 (file)
@@ -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;
 
index 733790d4f7db881a88eddcb3f8a4d31204236a24..848a68af3d42d10cb1b81527bce8a3182c3eac1b 100644 (file)
        .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;
index 270d864a8ff1b8a9c2045a9a4767a98a9daf7b24..6fec1d419714dc3ea5bb908fb27dfc860f8606cc 100644 (file)
@@ -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)
index 8d289bfc13d1c3f87c7f819595f05ebbd58481d6..6267a6cc61139a1b09888bd9fa80f31cfbe674cd 100644 (file)
@@ -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) {
index 298c4d6ab5124b075314ae570051ae01669397fc..60d2644bfe853a7f69f5a151c114f730fb0985c2 100644 (file)
@@ -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));