1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
| | #ifndef _EMACS_SOCKET_H
#define _EMACS_SOCKET_H 1
#include <assert.h>
#include <errno.h>
#include <signal.h>
#include <stddef.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/socket.h>
/* Systemd's first passed file descriptor */
#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 https://www.freedesktop.org/software/systemd/man/devel/sd_is_socket.html
for more information.
*/
int sd_is_socket(int fd, int type, int listening);
/*
Tells systemd that daemon startup or daemon reload is finished.
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
|