/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* Copied and adapted from systemd source code. */ #ifndef _SD_SOCKET_H #define _SD_SOCKET_H 1 #include #include #include /* The following functionality is provided: - Support for logging with log levels on stderr - File descriptor passing for socket-based activation - Daemon startup and status notification - Detection of systemd boots See sd-daemon(3) for more information. */ /* The first passed file descriptor is fd 3 */ #define SD_LISTEN_FDS_START 3 /* Helper call for identifying a passed file descriptor. Returns 1 if the file descriptor is a socket of type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If type is 0 a socket type check will not be done and the call only verifies if the file descriptor refers to a socket. If listening is > 0 it is verified that the socket is in listening mode. (i.e. listen() has been called) If listening is == 0 it is verified that the socket is not in listening mode. If listening is < 0 no listening mode check is done. Returns a negative errno style error code on failure. See sd_is_socket(3) for more information. */ int sd_is_socket(int fd, int type, int listening); /* Tells systemd that daemon startup or daemon reload is finished (only relevant for services of Type=notify). See https://www.freedesktop.org/software/systemd/man/devel/sd_notify.html#Notes for more information. */ int sd_notify_ready(void); /* Tells systemd that the daemon is about to go down. See https://www.freedesktop.org/software/systemd/man/devel/sd_notify.html#Notes for more information. */ int sd_notify_stopping(void); #endif