]> git.proxmox.com Git - systemd.git/blob - man/sd_id128_get_machine.html
Imported Upstream version 208
[systemd.git] / man / sd_id128_get_machine.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_id128_get_machine</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_id128_get_machine"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_id128_get_machine, sd_id128_get_boot — Retrieve 128-bit IDs</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;systemd/sd-id128.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_id128_get_machine</b>(</code></td><td>sd_id128_t* <var class="pdparam">ret</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_id128_get_boot</b>(</code></td><td>sd_id128_t* <var class="pdparam">ret</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm274685871200"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p><code class="function">sd_id128_get_machine()</code>
23 returns the machine ID of the executing host. This
24 reads and parses the
25 <a href="machine-id.html"><span class="citerefentry"><span class="refentrytitle">machine-id</span>(5)</span></a>
26 file. This function caches the machine ID internally
27 to make retrieving the machine ID a cheap
28 operation.</p><p><code class="function">sd_id128_get_boot()</code> returns
29 the boot ID of the executing kernel. This reads and
30 parses the
31 <code class="filename">/proc/sys/kernel/random/boot_id</code>
32 file exposed by the kernel. It is randomly generated
33 early at boot and is unique for every running kernel
34 instance. See
35 <a href="random.html"><span class="citerefentry"><span class="refentrytitle">random</span>(4)</span></a>
36 for more information. This function also internally
37 caches the returned ID to make this call a cheap
38 operation.</p><p>Note that
39 <code class="function">sd_id128_get_boot()</code> always returns
40 a UUID v4 compatible
41 ID. <code class="function">sd_id128_get_machine()</code> will
42 also return a UUID v4-compatible ID on new
43 installations but might not on older. It is possible
44 to convert the machine ID into a UUID v4-compatible
45 one. For more information, see
46 <a href="machine-id.html"><span class="citerefentry"><span class="refentrytitle">machine-id</span>(5)</span></a>.</p><p>For more information about the
47 "<code class="literal">sd_id128_t</code>" type see
48 <a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>.</p></div><div class="refsect1"><a name="idm274689814576"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value"></a></h2><p>The two calls return 0 on success (in which
49 case <em class="parameter"><code>ret</code></em> is filled in), or a
50 negative errno-style error code.</p></div><div class="refsect1"><a name="idm274689812736"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes"></a></h2><p>The <code class="function">sd_id128_get_machine()</code>
51 and <code class="function">sd_id128_get_boot()</code>
52 interfaces are available as shared library, which can
53 be compiled and linked to with the
54 "<code class="literal">libsystemd-id128</code>" <a href="pkg-config.html"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
55 file.</p></div><div class="refsect1"><a name="idm274689808400"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
56 <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
57 <a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>,
58 <a href="machine-id.html"><span class="citerefentry"><span class="refentrytitle">machine-id</span>(5)</span></a>,
59 <a href="random.html"><span class="citerefentry"><span class="refentrytitle">random</span>(4)</span></a>,
60 <a href="sd_id128_randomize.html"><span class="citerefentry"><span class="refentrytitle">sd_id128_randomize</span>(3)</span></a>
61 </p></div></div></body></html>