]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
Add pagesize/getpagesize() for NetBSD case 3499/head
authorEdgar Fuß <ef@math.uni-bonn.de>
Thu, 9 Jul 2020 19:27:38 +0000 (21:27 +0200)
committerGitHub <noreply@github.com>
Thu, 9 Jul 2020 19:27:38 +0000 (21:27 +0200)
In the NetBSD case (has sysctlbyname(), but prefers sysctl()), declare pagesize, #include <unistd.h> and call getpagesize().

src/memory.c

index 6e10ab03548733cdb440461040ae2ab0f6fed9e1..440a5f9cb4c0dfe1f2b25102f70403374daf44e2 100644 (file)
@@ -69,7 +69,12 @@ static vm_size_t pagesize;
 /* #endif HAVE_HOST_STATISTICS */
 
 #elif HAVE_SYSCTLBYNAME
+#if HAVE_SYSCTL && defined(KERNEL_NETBSD)
+static int pagesize;
+#include <unistd.h> /* getpagesize() */
+#else
 /* no global variables */
+#endif
 /* #endif HAVE_SYSCTLBYNAME */
 
 #elif KERNEL_LINUX
@@ -128,7 +133,11 @@ static int memory_init(void) {
   /* #endif HAVE_HOST_STATISTICS */
 
 #elif HAVE_SYSCTLBYNAME
-  /* no init stuff */
+#if HAVE_SYSCTL && defined(KERNEL_NETBSD)
+  pagesize = getpagesize();
+#else
+/* no init stuff */
+#endif /* HAVE_SYSCTL && defined(KERNEL_NETBSD) */
   /* #endif HAVE_SYSCTLBYNAME */
 
 #elif defined(KERNEL_LINUX)