[systemd-devel] [PATCH 2/3] sd-daemon: Use LISTEN_NAMES env when available

Lennart Poettering lennart at poettering.net
Mon May 18 13:32:18 PDT 2015


On Mon, 18.05.15 16:26, Krzysztof Opasiak (k.opasiak at samsung.com) wrote:

> >Please, let's keep this simple: LISTEN_NAMES should only carry actual
> >names, nothing else, and let's query the kernel for the actual fd
> >types.
> 
> I'm not sure if doing stat() to determine how he should interpret content of
> field in env is simpler and easier but of course you are the maintainer so
> you decide how things should be done;)

Well, we have relatively nice wrappers in sd-daemon.h that simplify
these stat() checks...

> >There's really no point in storing the types in $LISTEN_NAMEs, since
> >this code is no way performance senstive...
> 
> Matching between fds and list of expected paths is done in n^2 so it has no
> performance impact as long as number of passed fds isn't big. I know that it
> is usually done only once during service startup but it increase latency
> between event occurrence and it processing.

Well, the n^2 is pretty theoretic, as using fixed paths in the fs is
kinda the antithesis to using a variable number of fds. If people write
daemons that take a variable number of fds they will probably not
expect them to be mapped to fixed names in the fs, but would
discriminate them by other keys, for example whether they are IP or
AF_UNIX sockets, or whether they are stream or datagram, and so
on. But to do such checks we already have the right APIs from the
kernel... 

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list