Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

writer: return fdatasync,add define to support osx

  • Loading branch information...
commit 95935091da31e8a9bd815c41014c117697c9f568 1 parent 1f961ce
Fedor Indutny authored
Showing with 7 additions and 2 deletions.
  1. +1 −1  Makefile
  2. +6 −1 src/writer.c
2  Makefile
View
@@ -6,7 +6,7 @@
CSTDFLAG = --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
CPPFLAGS += -fPIC -Iinclude -Ideps/snappy
CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-CPPFLAGS += -D_XOPEN_SOURCE=500
+CPPFLAGS += -D_XOPEN_SOURCE=500 -D_DARWIN_C_SOURCE
LINKFLAGS += -lpthread
ifeq ($(ARCH),i386)
7 src/writer.c
View
@@ -53,7 +53,12 @@ int bp__writer_destroy(bp__writer_t* w) {
int bp__writer_fsync(bp__writer_t* w) {
- return fsync(w->fd) == 0 ? BP_OK : BP_EFILEFLUSH;
+#ifdef F_FULLFSYNC
+ /* OSX support */
+ return fcntl(w->fd, F_FULLFSYNC);
+#else
+ return fdatasync(w->fd) == 0 ? BP_OK : BP_EFILEFLUSH;
+#endif
}
Please sign in to comment.
Something went wrong with that request. Please try again.