avoid non-existent O_DIRECT on OpenBSD

Summary:
OpenBSD doesn't have `O_DIRECT`, so avoid it. (RocksDB compiles successfully on
OpenBSD with this patch.)
Closes https://github.com/facebook/rocksdb/pull/2106

Differential Revision: D4847833

Pulled By: siying

fbshipit-source-id: 214b785
This commit is contained in:
Nikhil Benesch 2017-04-07 10:26:19 -07:00 committed by Facebook Github Bot
parent ff97287016
commit 72fc1e9d07

8
env/env_posix.cc vendored
View File

@ -159,7 +159,7 @@ class PosixEnv : public Env {
#ifdef ROCKSDB_LITE
return Status::IOError(fname, "Direct I/O not supported in RocksDB lite");
#endif // !ROCKSDB_LITE
#ifndef OS_MACOSX
#if !defined(OS_MACOSX) && !defined(OS_OPENBSD)
flags |= O_DIRECT;
#endif
}
@ -206,7 +206,7 @@ class PosixEnv : public Env {
#ifdef ROCKSDB_LITE
return Status::IOError(fname, "Direct I/O not supported in RocksDB lite");
#endif // !ROCKSDB_LITE
#ifndef OS_MACOSX
#if !defined(OS_MACOSX) && !defined(OS_OPENBSD)
flags |= O_DIRECT;
TEST_SYNC_POINT_CALLBACK("NewRandomAccessFile:O_DIRECT", &flags);
#endif
@ -271,7 +271,7 @@ class PosixEnv : public Env {
return Status::IOError(fname, "Direct I/O not supported in RocksDB lite");
#endif // ROCKSDB_LITE
flags |= O_WRONLY;
#ifndef OS_MACOSX
#if !defined(OS_MACOSX) && !defined(OS_OPENBSD)
flags |= O_DIRECT;
#endif
TEST_SYNC_POINT_CALLBACK("NewWritableFile:O_DIRECT", &flags);
@ -338,7 +338,7 @@ class PosixEnv : public Env {
return Status::IOError(fname, "Direct I/O not supported in RocksDB lite");
#endif // !ROCKSDB_LITE
flags |= O_WRONLY;
#ifndef OS_MACOSX
#if !defined(OS_MACOSX) && !defined(OS_OPENBSD)
flags |= O_DIRECT;
#endif
TEST_SYNC_POINT_CALLBACK("NewWritableFile:O_DIRECT", &flags);