diff --git a/src/uuid.c b/src/uuid.c
index a607d61926db74fabb5561d646a2f2fcd0d70d2f..8bae376103f0328ec9fb20763ee70c668217e928 100644 (file)
--- a/src/uuid.c
+++ b/src/uuid.c
#include "collectd.h"
#include "common.h"
-#include "configfile.h"
#include "plugin.h"
#if HAVE_SYS_SYSCTL_H
return NULL;
return (strdup (uuid));
}
+#elif defined(__OpenBSD__)
+static char *
+uuid_get_from_sysctl(void)
+{
+ char uuid[UUID_PRINTABLE_NORMAL_LENGTH + 1];
+ size_t len = sizeof (uuid);
+ int mib[2];
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_UUID;
+
+ if (sysctl(mib, 2, uuid, &len, NULL, 0) == -1)
+ return NULL;
+ return (strdup (uuid));
+}
#endif
#if HAVE_LIBHAL_H
#elif defined(__NetBSD__)
if ((uuid = uuid_get_from_sysctlbyname("machdep.dmi.system-uuid")) != NULL)
return (uuid);
+#elif defined(__OpenBSD__)
+ if ((uuid = uuid_get_from_sysctl()) != NULL)
+ return (uuid);
#elif defined(__linux__)
if ((uuid = uuid_get_from_file("/sys/class/dmi/id/product_uuid")) != NULL)
return (uuid);