Compiles on Mac OS X
This commit is contained in:
parent
f670b0f80c
commit
afd900944a
@ -9,16 +9,18 @@ ACTIVATE_CPP14()
|
|||||||
REQUIRE_GCC_VERSION(4.8)
|
REQUIRE_GCC_VERSION(4.8)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
|
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
|
||||||
TARGET_LINK_LIBRARIES(${BII_BLOCK_TARGET} INTERFACE fuse)
|
|
||||||
|
|
||||||
ENABLE_STYLE_WARNINGS()
|
ENABLE_STYLE_WARNINGS()
|
||||||
|
|
||||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
IF(EXISTS "/usr/local/include/osxfuse")
|
IF(EXISTS "/usr/local/include/osxfuse")
|
||||||
TARGET_INCLUDE_DIRECTORIES(${BII_LIB_TARGET} PUBLIC /usr/local/include/osxfuse)
|
TARGET_INCLUDE_DIRECTORIES(${BII_LIB_TARGET} PUBLIC /usr/local/include/osxfuse)
|
||||||
|
TARGET_LINK_LIBRARIES(${BII_BLOCK_TARGET} INTERFACE osxfuse)
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE(FATAL_ERROR "Osxfuse not found. Please install osxfuse.")
|
MESSAGE(FATAL_ERROR "Osxfuse not found. Please install osxfuse.")
|
||||||
ENDIF(EXISTS "/usr/local/include/osxfuse")
|
ENDIF(EXISTS "/usr/local/include/osxfuse")
|
||||||
|
ELSE(CMAKE_SYSTEM_NAME)
|
||||||
|
TARGET_LINK_LIBRARIES(${BII_BLOCK_TARGET} INTERFACE fuse)
|
||||||
ENDIF(CMAKE_SYSTEM_NAME)
|
ENDIF(CMAKE_SYSTEM_NAME)
|
||||||
|
|
||||||
# You can safely delete lines from here...
|
# You can safely delete lines from here...
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "FuseFdatasyncTest.h"
|
#include "FuseFdatasyncTest.h"
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
void FuseFdatasyncTest::FdatasyncFile(const char *filename) {
|
void FuseFdatasyncTest::FdatasyncFile(const char *filename) {
|
||||||
int error = FdatasyncFileReturnError(filename);
|
int error = FdatasyncFileReturnError(filename);
|
||||||
@ -9,8 +10,13 @@ int FuseFdatasyncTest::FdatasyncFileReturnError(const char *filename) {
|
|||||||
auto fs = TestFS();
|
auto fs = TestFS();
|
||||||
|
|
||||||
int fd = OpenFile(fs.get(), filename);
|
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);
|
int retval = ::fdatasync(fd);
|
||||||
if (retval == 0) {
|
#endif
|
||||||
|
if (retval != -1) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return errno;
|
return errno;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user