Messages in this thread Patch in this message | | | Date | Wed, 18 Oct 2006 22:15:20 +0200 | From | Cedric Le Goater <> | Subject | Re: [PATCH] add process_session() helper routine |
| |
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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |