]>
Commit | Line | Data |
---|---|---|
a4023a43 LP |
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"> | |
4 | ||
5 | <!-- | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2012 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | --> | |
23 | ||
24 | <refentry id="sd_id128_get_machine"> | |
25 | ||
26 | <refentryinfo> | |
27 | <title>sd_id128_get_machine</title> | |
28 | <productname>systemd</productname> | |
29 | ||
30 | <authorgroup> | |
31 | <author> | |
32 | <contrib>Developer</contrib> | |
33 | <firstname>Lennart</firstname> | |
34 | <surname>Poettering</surname> | |
35 | <email>lennart@poettering.net</email> | |
36 | </author> | |
37 | </authorgroup> | |
38 | </refentryinfo> | |
39 | ||
40 | <refmeta> | |
41 | <refentrytitle>sd_id128_get_machine</refentrytitle> | |
42 | <manvolnum>3</manvolnum> | |
43 | </refmeta> | |
44 | ||
45 | <refnamediv> | |
46 | <refname>sd_id128_get_machine</refname> | |
47 | <refname>sd_id128_get_boot</refname> | |
e9dd9f95 | 48 | <refpurpose>Retrieve 128-bit IDs</refpurpose> |
a4023a43 LP |
49 | </refnamediv> |
50 | ||
51 | <refsynopsisdiv> | |
52 | <funcsynopsis> | |
53 | <funcsynopsisinfo>#include <systemd/sd-id128.h></funcsynopsisinfo> | |
54 | ||
55 | <funcprototype> | |
56 | <funcdef>int <function>sd_id128_get_machine</function></funcdef> | |
57 | <paramdef>sd_id128_t* <parameter>ret</parameter></paramdef> | |
58 | </funcprototype> | |
59 | ||
60 | <funcprototype> | |
61 | <funcdef>int <function>sd_id128_get_boot</function></funcdef> | |
62 | <paramdef>sd_id128_t* <parameter>ret</parameter></paramdef> | |
63 | </funcprototype> | |
64 | ||
65 | </funcsynopsis> | |
66 | </refsynopsisdiv> | |
67 | ||
68 | <refsect1> | |
69 | <title>Description</title> | |
70 | ||
71 | <para><function>sd_id128_get_machine()</function> | |
72 | returns the machine ID of the executing host. This | |
73 | reads and parses the | |
74 | <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
75 | file. This function caches the machine ID internally | |
76 | to make retrieving the machine ID a cheap | |
77 | operation.</para> | |
78 | ||
79 | <para><function>sd_id128_get_boot()</function> returns | |
80 | the boot ID of the executing kernel. This reads and | |
81 | parses the | |
82 | <filename>/proc/sys/kernel/random/boot_id</filename> | |
83 | file exposed by the kernel. It is randomly generated | |
84 | early at boot and is unique for every running kernel | |
85 | instance. See | |
86 | <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> | |
87 | for more information. This function also internally | |
88 | caches the returned ID to make this call a cheap | |
89 | operation.</para> | |
90 | ||
91 | <para>Note that | |
92 | <function>sd_id128_get_boot()</function> always returns | |
93 | a UUID v4 compatible | |
94 | ID. <function>sd_id128_get_machine()</function> will | |
e9dd9f95 JSJ |
95 | also return a UUID v4-compatible ID on new |
96 | installations but might not on older. It is possible | |
97 | to convert the machine ID into a UUID v4-compatible | |
98 | one. For more information, see | |
a4023a43 LP |
99 | <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> |
100 | ||
101 | <para>For more information about the | |
102 | <literal>sd_id128_t</literal> type see | |
103 | <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para> | |
104 | </refsect1> | |
105 | ||
106 | <refsect1> | |
107 | <title>Return Value</title> | |
108 | ||
109 | <para>The two calls return 0 on success (in which | |
110 | case <parameter>ret</parameter> is filled in), or a | |
111 | negative errno-style error code.</para> | |
112 | </refsect1> | |
113 | ||
114 | <refsect1> | |
115 | <title>Notes</title> | |
116 | ||
117 | <para>The <function>sd_id128_get_machine()</function> | |
118 | and <function>sd_id128_get_boot()</function> | |
494a6682 | 119 | interfaces are available as a shared library, which can |
a4023a43 | 120 | be compiled and linked to with the |
14bf8788 | 121 | <literal>libsystemd</literal> <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
a4023a43 LP |
122 | file.</para> |
123 | </refsect1> | |
124 | ||
125 | <refsect1> | |
126 | <title>See Also</title> | |
127 | ||
128 | <para> | |
129 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
130 | <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
131 | <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
132 | <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry>, | |
133 | <citerefentry><refentrytitle>sd_id128_randomize</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
134 | </para> | |
135 | </refsect1> | |
136 | ||
137 | </refentry> |