]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_id128_randomize.xml
test-hostname-util: add assert_se's to make coverity happy
[thirdparty/systemd.git] / man / sd_id128_randomize.xml
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 SPDX-License-Identifier: LGPL-2.1+
7
8 This file is part of systemd.
9
10 Copyright 2012 Lennart Poettering
11
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
16
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 -->
25
26 <refentry id="sd_id128_randomize">
27
28 <refentryinfo>
29 <title>sd_id128_randomize</title>
30 <productname>systemd</productname>
31
32 <authorgroup>
33 <author>
34 <contrib>Developer</contrib>
35 <firstname>Lennart</firstname>
36 <surname>Poettering</surname>
37 <email>lennart@poettering.net</email>
38 </author>
39 </authorgroup>
40 </refentryinfo>
41
42 <refmeta>
43 <refentrytitle>sd_id128_randomize</refentrytitle>
44 <manvolnum>3</manvolnum>
45 </refmeta>
46
47 <refnamediv>
48 <refname>sd_id128_randomize</refname>
49 <refpurpose>Generate 128-bit IDs</refpurpose>
50 </refnamediv>
51
52 <refsynopsisdiv>
53 <funcsynopsis>
54 <funcsynopsisinfo>#include &lt;systemd/sd-id128.h&gt;</funcsynopsisinfo>
55
56 <funcprototype>
57 <funcdef>int <function>sd_id128_randomize</function></funcdef>
58 <paramdef>sd_id128_t *<parameter>ret</parameter></paramdef>
59 </funcprototype>
60
61 </funcsynopsis>
62 </refsynopsisdiv>
63
64 <refsect1>
65 <title>Description</title>
66
67 <para><function>sd_id128_randomize()</function> generates a new
68 randomized 128-bit ID and returns it in
69 <parameter>ret</parameter>. Every invocation returns a new
70 randomly generated ID. This uses the
71 <filename>/dev/urandom</filename> kernel random number
72 generator.</para>
73
74 <para>Note that <function>sd_id128_randomize()</function> always
75 returns a UUID v4-compatible ID.</para>
76
77 <para>For more information about the <literal>sd_id128_t</literal>
78 type, see
79 <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
80
81 <para><citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
82 <option>--new-id128</option> option may be used as a command line
83 front-end for <function>sd_id128_randomize()</function>.</para>
84 </refsect1>
85
86 <refsect1>
87 <title>Return Value</title>
88
89 <para>The call returns 0 on success (in which case
90 <parameter>ret</parameter> is filled in), or a negative
91 errno-style error code.</para>
92 </refsect1>
93
94 <refsect1>
95 <title>Notes</title>
96
97 <para>The <function>sd_id128_randomize()</function> interface is
98 available as a shared library, which can be compiled and linked to
99 with the
100 <literal>libsystemd</literal> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
101 file.</para>
102 </refsect1>
103
104 <refsect1>
105 <title>See Also</title>
106
107 <para>
108 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
109 <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
110 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
111 <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
112 <citerefentry><refentrytitle>sd_id128_get_machine</refentrytitle><manvolnum>3</manvolnum></citerefentry>
113 </para>
114 </refsect1>
115
116 </refentry>