Compiles on Mac OS X

This commit is contained in:
Sebastian Messmer 2015-11-30 13:51:16 +01:00
parent f670b0f80c
commit afd900944a
2 changed files with 10 additions and 2 deletions

View File

@ -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...

View File

@ -1,4 +1,5 @@
#include "FuseFdatasyncTest.h"
#include <fcntl.h>
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;