[PATCH] Run 'samba' daemon in foreground

Andreas Schneider asn at samba.org
Tue Nov 28 10:30:00 UTC 2017


On Tuesday, 28 November 2017 11:19:57 CET Rowland Penny wrote:
> On Tue, 28 Nov 2017 10:59:15 +0100
> Andreas Schneider via samba-technical <samba-technical at lists.samba.org>
> 
> wrote:
> > On Monday, 27 November 2017 22:33:22 CET Andrew Bartlett via
> > 
> > samba-technical 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?
> > 
> > If you have a SysV Daemon, you should call setsid() to detach from
> > any terminal and create an independent session.
> > 
> > If we are running in systemd we should run in forground mode and not
> > call setsid()!
> > 
> > See
> > 
> > https://www.freedesktop.org/software/systemd/man/daemon.html
> > 
> > how SysV Daemons should be implemented.
> 
> So, I take it that the latest patch set allows SysV to work and
> also allows systemd to work 'correctly'

Exactly :-)

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list