1SD_BOOTED(3)                       sd_booted                      SD_BOOTED(3)
2
3
4

NAME

6       sd_booted - Test whether the system is running the systemd init system.
7

SYNOPSIS

9       #include "sd-daemon.h"
10
11       int sd_booted(void);
12

DESCRIPTION

14       sd_booted() checks whether the system was booted up using the systemd
15       init system.
16

RETURN VALUE

18       On failure, this call returns a negative errno-style error code. If the
19       system was booted up with systemd as init system, this call returns a
20       positive return value, zero otherwise.
21

NOTES

23       This function is provided by the reference implementation of APIs for
24       new-style daemons and distributed with the systemd package. The
25       algorithm it implements is simple, and can easily be reimplemented in
26       daemons if it is important to support this interface without using the
27       reference implementation.
28
29       Internally, this function checks whether the /sys/fs/cgroup/systemd
30       virtual file system is mounted, by comparing the st_dev value of the
31       stat() data of /sys/fs/cgroup and /sys/fs/cgroup/systemd.
32
33       For details about the algorithm check the liberally licensed reference
34       implementation sources:
35       http://cgit.freedesktop.org/systemd/tree/src/sd-daemon.c resp.
36       http://cgit.freedesktop.org/systemd/tree/src/sd-daemon.h
37
38       sd_booted() is implemented in the reference implementation´s drop-in
39       sd-daemon.c and sd-daemon.h files. It is recommended that applications
40       consuming these APIs copy the implementation into their source tree.
41       For more details about the reference implementation see sd_daemon(7)
42
43       If -DDISABLE_SYSTEMD is set during compilation this function will
44       always return 0 and otherwise become a NOP.
45

SEE ALSO

47       systemd(1), sd_daemon(7)
48

AUTHOR

50       Lennart Poettering <lennart@poettering.net>
51           Developer
52
53
54
55systemd                           09/14/2010                      SD_BOOTED(3)
Impressum