1SD_ID128_RANDOMIZE(3) sd_id128_randomize SD_ID128_RANDOMIZE(3)
2
3
4
6 sd_id128_randomize - Generate 128-bit IDs
7
9 #include <systemd/sd-id128.h>
10
11 int sd_id128_randomize(sd_id128_t *ret);
12
14 sd_id128_randomize() generates a new randomized 128-bit ID and returns
15 it in ret. Every invocation returns a new randomly generated ID. This
16 uses the getrandom(2) kernel random number generator.
17
18 Note that sd_id128_randomize() always returns a UUID Variant 1 Version
19 4 compatible ID. It is hence guaranteed that this function will never
20 return the ID consisting of all zero or all one bits (SD_ID128_NULL,
21 SD_ID128_ALLF).
22
23 For more information about the "sd_id128_t" type, see sd-id128(3).
24
25 systemd-id128(1)'s new command may be used as a command line front-end
26 for sd_id128_randomize().
27
29 The call returns 0 on success (in which case ret is filled in), or a
30 negative errno-style error code.
31
33 Functions described here are available as a shared library, which can
34 be compiled against and linked to with the libsystemd pkg-config(1)
35 file.
36
37 The code described here uses getenv(3), which is declared to be not
38 multi-thread-safe. This means that the code calling the functions
39 described here must not call setenv(3) from a parallel thread. It is
40 recommended to only do calls to setenv() from an early phase of the
41 program when no other threads have been started.
42
44 systemd(1), sd-id128(3), machine-id(5), getrandom(2), random(4),
45 sd_id128_get_machine(3)
46
47
48
49systemd 254 SD_ID128_RANDOMIZE(3)