1SD_ID128_GET_MACHINE(3) sd_id128_get_machine SD_ID128_GET_MACHINE(3)
2
3
4
6 sd_id128_get_machine, sd_id128_get_boot - Retrieve 128-bit IDs
7
9 #include <systemd/sd-id128.h>
10
11 int sd_id128_get_machine(sd_id128_t *ret);
12
13 int sd_id128_get_boot(sd_id128_t *ret);
14
16 sd_id128_get_machine() returns the machine ID of the executing host.
17 This reads and parses the machine-id(5) file. This function caches the
18 machine ID internally to make retrieving the machine ID a cheap
19 operation.
20
21 sd_id128_get_boot() returns the boot ID of the executing kernel. This
22 reads and parses the /proc/sys/kernel/random/boot_id file exposed by
23 the kernel. It is randomly generated early at boot and is unique for
24 every running kernel instance. See random(4) for more information. This
25 function also internally caches the returned ID to make this call a
26 cheap operation.
27
28 Note that sd_id128_get_boot() always returns a UUID v4 compatible ID.
29 sd_id128_get_machine() will also return a UUID v4-compatible ID on new
30 installations but might not on older. It is possible to convert the
31 machine ID into a UUID v4-compatible one. For more information, see
32 machine-id(5).
33
34 For more information about the "sd_id128_t" type see sd-id128(3).
35
37 The two calls return 0 on success (in which case ret is filled in), or
38 a negative errno-style error code.
39
41 The sd_id128_get_machine() and sd_id128_get_boot() interfaces are
42 available as a shared library, which can be compiled and linked to with
43 the "libsystemd" pkg-config(1) file.
44
46 systemd(1), sd-id128(3), machine-id(5), random(4),
47 sd_id128_randomize(3)
48
49
50
51systemd 219 SD_ID128_GET_MACHINE(3)