[PATCH] Run 'samba' daemon in foreground

Rowland Penny rpenny at samba.org
Mon Nov 27 21:45:56 UTC 2017


On Tue, 28 Nov 2017 10:33:22 +1300
Andrew Bartlett via samba-technical <samba-technical at lists.samba.org>
wrote:

> On Mon, 2017-11-27 at 19:43 +0100, Andreas Schneider via samba-
> technical wrote:
> > Hi,
> > 
> > attached is a patch to address an issue with systemd and Samba
> > daemons running in notify mode. In this mode we should not double
> > fork. So we should start the daemons with --foreground. Also
> > systemd will take care of the process group we should not handle
> > that in Samba.
> > 
> > For this I've added --foreground to the 'samba' daemon.
> > 
> > 
> > Review is much appreciated. If OK please push.
> > 
> 
> My main question comes from not really understanding what a session ID
> is in unix.  Your patch makes --no-process-group also change us to
> call getsid(), which was unconditionally false previously. 
> 
> Is that reasonable?  If so, can you just write up what exactly it
> means in the commit message?
> 
> BTW, like like in smbd, it will listen for a fifo/socket on STDIN. 
> This won't impact on systemd as by default it uses /dev/null and that
> is ignored.
> 
> The options here are a confusing mess, so noting the differences with
> -i (--interactive) would be helpful.  As I read it, the only
> difference is that with -i logs got to STDOUT and with --foreground
> become_daemon() is called, potentially allowing --no-process-group to
> trigger the setsid()?  
> 
> I can assure Rowland that adding the extra option won't impact on
> systems not using systemd.
> 
> Thanks,
> 
> Andrew Bartlett
> 

Thanks Andrew, I will withdraw my NAK on the basis this is an option
i.e. it isn't forced on anybody and the 'old' way will still work

Rowland



More information about the samba-technical mailing list