Re: [PATCH] add process_session() helper routine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Morton wrote:

> We should rename signal_struct.session to something else
> (session_dont_use_me_directly) so that any code which accidentally fails to
> use the wrapper will reliably fail to build.

yes. I think we should do that when the code is complete.

> That means that we'll also need a helper function to set this field.

Below is an experiment with an anonymous union and ((deprecated)) to catch
usage of such attributes. Just an idea.

C.


---
 include/linux/init_task.h |    3 ++-
 include/linux/sched.h     |    9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

Index: 2.6.19-rc2-mm1/include/linux/sched.h
===================================================================
--- 2.6.19-rc2-mm1.orig/include/linux/sched.h
+++ 2.6.19-rc2-mm1/include/linux/sched.h
@@ -437,7 +437,12 @@ struct signal_struct {
        /* job control IDs */
        pid_t pgrp;
        pid_t tty_old_pgrp;
-       pid_t session;
+
+       union {
+               pid_t session __attribute ((deprecated));
+               pid_t __session;
+       };
+
        /* boolean value for session group leader */
        int leader;

@@ -1070,7 +1075,7 @@ static inline pid_t process_group(struct

 static inline pid_t process_session(struct task_struct *tsk)
 {
-       return tsk->signal->session;
+       return tsk->signal->__session;
 }

 static inline struct pid *task_pid(struct task_struct *task)
Index: 2.6.19-rc2-mm1/include/linux/init_task.h
===================================================================
--- 2.6.19-rc2-mm1.orig/include/linux/init_task.h
+++ 2.6.19-rc2-mm1/include/linux/init_task.h
@@ -68,7 +68,8 @@
        .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;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux