| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_MACHINE_ID_H |
| 4 | #define NETDATA_MACHINE_ID_H |
| 5 | |
| 6 | #include "libnetdata/libnetdata.h" |
| 7 | #include "libnetdata/uuid/uuid.h" |
| 8 | |
| 9 | /** |
| 10 | * Special value returned when a reliable machine ID cannot be determined |
| 11 | */ |
| 12 | #define NO_MACHINE_ID (ND_UUID){ .parts = { .hig64 = 1, .low64 = 1 } } |
| 13 | |
| 14 | /** |
| 15 | * Get the machine ID |
| 16 | * |
| 17 | * Returns a UUID that uniquely identifies the machine. |
| 18 | * On Linux, this is the systemd machine-id. |
| 19 | * On other systems, it uses platform-specific values. |
| 20 | * |
| 21 | * The value is cached after first call. |
| 22 | * Returns NO_MACHINE_ID when a reliable machine ID cannot be detected. |
| 23 | * |
| 24 | * @return ND_UUID The machine ID |
| 25 | */ |
| 26 | ND_UUID os_machine_id(void); |
| 27 | |
| 28 | #endif // NETDATA_MACHINE_ID_H |