]> git.proxmox.com Git - systemd.git/blob - man/sd_booted.html
Imported Upstream version 208
[systemd.git] / man / sd_booted.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_booted</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
2 a.headerlink {
3 color: #c60f0f;
4 font-size: 0.8em;
5 padding: 0 4px 0 4px;
6 text-decoration: none;
7 visibility: hidden;
8 }
9
10 a.headerlink:hover {
11 background-color: #c60f0f;
12 color: white;
13 }
14
15 h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
16 visibility: visible;
17 }
18 </style><a href="index.html">Index </a>·
19 <a href="systemd.directives.html">Directives </a>·
20 <a href="../python-systemd/index.html">Python </a>·
21 <a href="../libudev/index.html">libudev </a>·
22 <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 208</span><hr><div class="refentry"><a name="sd_booted"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_booted — Test whether the system is running the systemd init system</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;systemd/sd-daemon.h&gt;</pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_booted</b>(</code></td><td>void<code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm274673488944"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p><code class="function">sd_booted()</code> checks whether
23 the system was booted up using the systemd init system.</p></div><div class="refsect1"><a name="idm274673487200"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value"></a></h2><p>On failure, this call returns a negative
24 errno-style error code. If the system was booted up
25 with systemd as init system, this call returns a
26 positive return value, zero otherwise.</p></div><div class="refsect1"><a name="idm274673485776"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes"></a></h2><p>This function is provided by the reference
27 implementation of APIs for new-style daemons and
28 distributed with the systemd package. The algorithm it
29 implements is simple, and can easily be reimplemented
30 in daemons if it is important to support this
31 interface without using the reference
32 implementation.</p><p>Internally, this function checks whether the
33 directory <code class="filename">/run/systemd/system/</code>
34 exists. A simple check like this can also be
35 implemented trivially in shell or any other
36 language.</p><p>For details about the algorithm check the
37 liberally licensed reference implementation sources:
38 <a class="ulink" href="http://cgit.freedesktop.org/systemd/systemd/plain/src/libsystemd-daemon/sd-daemon.c" target="_top">http://cgit.freedesktop.org/systemd/systemd/plain/src/libsystemd-daemon/sd-daemon.c</a>
39 and <a class="ulink" href="http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-daemon.h" target="_top">http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-daemon.h</a></p><p><code class="function">sd_booted()</code> is implemented
40 in the reference implementation's
41 <code class="filename">sd-daemon.c</code> and
42 <code class="filename">sd-daemon.h</code> files. These
43 interfaces are available as shared library, which can
44 be compiled and linked to with the
45 <code class="constant">libsystemd-daemon</code> <a href="pkg-config.html"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
46 file. Alternatively, applications consuming these APIs
47 may copy the implementation into their source
48 tree. For more details about the reference
49 implementation see
50 <a href="sd-daemon.html"><span class="citerefentry"><span class="refentrytitle">sd-daemon</span>(3)</span></a>.</p><p>If the reference implementation is used as
51 drop-in files and -DDISABLE_SYSTEMD is set during
52 compilation, this function will always return 0 and
53 otherwise become a NOP.</p></div><div class="refsect1"><a name="idm274673476080"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
54 <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
55 <a href="sd-daemon.html"><span class="citerefentry"><span class="refentrytitle">sd-daemon</span>(3)</span></a>
56 </p></div></div></body></html>