All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cedric Le Goater <clg@fr.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Sukadev Bhattiprolu <sukadev@us.ibm.com>,
	Herbert Poetzl <herbert@13thfloor.at>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Kirill Korotaev <dev@openvz.org>
Subject: Re: [PATCH] add process_session() helper routine
Date: Wed, 18 Oct 2006 22:15:20 +0200	[thread overview]
Message-ID: <45368B58.1000808@fr.ibm.com> (raw)
In-Reply-To: <20061017145142.518e4046.akpm@osdl.org>

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;


      reply	other threads:[~2006-10-18 20:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-17  8:37 [PATCH] add process_session() helper routine Cedric Le Goater
2006-10-17 21:51 ` Andrew Morton
2006-10-18 20:15   ` Cedric Le Goater [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45368B58.1000808@fr.ibm.com \
    --to=clg@fr.ibm.com \
    --cc=akpm@osdl.org \
    --cc=dev@openvz.org \
    --cc=ebiederm@xmission.com \
    --cc=herbert@13thfloor.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sukadev@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.