Skip to content

Fix build on FreeBSD. #7206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/tools/io-benchmark.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -9,6 +13,9 @@
#ifdef __linux__
#include <malloc.h>
#endif
#ifdef __FreeBSD__
#include <unistd.h>
#endif

#include <algorithm>
#include <filesystem>
Expand Down Expand Up @@ -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);
Expand Down
Loading