[PATCH] Run 'samba' daemon in foreground

Andrew Bartlett abartlet at samba.org
Mon Nov 27 21:33:22 UTC 2017

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.


Andrew Bartlett

Andrew Bartlett
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT   

More information about the samba-technical mailing list