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">
6 SPDX-License-Identifier: LGPL-2.1+
8 This file is part of systemd.
10 Copyright 2012 Lennart Poettering
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.
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.
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/>.
26 <refentry id=
"sd_id128_randomize">
29 <title>sd_id128_randomize
</title>
30 <productname>systemd
</productname>
34 <contrib>Developer
</contrib>
35 <firstname>Lennart
</firstname>
36 <surname>Poettering
</surname>
37 <email>lennart@poettering.net
</email>
43 <refentrytitle>sd_id128_randomize
</refentrytitle>
44 <manvolnum>3</manvolnum>
48 <refname>sd_id128_randomize
</refname>
49 <refpurpose>Generate
128-bit IDs
</refpurpose>
54 <funcsynopsisinfo>#include
<systemd/sd-id128.h
></funcsynopsisinfo>
57 <funcdef>int
<function>sd_id128_randomize
</function></funcdef>
58 <paramdef>sd_id128_t *
<parameter>ret
</parameter></paramdef>
65 <title>Description
</title>
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
74 <para>Note that
<function>sd_id128_randomize()
</function> always
75 returns a UUID v4-compatible ID.
</para>
77 <para>For more information about the
<literal>sd_id128_t
</literal>
79 <citerefentry><refentrytitle>sd-id128
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
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>
87 <title>Return Value
</title>
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>
97 <para>The
<function>sd_id128_randomize()
</function> interface is
98 available as a shared library, which can be compiled and linked to
100 <literal>libsystemd
</literal> <citerefentry project='die-net'
><refentrytitle>pkg-config
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
105 <title>See Also
</title>
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>