summaryrefslogtreecommitdiffstats
path: root/fastos
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-12-21 05:10:29 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-12-21 05:10:29 +0000
commit12997da6ab07b4bd25ce44d9e2e2ba93b22e74ca (patch)
tree854df0cc80cc083af8f18e54b8e0bcd5b77cca2c /fastos
parent2b51ff0dfcee66b2ed67ef3ce53eb3ef769cb585 (diff)
Followup comments frpm @vekterli.
Diffstat (limited to 'fastos')
-rw-r--r--fastos/src/vespa/fastos/unix_file.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/fastos/src/vespa/fastos/unix_file.cpp b/fastos/src/vespa/fastos/unix_file.cpp
index 9938647a5a7..55ecbcee939 100644
--- a/fastos/src/vespa/fastos/unix_file.cpp
+++ b/fastos/src/vespa/fastos/unix_file.cpp
@@ -153,7 +153,7 @@ FastOS_UNIX_File::CalcAccessFlags(unsigned int openFlags)
return accessFlags;
}
-constexpr int SUPPORTED_MMAP_FLAGS = ~MAP_HUGETLB;
+constexpr int ALWAYS_SUPPORTED_MMAP_FLAGS = ~MAP_HUGETLB;
bool
FastOS_UNIX_File::Open(unsigned int openFlags, const char *filename)
@@ -206,10 +206,10 @@ FastOS_UNIX_File::Open(unsigned int openFlags, const char *filename)
size_t mlen = static_cast<size_t>(filesize);
if ((static_cast<int64_t>(mlen) == filesize) && (mlen > 0)) {
void *mbase = mmap(nullptr, mlen, PROT_READ, MAP_SHARED | _mmapFlags, _filedes, 0);
- if (mbase == reinterpret_cast<void *>(-1)) {
- mbase = mmap(nullptr, mlen, PROT_READ, MAP_SHARED | (_mmapFlags & SUPPORTED_MMAP_FLAGS), _filedes, 0);
+ if (mbase == MAP_FAILED) {
+ mbase = mmap(nullptr, mlen, PROT_READ, MAP_SHARED | (_mmapFlags & ALWAYS_SUPPORTED_MMAP_FLAGS), _filedes, 0);
}
- if (mbase != reinterpret_cast<void *>(-1)) {
+ if (mbase != MAP_FAILED) {
int fadviseOptions = getFAdviseOptions();
int eCode(0);
if (POSIX_FADV_RANDOM == fadviseOptions) {