_sd_export_ int sd_booted(void) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) return 0; #else struct stat st; /* We test whether the runtime unit file directory has been * created. This takes place in mount-setup.c, so is * guaranteed to happen very early during boot. */ if (lstat("/run/systemd/system/", &st) < 0) return 0; return !!S_ISDIR(st.st_mode); #endif }