X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fmemory.c;h=107e867f9c92e8524e4332f961ba05b3dcbad652;hp=10bccdee75d940ad19075ded768f7326f22cd12f;hb=f22b9ecc5e5d204e5dcb6861d6fd8039e1fb0181;hpb=bf1c2612bc0405c895f754ebfbb24484122c7cfa diff --git a/src/memory.c b/src/memory.c index 10bccdee..107e867f 100644 --- a/src/memory.c +++ b/src/memory.c @@ -28,7 +28,9 @@ #include "plugin.h" #include "utils/common/common.h" -#ifdef HAVE_SYS_SYSCTL_H +#if (defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_SYSCTLBYNAME)) || \ + defined(__OpenBSD__) +/* Implies BSD variant */ #include #endif #ifdef HAVE_SYS_VMMETER_H @@ -80,9 +82,10 @@ static kstat_t *ksp; static kstat_t *ksz; /* #endif HAVE_LIBKSTAT */ -#elif HAVE_SYSCTL +#elif HAVE_SYSCTL && __OpenBSD__ +/* OpenBSD variant does not have sysctlbyname */ static int pagesize; -/* #endif HAVE_SYSCTL */ +/* #endif HAVE_SYSCTL && __OpenBSD__ */ #elif HAVE_LIBSTATGRAB /* no global variables */ @@ -142,13 +145,14 @@ static int memory_init(void) { /* #endif HAVE_LIBKSTAT */ -#elif HAVE_SYSCTL +#elif HAVE_SYSCTL && __OpenBSD__ + /* OpenBSD variant does not have sysctlbyname */ pagesize = getpagesize(); if (pagesize <= 0) { ERROR("memory plugin: Invalid pagesize: %i", pagesize); return -1; } - /* #endif HAVE_SYSCTL */ + /* #endif HAVE_SYSCTL && __OpenBSD__ */ #elif HAVE_LIBSTATGRAB /* no init stuff */ @@ -408,7 +412,8 @@ static int memory_read_internal(value_list_t *vl) { (gauge_t)arcsize, "unusable", (gauge_t)mem_unus); /* #endif HAVE_LIBKSTAT */ -#elif HAVE_SYSCTL +#elif HAVE_SYSCTL && __OpenBSD__ + /* OpenBSD variant does not have HAVE_SYSCTLBYNAME */ int mib[] = {CTL_VM, VM_METER}; struct vmtotal vmtotal = {0}; gauge_t mem_active; @@ -430,7 +435,7 @@ static int memory_read_internal(value_list_t *vl) { MEMORY_SUBMIT("active", mem_active, "inactive", mem_inactive, "free", mem_free); - /* #endif HAVE_SYSCTL */ + /* #endif HAVE_SYSCTL && __OpenBSD__ */ #elif HAVE_LIBSTATGRAB sg_mem_stats *ios;