]>
Commit | Line | Data |
---|---|---|
12355095 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_randomize"> | |
25 | ||
26 | <refentryinfo> | |
27 | <title>sd_id128_randomize</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_randomize</refentrytitle> | |
42 | <manvolnum>3</manvolnum> | |
43 | </refmeta> | |
44 | ||
45 | <refnamediv> | |
46 | <refname>sd_id128_randomize</refname> | |
a4023a43 | 47 | <refpurpose>Generate 128 bit IDs</refpurpose> |
12355095 LP |
48 | </refnamediv> |
49 | ||
50 | <refsynopsisdiv> | |
51 | <funcsynopsis> | |
52 | <funcsynopsisinfo>#include <systemd/sd-id128.h></funcsynopsisinfo> | |
53 | ||
54 | <funcprototype> | |
55 | <funcdef>int <function>sd_id128_randomize</function></funcdef> | |
56 | <paramdef>sd_id128_t* <parameter>ret</parameter></paramdef> | |
57 | </funcprototype> | |
58 | ||
12355095 LP |
59 | </funcsynopsis> |
60 | </refsynopsisdiv> | |
61 | ||
62 | <refsect1> | |
63 | <title>Description</title> | |
64 | ||
65 | <para><function>sd_id128_randomize()</function> | |
66 | generates a new randomized 128 bit ID and returns it | |
67 | in <parameter>ret</parameter>. Every invocation | |
68 | returns a new randomly generated ID. This uses the | |
69 | <filename>/dev/urandom</filename> kernel random number | |
70 | generator.</para> | |
71 | ||
12355095 | 72 | <para>Note that |
a4023a43 | 73 | <function>sd_id128_randomize()</function> always returns |
12355095 | 74 | a UUID v4 compatible |
a4023a43 | 75 | ID.</para> |
12355095 LP |
76 | |
77 | <para>For more information about the | |
78 | <literal>sd_id128_t</literal> type see | |
cb07866b | 79 | <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para> |
12355095 LP |
80 | |
81 | <para><citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s | |
82 | <literal>--new-id</literal> command may be used as | |
83 | command line front-end for | |
84 | <function>sd_id128_randomize()</function>.</para> | |
85 | </refsect1> | |
86 | ||
87 | <refsect1> | |
88 | <title>Return Value</title> | |
89 | ||
a4023a43 | 90 | <para>The call returns 0 on success (in which |
12355095 LP |
91 | case <parameter>ret</parameter> is filled in), or a |
92 | negative errno-style error code.</para> | |
93 | </refsect1> | |
94 | ||
95 | <refsect1> | |
96 | <title>Notes</title> | |
97 | ||
a4023a43 LP |
98 | <para>The <function>sd_id128_randomize()</function> interface |
99 | is available as shared library, which can be compiled | |
12355095 LP |
100 | and linked to with the |
101 | <literal>libsystemd-id128</literal> | |
102 | <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
103 | file.</para> | |
104 | </refsect1> | |
105 | ||
106 | <refsect1> | |
107 | <title>See Also</title> | |
108 | ||
109 | <para> | |
110 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
cb07866b | 111 | <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
12355095 | 112 | <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
a4023a43 LP |
113 | <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry>, |
114 | <citerefentry><refentrytitle>sd_id128_get_machine</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
12355095 LP |
115 | </para> |
116 | </refsect1> | |
117 | ||
118 | </refentry> |