1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 SPDX-License-Identifier: LGPL-2.1+
8 This file is part of systemd.
10 Copyright 2010 Lennart Poettering
13 <refentry id="sd_booted"
14 xmlns:xi="http://www.w3.org/2001/XInclude">
17 <title>sd_booted</title>
18 <productname>systemd</productname>
22 <contrib>Developer</contrib>
23 <firstname>Lennart</firstname>
24 <surname>Poettering</surname>
25 <email>lennart@poettering.net</email>
31 <refentrytitle>sd_booted</refentrytitle>
32 <manvolnum>3</manvolnum>
36 <refname>sd_booted</refname>
37 <refpurpose>Test whether the system is running the systemd init system</refpurpose>
42 <funcsynopsisinfo>#include <systemd/sd-daemon.h></funcsynopsisinfo>
45 <funcdef>int <function>sd_booted</function></funcdef>
46 <paramdef>void</paramdef>
52 <title>Description</title>
53 <para><function>sd_booted()</function> checks whether the system
54 was booted up using the systemd init system.</para>
58 <title>Return Value</title>
60 <para>On failure, this call returns a negative errno-style error
61 code. If the system was booted up with systemd as init system,
62 this call returns a positive return value, zero otherwise.</para>
68 <xi:include href="libelogind-pkgconfig.xml" xpointer="pkgconfig-text"/>
70 <para>Internally, this function checks whether the directory
71 <filename>/run/systemd/system/</filename> exists. A simple check
72 like this can also be implemented trivially in shell or any other
77 <title>See Also</title>
79 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
80 <citerefentry><refentrytitle>sd-daemon</refentrytitle><manvolnum>3</manvolnum></citerefentry>