[systemd-devel] sd_notify protocol definition

Lennart Poettering lennart at poettering.net
Tue Mar 31 14:07:54 UTC 2020


On Di, 03.03.20 10:26, Łukasz Niemier (lukasz at niemier.pl) wrote:

> Is there documentation for sd_notify protocol? I am working on
> pure-Erlang implementation of sd_notify (and few other systemd
> facilities) and I am looking for better description than reading C
> code which can be a little confusing without deeper knowledge of
> systemd helper functions around iocvec. Especially ucred and fds
> parts, as rest I have mostly implemented.

The sd_notify() man page says everything there is to say really under
NOTES:

    "These functions send a single datagram with the state string as
    payload to the AF_UNIX socket referenced in the $NOTIFY_SOCKET
    environment variable. If the first character of $NOTIFY_SOCKET is
    "@", the string is understood as Linux abstract namespace
    socket. The datagram is accompanied by the process credentials of
    the sending service, using SCM_CREDENTIALS."

There isn't much more to know.

How to use sendmsg() and iovecs you find described in the respective
man page, but that's a Linux/libc/UNIX API, not a systemd one...

The nice thing about NOTIFY_SOCKET is really that its so simple it
barely even is a protocol...

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list