summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2020-04-21 19:04:21 +0200
committerTor Egge <Tor.Egge@broadpark.no>2020-04-21 19:04:21 +0200
commitfb6706faaa60a35f4deb528022cf480f1d180601 (patch)
treefa90232078b8a349fc795f9f853bdeb11cdb9eb6 /vespalib
parent037816b9203d7e0ba271dfc7ceace1f7af7633b6 (diff)
Directio support in vespa is limited to linux.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/io/fileutil.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/vespalib/src/vespa/vespalib/io/fileutil.cpp b/vespalib/src/vespa/vespalib/io/fileutil.cpp
index 3f54b83bee6..5840b621a6c 100644
--- a/vespalib/src/vespa/vespalib/io/fileutil.cpp
+++ b/vespalib/src/vespa/vespalib/io/fileutil.cpp
@@ -180,10 +180,13 @@ File::open(int flags, bool autoCreateDirectories) {
}
int openflags = ((flags & File::READONLY) != 0 ? O_RDONLY : O_RDWR)
| ((flags & File::CREATE) != 0 ? O_CREAT : 0)
+#ifdef __linux__
| ((flags & File::DIRECTIO) != 0 ? O_DIRECT : 0)
+#endif
| ((flags & File::TRUNC) != 0 ? O_TRUNC: 0);
int fd = openAndCreateDirsIfMissing(_filename, openflags,
autoCreateDirectories);
+#ifdef __linux__
if (fd < 0 && ((flags & File::DIRECTIO) != 0)) {
openflags = (openflags ^ O_DIRECT);
flags = (flags ^ DIRECTIO);
@@ -193,6 +196,7 @@ File::open(int flags, bool autoCreateDirectories) {
fd = openAndCreateDirsIfMissing(_filename, openflags,
autoCreateDirectories);
}
+#endif
if (fd < 0) {
asciistream ost;
ost << "open(" << _filename << ", 0x"