Skip to content

Commit 58b313d

Browse files
AMDmi3joto
authored andcommitted
Enable posix_fadvise usage on FreeBSD
1 parent d81d4c8 commit 58b313d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/osmium/io/detail/read_write.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ namespace osmium {
253253
* needed again soon. Keeps the buffer cache clear for other
254254
* things.
255255
*/
256-
#ifdef __linux__
256+
#if defined(__linux__) || defined(__FreeBSD__)
257257
inline void remove_buffered_pages(int fd) noexcept {
258258
if (fd > 0) {
259259
::posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
@@ -269,7 +269,7 @@ namespace osmium {
269269
* file that will not be needed again soon. Keeps the buffer cache
270270
* clear for other things.
271271
*/
272-
#ifdef __linux__
272+
#if defined(__linux__) || defined(__FreeBSD__)
273273
inline void remove_buffered_pages(int fd, std::size_t size) noexcept {
274274
constexpr const std::size_t block_size = 4096;
275275
// Make sure to keep the last 10 blocks around, so were are

include/osmium/io/reader.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ namespace osmium {
248248
#endif
249249
}
250250
const int fd = osmium::io::detail::open_for_reading(filename);
251-
#if __linux__
251+
#if defined(__linux__) || defined(__FreeBSD__)
252252
if (fd >= 0) {
253253
// Tell the kernel we are going to read this file sequentially
254254
::posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);

0 commit comments

Comments
 (0)