From 8c4432e50d922d1618896b4646ee2671c01ed8ba Mon Sep 17 00:00:00 2001 From: Adi Isakovic Date: Thu, 3 Jul 2025 15:44:29 -0400 Subject: [PATCH] Fix build on FreeBSD. --- src/tools/io-benchmark.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/tools/io-benchmark.cpp b/src/tools/io-benchmark.cpp index 507d64dc2c6..5956cab3057 100644 --- a/src/tools/io-benchmark.cpp +++ b/src/tools/io-benchmark.cpp @@ -1,3 +1,7 @@ +#ifdef __FreeBSD__ +#pragma clang diagnostic ignored "-Wunreachable-code" +#endif + #include "util/exception.hpp" #include "util/exception_utils.hpp" #include "util/log.hpp" @@ -9,6 +13,9 @@ #ifdef __linux__ #include #endif +#ifdef __FreeBSD__ +#include +#endif #include #include @@ -89,6 +96,14 @@ int main(int argc, char *argv[]) TIMER_STOP(write_1gb); fclose(fd); #endif +#ifdef __FreeBSD__ + int fd = open(test_path.string().c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_DIRECT, 0644); + fcntl(fd, F_RDAHEAD, 0); + TIMER_START(write_1gb); + write(fd, (char *)random_array, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned)); + TIMER_STOP(write_1gb); + close(fd); +#endif #ifdef __linux__ int file_desc = open(test_path.string().c_str(), O_CREAT | O_TRUNC | O_WRONLY | O_SYNC, S_IRWXU);