From: Ruben Kerkhof Date: Fri, 25 Dec 2015 10:14:01 +0000 (+0100) Subject: uuid plugin: make it work on FreeBSD X-Git-Tag: collectd-5.6.0~87^2~2 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=58c91485b9b28a866715fc013d23236470699940 uuid plugin: make it work on FreeBSD --- diff --git a/src/uuid.c b/src/uuid.c index 9e9a7a33..816e624a 100644 --- a/src/uuid.c +++ b/src/uuid.c @@ -114,7 +114,7 @@ uuid_get_from_dmidecode(void) return (uuid); } -#if defined(__APPLE__) +#if defined(__APPLE__) || defined(__FreeBSD__) static char * uuid_get_from_sysctlbyname(const char *name) { @@ -212,8 +212,10 @@ uuid_get_local(void) #if defined(__APPLE__) if ((uuid = uuid_get_from_sysctlbyname("kern.uuid")) != NULL) return (uuid); -#endif -#if defined(__linux__) +#elif defined(__FreeBSD__) + if ((uuid = uuid_get_from_sysctlbyname("kern.hostuuid")) != NULL) + return (uuid); +#elif defined(__linux__) if ((uuid = uuid_get_from_file("/sys/class/dmi/id/product_uuid")) != NULL) return (uuid); #endif