Commit 41d170c5 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

ioping: detect fdatasync availability

Fix for poor Posix OS like Darwin and FreeBSD
Signed-off-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
parent 9d4b0786
...@@ -72,6 +72,10 @@ ...@@ -72,6 +72,10 @@
# define HAVE_ERR_INCLUDE # define HAVE_ERR_INCLUDE
#endif #endif
#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
# define HAVE_POSIX_FDATASYNC
#endif
#ifdef HAVE_ERR_INCLUDE #ifdef HAVE_ERR_INCLUDE
# include <err.h> # include <err.h>
#else #else
...@@ -154,11 +158,6 @@ int fsync(int fd) ...@@ -154,11 +158,6 @@ int fsync(int fd)
return FlushFileBuffers(h) ? 0 : -1; return FlushFileBuffers(h) ? 0 : -1;
} }
int fdatasync(int fd)
{
return fsync(fd);
}
void srandom(unsigned int seed) void srandom(unsigned int seed)
{ {
srand(seed); srand(seed);
...@@ -191,6 +190,13 @@ int posix_memalign(void **memptr, size_t alignment, size_t size) ...@@ -191,6 +190,13 @@ int posix_memalign(void **memptr, size_t alignment, size_t size)
} }
#endif #endif
#ifndef HAVE_POSIX_FDATASYNC
int fdatasync(int fd)
{
return fsync(fd);
}
#endif
void usage(void) void usage(void)
{ {
fprintf(stderr, fprintf(stderr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment