[systemd-devel] libsystemd-daemon wrapper

Max maxim.suraev at campus.tu-berlin.de
Mon Feb 23 02:30:43 PST 2015


Hi.

I've got question partially inspired by recent posts to this ML from some troll
without shift on his keyboard :)

It's been mentioned that calls like sd_listen_fds(0) and others become NOOP when
socket activation is not available due to lack of systemd. Which is fine but leads to
rather inflated code as in here: http://0pointer.de/blog/projects/socket-activation.html

Is there some wrapper library which hides this boilerplate from developers?

I mean instead of writing every time code like

if (sd_listen_fds(0) > 1) {
... // error
} else if (n == 1)
... // systemd OK
else {
... // fallback to legacy
}


I'd really prefer to use something like:

int fd = listen_on_fd_with_or_without_systemd(...);

which effectively incorporates all the fallback-to-legacy logic.

The same question, naturally, applies to non-scocket-activation daemons.

I've tried to search for it but unfortunately came up with nothing so I'd appreciate
links to such projects or to documentation which would explain why this kind of
wrapper is really stupid idea :)

cheers,
Max.



More information about the systemd-devel mailing list