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
main
Nikhil Benesch 8 years ago committed by Facebook Github Bot
parent ff97287016
commit 72fc1e9d07
  1. 8
      env/env_posix.cc

8
env/env_posix.cc vendored

@ -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);

Loading…
Cancel
Save