summaryrefslogtreecommitdiff
path: root/port
diff options
context:
space:
mode:
authorSanjay Ghemawat <sanjay@google.com>2012-03-05 10:35:46 -0800
committerSanjay Ghemawat <sanjay@google.com>2012-03-05 10:35:46 -0800
commit015d26f8be6e27d96c536eb9f1ef7275898e3603 (patch)
treef312746957bb3d99fb1c5dd3e79469d80a1e005d /port
parent239ac9d2dea0ac1708b7d903a3d80d3883e0781b (diff)
downloadleveldb-015d26f8be6e27d96c536eb9f1ef7275898e3603.tar.gz
add .gitignore; support for building on a few BSD variants
Diffstat (limited to 'port')
-rw-r--r--port/port_posix.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/port/port_posix.h b/port/port_posix.h
index 9666391..485ad10 100644
--- a/port/port_posix.h
+++ b/port/port_posix.h
@@ -7,7 +7,7 @@
#ifndef STORAGE_LEVELDB_PORT_PORT_POSIX_H_
#define STORAGE_LEVELDB_PORT_PORT_POSIX_H_
-#if defined(OS_MACOSX) || defined(OS_FREEBSD)
+#if defined(OS_MACOSX)
#include <machine/endian.h>
#elif defined(OS_SOLARIS)
#include <sys/isa_defs.h>
@@ -16,6 +16,10 @@
#else
#define BIG_ENDIAN
#endif
+#elif defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) ||\
+ defined(OS_DRAGONFLYBSD)
+ #include <sys/types.h>
+ #include <sys/endian.h>
#else
#include <endian.h>
#endif
@@ -33,13 +37,17 @@
#define IS_LITTLE_ENDIAN (__BYTE_ORDER == __LITTLE_ENDIAN)
#endif
-#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD)
+#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\
+ defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD)
+// Use fread/fwrite/fflush on platforms without _unlocked variants
#define fread_unlocked fread
#define fwrite_unlocked fwrite
#define fflush_unlocked fflush
#endif
-#if defined(OS_MACOSX) || defined(OS_FREEBSD)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD) ||\
+ defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD)
+// Use fsync() on platforms without fdatasync()
#define fdatasync fsync
#endif