SD_BOOTED(3)
π
SD_BOOTED(3) β the sd_booted era π
okay so bestie, welcome to sd_booted, a little function from the sd-daemon family that answers one very important question: is this box even running systemd?? β¨
πΈ SYNOPSIS πΈ
#include <systemd/sd-daemon.h>
int sd_booted(void);
literally just include the header and call it with no args. that's it. slay. π
π¦ DESCRIPTION π¦
sd_booted() checks whether the system was booted up using the systemd init system. that's the whole vibe check, no cap. π«Ά
β RETURN VALUE β
okay so the return values matter, don't skip this part:
- On failure, this call returns a negative
errno-style error code π - If the system was booted up with systemd as init system, this call returns a positive return value π
- Otherwise, it returns zero π
so like: positive = yes systemd, zero = no systemd, negative = something went sideways. three whole moods fr fr.
π§ NOTES π§
the functions described here are available as a shared library, which can be compiled against and linked to with the libsystemd pkg-config(1) file. iconic build-system behaviour, we love to see it. π
internally, this function checks whether the directory /run/systemd/system/ exists. that's the entire secret sauce π β a simple check like this can also be implemented trivially in shell or any other language. so if you were expecting dark magic, sorry bestie, it's just a directory existence check. π
π SEE ALSO π
mwah π that's the page! brought to you by systemd 261.3 β go forth and check your init system, bestie, and remember: the header says SD_BOOTED(3) and so does the footer, because symmetry is main character energy β¨π
π
π¦ where this page comes from
- ubuntu stonking: libsystemd-dev 261.3-0ubuntu3 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms