Commit 40473a70 authored by Lennart Poettering's avatar Lennart Poettering

sd-daemon: introduce sd_booted() and set ELF visibility to hidden for all symbols

parent f1c5860b
......@@ -38,6 +38,8 @@
#define _weak_ __attribute__ ((weak))
#define _likely_(x) (__builtin_expect(!!(x),1))
#define _unlikely_(x) (__builtin_expect(!!(x),0))
#define _public_ __attribute__ ((visibility("default")))
#define _hidden_ __attribute__ ((visibility("hidden")))
/* Rounds up */
static inline size_t ALIGN(size_t l) {
......
......@@ -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
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment