Only use MADV_RANDOM if defined
authorJoost VandeVondele <Joost.VandeVondele@gmail.com>
Tue, 1 Sep 2020 10:22:47 +0000 (12:22 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Wed, 2 Sep 2020 05:32:10 +0000 (07:32 +0200)
needed to compile on Haiku.

fixes https://github.com/official-stockfish/Stockfish/issues/3093

closes https://github.com/official-stockfish/Stockfish/pull/3094

No functional change

src/syzygy/tbprobe.cpp

index 3dfe3e3e481053d581703954c44ce62dec5b1a3f..4d682f1a90bc2a38f0e0c444a8e45b833afcb781 100644 (file)
@@ -223,7 +223,9 @@ public:
 
         *mapping = statbuf.st_size;
         *baseAddress = mmap(nullptr, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
+#if defined(MADV_RANDOM)
         madvise(*baseAddress, statbuf.st_size, MADV_RANDOM);
+#endif
         ::close(fd);
 
         if (*baseAddress == MAP_FAILED)