--- agent/common.h.orig	Fri Feb 12 10:49:13 2016
+++ agent/common.h	Sun Sep 11 10:41:18 2016
@@ -12,9 +12,18 @@
 
 #include "catalog/pg_control.h"
 
-#ifndef WIN32
+#if !defined(WIN32)
+#if defined(__OpenBSD__)
+#include <sys/select.h> /* timespec */
+#include <sys/sched.h>
+#include <sys/resource.h>
+#include <sys/sysctl.h>
+#include <paths.h>
+#include <kvm.h>
+#else
 #include "linux/version.h"
 #endif
+#endif
 
 #define LINUX_VERSION_AT_LEAST(major, minor, patch) \
 	(LINUX_VERSION_CODE >= KERNEL_VERSION(major, minor, patch))
@@ -22,9 +31,11 @@
 #define GLIBC_VERSION_AT_LEAST(major, minor) \
 	(__GLIBC__ > major || (__GLIBC__ == major && __GLIBC_MINOR__ >= minor))
 
+#if defined(__linux__)
 #ifndef HAVE_SYNC_FILE_RANGE
 #if (LINUX_VERSION_AT_LEAST(2,6,17) && GLIBC_VERSION_AT_LEAST(2,6))
 #define HAVE_SYNC_FILE_RANGE
+#endif
 #endif
 #endif
 
