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 This file is part of elogind.
7 SPDX-License-Identifier: LGPL-2.1+
10 Copyright 2012 Lennart Poettering
12 elogind 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 elogind 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 elogind; If not, see <http://www.gnu.org/licenses/>.
26 <refentry id="sd_id128_randomize">
29 <title>sd_id128_randomize</title>
30 <productname>elogind</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 <elogind/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 <!-- 0 /// elogind does not support journalctl
82 <para><citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
83 <option>--new-id128</option> option may be used as a command line
84 front-end for <function>sd_id128_randomize()</function>.</para>
89 <title>Return Value</title>
91 <para>The call returns 0 on success (in which case
92 <parameter>ret</parameter> is filled in), or a negative
93 errno-style error code.</para>
99 <para>The <function>sd_id128_randomize()</function> interface is
100 available as a shared library, which can be compiled and linked to
102 <literal>libelogind</literal> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
107 <title>See Also</title>
110 <!-- 0 /// elogind is in section 8
111 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
113 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
115 <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
116 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
117 <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
118 <citerefentry><refentrytitle>sd_id128_get_machine</refentrytitle><manvolnum>3</manvolnum></citerefentry>