[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3] Add systemd socket launching support

From: Matthew Leach
Subject: Re: [PATCH v3] Add systemd socket launching support
Date: Thu, 31 Mar 2016 14:31:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Hi Stefan,

Stefan Monnier <address@hidden> writes:

>> +#include <systemd/sd-daemon.h>
> [..]
>> +#ifdef HAVE_SYSTEMD
>> +      /* Read the number of sockets passed through by systemd. */
>> +      systemd_socket = sd_listen_fds(1);
> AFAICT, this is the core of the dependency to systemd.

Yes, that's correct.  There is also a call to `sd_is_socket' just below
this line.

> Could you explain to us, how the socket information is actually
> passed?  Is it passed via an env-var?

I believe so, I'm not a systemd expert, though.  Looking at the man page
for the sd_listen_fds:

Internally, sd_listen_fds() checks whether the $LISTEN_PID environment
variable equals the daemon PID. If not, it returns
immediately. Otherwise, it parses the number passed in the $LISTEN_FDS
environment variable, then sets the FD_CLOEXEC flag for the parsed
number of file descriptors starting from SD_LISTEN_FDS_START. Finally,
it returns the parsed number.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]