public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: + proc-connector-add-event-for-process-becoming-session-leader.patch added to -mm tree
@ 2009-06-23 20:29 Oleg Nesterov
  2009-06-24  8:53 ` Scott James Remnant
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Nesterov @ 2009-06-23 20:29 UTC (permalink / raw)
  To: Scott James Remnant, Andrew Morton; +Cc: Matt Helsley, linux-kernel

> The act of a process becoming a session leader is a useful signal to a
> supervising init daemon such as Upstart.
...
> @@ -360,8 +360,10 @@ void __set_special_pids(struct pid *pid)
>  {
>  	struct task_struct *curr = current->group_leader;
>
> -	if (task_session(curr) != pid)
> +	if (task_session(curr) != pid) {
>  		change_pid(curr, PIDTYPE_SID, pid);
> +		proc_sid_connector(curr);
> +	}

Wouldn't it better to change sys_setsid() then? This looks more clear
imho, and we can move proc_sid_connector() outside of tasklist_lock.

Note also that __set_special_pids() does not neccessary mean we are
becoming a session leader, see daemonize().

Oleg.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: + proc-connector-add-event-for-process-becoming-session-leader.patch added to -mm tree
  2009-06-23 20:29 + proc-connector-add-event-for-process-becoming-session-leader.patch added to -mm tree Oleg Nesterov
@ 2009-06-24  8:53 ` Scott James Remnant
  2009-06-24 14:44   ` Oleg Nesterov
  0 siblings, 1 reply; 3+ messages in thread
From: Scott James Remnant @ 2009-06-24  8:53 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Andrew Morton, Matt Helsley, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]

On Tue, 2009-06-23 at 22:29 +0200, Oleg Nesterov wrote:

> > The act of a process becoming a session leader is a useful signal to a
> > supervising init daemon such as Upstart.
> ...
> > @@ -360,8 +360,10 @@ void __set_special_pids(struct pid *pid)
> >  {
> >  	struct task_struct *curr = current->group_leader;
> >
> > -	if (task_session(curr) != pid)
> > +	if (task_session(curr) != pid) {
> >  		change_pid(curr, PIDTYPE_SID, pid);
> > +		proc_sid_connector(curr);
> > +	}
> 
> Wouldn't it better to change sys_setsid() then? This looks more clear
> imho, and we can move proc_sid_connector() outside of tasklist_lock.
> 
> Note also that __set_special_pids() does not neccessary mean we are
> becoming a session leader, see daemonize().
> 
Actually, I specifically wanted to receive this event if the process
called daemonize() which is why this is done here rather than in
sys_setsid()

The new session is important information to init in figuring out what
the process is up to (ie, fork(), setsid(), fork() = daemonise)

Scott
-- 
Scott James Remnant
scott@ubuntu.com

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: + proc-connector-add-event-for-process-becoming-session-leader.patch added to -mm tree
  2009-06-24  8:53 ` Scott James Remnant
@ 2009-06-24 14:44   ` Oleg Nesterov
  0 siblings, 0 replies; 3+ messages in thread
From: Oleg Nesterov @ 2009-06-24 14:44 UTC (permalink / raw)
  To: Scott James Remnant; +Cc: Andrew Morton, Matt Helsley, linux-kernel

On 06/24, Scott James Remnant wrote:
>
> On Tue, 2009-06-23 at 22:29 +0200, Oleg Nesterov wrote:
>
> > > The act of a process becoming a session leader is a useful signal to a
> > > supervising init daemon such as Upstart.
> > ...
> > > @@ -360,8 +360,10 @@ void __set_special_pids(struct pid *pid)
> > >  {
> > >  	struct task_struct *curr = current->group_leader;
> > >
> > > -	if (task_session(curr) != pid)
> > > +	if (task_session(curr) != pid) {
> > >  		change_pid(curr, PIDTYPE_SID, pid);
> > > +		proc_sid_connector(curr);
> > > +	}
> >
> > Wouldn't it better to change sys_setsid() then? This looks more clear
> > imho, and we can move proc_sid_connector() outside of tasklist_lock.
> >
> > Note also that __set_special_pids() does not neccessary mean we are
> > becoming a session leader, see daemonize().
> >
> Actually, I specifically wanted to receive this event if the process
> called daemonize() which is why this is done here rather than in
> sys_setsid()

Aha. I was confused by "becoming a session leader" in the changelog.

> The new session is important information to init in figuring out what
> the process is up to (ie, fork(), setsid(), fork() = daemonise)

daemonize() is only needed when a user-space thread does kernel_thread(),
hopefully it will die eventually, this is already deprecated. Then we can
move proc_sid_connector() to sys_setsid(), I think.

Thanks!

Oleg.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-24 17:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-23 20:29 + proc-connector-add-event-for-process-becoming-session-leader.patch added to -mm tree Oleg Nesterov
2009-06-24  8:53 ` Scott James Remnant
2009-06-24 14:44   ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox