$OpenBSD: patch-common_platform_linux_h,v 1.12 2011/12/22 17:10:04 ajacoutot Exp $
--- common/platform.linux.h.orig	Thu Dec 22 01:02:34 2011
+++ common/platform.linux.h	Thu Dec 22 12:14:19 2011
@@ -63,8 +63,16 @@
 #include <dlfcn.h>
 #include <stddef.h>
 #include <libgen.h>
+#if defined(__OpenBSD__)
+#include <sys/endian.h>
+#include <sys/param.h>
+#ifndef MAX_PATH
+  #define MAX_PATH PATH_MAX
+#endif
+#else
 #include <byteswap.h>
 #include <endian.h>
+#endif
 #include <errno.h>
 
 #include <string>
@@ -663,7 +671,11 @@ time_t GetProcessTime();
 
 #ifndef ntohll
 	#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef __OpenBSD__
 		#define ntohll(x) __bswap_64(x)
+#else
+		#define ntohll(x) __swap64(x)
+#endif // __OpenBSD__
 	#else
 		#define ntohll(x) (x)
 	#endif
@@ -671,14 +683,18 @@ time_t GetProcessTime();
 
 #ifndef htonll
 	#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef __OpenBSD__
 		#define htonll(x) __bswap_64(x)
+#else
+		#define htonll(x) __swap64(x)
+#endif // __OpenBSD__
 	#else
 		#define htonll(x) (x)
 	#endif
 #endif
 
 #define OutputDebugStringA(dstr) fprintf(stderr,"%s",dstr)
-#define GetCurrentThreadId() (int)pthread_self()
+#define GetCurrentThreadId() (intptr_t)pthread_self()
 #define GetTickCount() 0L
 
 #define TICKS_PER_SEC (sysconf(_SC_CLK_TCK))
