Process group ownership
Jeremy Allison
jra at samba.org
Thu Dec 27 18:19:01 GMT 2001
On Thu, Dec 27, 2001 at 06:03:20PM -0800, Jos Backus wrote:
> source/smbd/server.c has:
>
> /****************************************************************************
> Send a SIGTERM to our process group.
> *****************************************************************************/
> static void killkids(void)
> {
> if(am_parent) kill(0,SIGTERM);
> }
>
> I think this is a bad coding practice: we did not create the pgrp so we should
> not be killing processes in it because other processes may be part of it. Iow
> if we don't ``own'' the pgrp we should not be messing with it.
>
> There are two ways to fix this:
> - keep track of our children and kill them explicitly;
> - create our own process group (using setpgrp()/setsid()).
>
> Thoughts? Please Cc me because I am not on this list.
We do create our own process group.
Check out the code in the function become_daemon().
setsid() is the POSIX way of creating a session after a fork
and becoming the process group leader.
Jeremy.
More information about the samba-technical
mailing list