SWDEV-387026: using gethostid instead of depending on libsystemd

Change-Id: If576eec4abee1a52dfe7cc5bce507420bc8a4d07


[ROCm/rocprofiler commit: 05f2ef97f9]
Αυτή η υποβολή περιλαμβάνεται σε:
Ammar ELWazir committed 2023-03-09 13:21:09 +00:00
1 γονέας 4724259b1b
υποβολή 7c5f07977c
10 files changed
+34 -61

No files matched your search

@@ -27,7 +27,6 @@
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <systemd/sd-id128.h>
#include <cassert>
#include <cstdint>
@@ -50,14 +49,7 @@ namespace {
}
[[maybe_unused]] uint64_t GetMachineID() {
char hostname[1023] = "\0";
gethostname(hostname, 1023);
sd_id128_t ret;
char machine_id[SD_ID128_STRING_MAX];
[[maybe_unused]] int status = sd_id128_get_machine(&ret);
assert(status == 0 && "Error: Couldn't get machine id!");
if (sd_id128_to_string(ret, machine_id)) return std::hash<std::string>{}(machine_id);
return std::rand();
return gethostid();
}
} // namespace