From afd900944ab35d7d851de6d82dafdb811cfeda3e Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Mon, 30 Nov 2015 13:51:16 +0100 Subject: [PATCH] Compiles on Mac OS X --- CMakeLists.txt | 4 +++- test/fuse/fdatasync/testutils/FuseFdatasyncTest.cpp | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca01666a..6fdff3a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,16 +9,18 @@ ACTIVATE_CPP14() REQUIRE_GCC_VERSION(4.8) ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64) -TARGET_LINK_LIBRARIES(${BII_BLOCK_TARGET} INTERFACE fuse) ENABLE_STYLE_WARNINGS() IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") IF(EXISTS "/usr/local/include/osxfuse") TARGET_INCLUDE_DIRECTORIES(${BII_LIB_TARGET} PUBLIC /usr/local/include/osxfuse) + TARGET_LINK_LIBRARIES(${BII_BLOCK_TARGET} INTERFACE osxfuse) ELSE() MESSAGE(FATAL_ERROR "Osxfuse not found. Please install osxfuse.") ENDIF(EXISTS "/usr/local/include/osxfuse") +ELSE(CMAKE_SYSTEM_NAME) + TARGET_LINK_LIBRARIES(${BII_BLOCK_TARGET} INTERFACE fuse) ENDIF(CMAKE_SYSTEM_NAME) # You can safely delete lines from here... diff --git a/test/fuse/fdatasync/testutils/FuseFdatasyncTest.cpp b/test/fuse/fdatasync/testutils/FuseFdatasyncTest.cpp index 69695c13..8ca0f583 100644 --- a/test/fuse/fdatasync/testutils/FuseFdatasyncTest.cpp +++ b/test/fuse/fdatasync/testutils/FuseFdatasyncTest.cpp @@ -1,4 +1,5 @@ #include "FuseFdatasyncTest.h" +#include void FuseFdatasyncTest::FdatasyncFile(const char *filename) { int error = FdatasyncFileReturnError(filename); @@ -9,8 +10,13 @@ int FuseFdatasyncTest::FdatasyncFileReturnError(const char *filename) { auto fs = TestFS(); int fd = OpenFile(fs.get(), filename); +#ifdef F_FULLFSYNC + // This is MacOSX, which doesn't know fdatasync + int retval = fcntl(fd, F_FULLFSYNC); +#else int retval = ::fdatasync(fd); - if (retval == 0) { +#endif + if (retval != -1) { return 0; } else { return errno;