mirror of
https://git.proxmox.com/git/systemd
synced 2026-01-07 00:42:24 +00:00
Instead of tracking git upstream directly, the upstream branch now contains the contents of the orig tarball available at http://www.freedesktop.org/software/systemd/
58 lines
5.2 KiB
HTML
58 lines
5.2 KiB
HTML
<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>
|
||
a.headerlink {
|
||
color: #c60f0f;
|
||
font-size: 0.8em;
|
||
padding: 0 4px 0 4px;
|
||
text-decoration: none;
|
||
visibility: hidden;
|
||
}
|
||
|
||
a.headerlink:hover {
|
||
background-color: #c60f0f;
|
||
color: white;
|
||
}
|
||
|
||
h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
|
||
visibility: visible;
|
||
}
|
||
</style><a href="index.html">Index </a>·
|
||
<a href="systemd.directives.html">Directives </a>·
|
||
<a href="../python-systemd/index.html">Python </a>·
|
||
<a href="../libudev/index.html">libudev </a>·
|
||
<a href="../libudev/index.html">gudev </a><span style="float:right">systemd 204</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 <systemd/sd-daemon.h></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="idm259792897024"></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
|
||
the system was booted up using the systemd init system.</p></div><div class="refsect1"><a name="idm259792968384"></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
|
||
errno-style error code. If the system was booted up
|
||
with systemd as init system, this call returns a
|
||
positive return value, zero otherwise.</p></div><div class="refsect1"><a name="idm259792966960"></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
|
||
implementation of APIs for new-style daemons and
|
||
distributed with the systemd package. The algorithm it
|
||
implements is simple, and can easily be reimplemented
|
||
in daemons if it is important to support this
|
||
interface without using the reference
|
||
implementation.</p><p>Internally, this function checks whether the
|
||
directory <code class="filename">/run/systemd/system/</code>
|
||
exists. A simple check like this can also be
|
||
implemented trivially in shell or any other
|
||
language.</p><p>For details about the algorithm check the
|
||
liberally licensed reference implementation sources:
|
||
<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>
|
||
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
|
||
in the reference implementation's
|
||
<code class="filename">sd-daemon.c</code> and
|
||
<code class="filename">sd-daemon.h</code> files. These
|
||
interfaces are available as shared library, which can
|
||
be compiled and linked to with the
|
||
<code class="literal">libsystemd-daemon</code>
|
||
<a href="pkg-config.html"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
|
||
file. Alternatively, applications consuming these APIs
|
||
may copy the implementation into their source
|
||
tree. For more details about the reference
|
||
implementation see
|
||
<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
|
||
drop-in files and -DDISABLE_SYSTEMD is set during
|
||
compilation this function will always return 0 and
|
||
otherwise become a NOP.</p></div><div class="refsect1"><a name="idm259791324176"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
|
||
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
|
||
<a href="sd-daemon.html"><span class="citerefentry"><span class="refentrytitle">sd-daemon</span>(3)</span></a>
|
||
</p></div></div></body></html>
|