diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-06-21 19:17:47 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-06-21 19:18:47 +0200 |
commit | 40473a70cf5ac6743d9e4e70f3229203a278ff9c (patch) | |
tree | 7b468bfd715d5c78ae3e61301d342b3dc15d1d6e /src/sd-daemon.c | |
parent | f1c5860be7b89e784fbba1624127a843b62c7b98 (diff) |
sd-daemon: introduce sd_booted() and set ELF visibility to hidden for all symbols
Diffstat (limited to 'src/sd-daemon.c')
-rw-r--r-- | src/sd-daemon.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sd-daemon.c b/src/sd-daemon.c index e6b9a6f3c2..cb568b5e65 100644 --- a/src/sd-daemon.c +++ b/src/sd-daemon.c @@ -426,3 +426,23 @@ int sd_notifyf(int unset_environment, const char *format, ...) { return r; #endif } + +int sd_booted(void) { +#if defined(DISABLE_SYSTEMD) || !defined(__linux__) + return 0; +#else + + struct stat a, b; + + /* We simply test whether the systemd cgroup hierarchy is + * mounted */ + + if (lstat("/cgroup", &a) < 0) + return 0; + + if (lstat("/cgroup/systemd", &b) < 0) + return 0; + + return a.st_dev != b.st_dev; +#endif +} |