X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fcpu.c;h=8c1d4cbd4158ea9f8d313c35b4a27a8483b03f02;hp=92ebfd806d12769a4661c9da8205387e4a47e4da;hb=270cadc40a1e935c7d126a70ea58f7d1c2144d7d;hpb=d748379ea585d52338913a6ba589842ae05ab78a diff --git a/src/cpu.c b/src/cpu.c index 92ebfd80..8c1d4cbd 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -58,7 +58,7 @@ #include #endif /* HAVE_LIBKSTAT */ -#if defined(HAVE_SYSCTL) && defined(HAVE_SYSCTLBYNAME) +#if (defined(HAVE_SYSCTL) && defined(HAVE_SYSCTLBYNAME)) || defined(__OpenBSD__) /* Implies BSD variant */ #include #endif @@ -79,13 +79,13 @@ #endif /* HAVE_SYS_DKSTAT_H */ #define CAN_USE_SYSCTL 0 -#if defined(HAVE_SYSCTL) && defined(HAVE_SYSCTLBYNAME) +#if (defined(HAVE_SYSCTL) && defined(HAVE_SYSCTLBYNAME)) || defined(__OpenBSD__) /* Implies BSD variant */ #if defined(CTL_HW) && defined(HW_NCPU) && defined(CTL_KERN) && \ defined(KERN_CPTIME) && defined(CPUSTATES) #define CAN_USE_SYSCTL 1 #endif -#endif /* HAVE_SYSCTL_H && HAVE_SYSCTLBYNAME */ +#endif /* HAVE_SYSCTL_H && HAVE_SYSCTLBYNAME || __OpenBSD__ */ #define COLLECTD_CPU_STATE_USER 0 #define COLLECTD_CPU_STATE_SYSTEM 1 @@ -143,7 +143,7 @@ static int numcpu; /* #endif HAVE_LIBKSTAT */ #elif CAN_USE_SYSCTL -/* Only possible for BSD variant */ +/* Only possible for (Open) BSD variant */ static int numcpu; /* #endif CAN_USE_SYSCTL */ @@ -269,7 +269,7 @@ static int init(void) { /* #endif HAVE_LIBKSTAT */ #elif CAN_USE_SYSCTL - /* Only on BSD variant */ + /* Only on (Open) BSD variant */ size_t numcpu_size; int mib[2] = {CTL_HW, HW_NCPU}; int status; @@ -733,7 +733,7 @@ static int cpu_read(void) { /* }}} #endif defined(HAVE_LIBKSTAT) */ #elif CAN_USE_SYSCTL /* {{{ */ - /* Only on BSD variant */ + /* Only on (Open) BSD variant */ uint64_t cpuinfo[numcpu][CPUSTATES]; size_t cpuinfo_size; int status;