Browse Source

check for existence of posix_fadvise()

Patrick Brosi 6 years ago
parent
commit
00e19bfbdc
1 changed files with 2 additions and 4 deletions
  1. 2 4
      File.cpp

+ 2 - 4
File.cpp

@@ -13,10 +13,6 @@
13
 #include "xml/File.h"
13
 #include "xml/File.h"
14
 #include "xml/NamedEnts.h"
14
 #include "xml/NamedEnts.h"
15
 
15
 
16
-#ifndef POSIX_FADV_SEQUENTIAL
17
-#define POSIX_FADV_SEQUENTIAL 2
18
-#endif
19
-
20
 using namespace xml;
16
 using namespace xml;
21
 
17
 
22
 // _____________________________________________________________________________
18
 // _____________________________________________________________________________
@@ -47,7 +43,9 @@ void File::reset() {
47
   if (_file) close(_file);
43
   if (_file) close(_file);
48
   _file = open(_path.c_str(), O_RDONLY);
44
   _file = open(_path.c_str(), O_RDONLY);
49
   if (_file < 0) throw XmlFileException(std::string("could not open ") + _path);
45
   if (_file < 0) throw XmlFileException(std::string("could not open ") + _path);
46
+#ifdef __unix__
50
   posix_fadvise(_file, 0, 0, POSIX_FADV_SEQUENTIAL);
47
   posix_fadvise(_file, 0, 0, POSIX_FADV_SEQUENTIAL);
48
+#endif
51
 
49
 
52
   _lastBytes = read(_file, _buffer[_which], BUFFER_S);
50
   _lastBytes = read(_file, _buffer[_which], BUFFER_S);
53
   _lastNewData = _lastBytes;
51
   _lastNewData = _lastBytes;