On Tue, Apr 22, 2014 at 09:09:31AM +0200, Martti Kühne wrote:
> On Sat, Apr 19, 2014 at 9:13 AM, Krol, Willem van de <008...@jfc.nl> wrote:
> > Isn't setpgid(0, 0) after setsid() redundant?
> >
> 
> No. [0] setsid() creates a new session.

The issue is related to setsid() - in particular if you use setpgid(0, 0)
to move a process from one process group to another the pgid specifies an
existing process group to be joined and the session ID of that group
must match the session ID of the joining process.

So if you try the code we had (with setstid() + setpgid(0, 0)) you will
see that the setpgid() call returns -EPERM.

So it is not redundant, it is plain wrong.

That is if I understand everything correctly :P

Cheers,
sin

Reply via email to