Commit f464accb authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 3

Fix the detection of preadv and pwritev on OSX in OSS

Summary:
The configure script doesn't define `FOLLY_HAVE_PREADV` if `preadv` isn't supported, so these checks were wrong. Undefined defines expand to `0`, so this is safe.
Fixes https://github.com/facebook/folly/issues/412

Reviewed By: mzlee, yfeldblum

Differential Revision: D3329405

fbshipit-source-id: faee8951c68d4c67e06e7720dfc142e63a9dbd9f
parent 10c76792
...@@ -47,13 +47,13 @@ static int wrapPositional(F f, int fd, off_t offset, Args... args) { ...@@ -47,13 +47,13 @@ static int wrapPositional(F f, int fd, off_t offset, Args... args) {
return res; return res;
} }
#if defined(FOLLY_HAVE_PREADV) && !FOLLY_HAVE_PREADV #if !FOLLY_HAVE_PREADV
extern "C" ssize_t preadv(int fd, const iovec* iov, int count, off_t offset) { extern "C" ssize_t preadv(int fd, const iovec* iov, int count, off_t offset) {
return wrapPositional(readv, fd, offset, iov, count); return wrapPositional(readv, fd, offset, iov, count);
} }
#endif #endif
#if defined(FOLLY_HAVE_PWRITEV) && !FOLLY_HAVE_PWRITEV #if !FOLLY_HAVE_PWRITEV
extern "C" ssize_t pwritev(int fd, const iovec* iov, int count, off_t offset) { extern "C" ssize_t pwritev(int fd, const iovec* iov, int count, off_t offset) {
return wrapPositional(writev, fd, offset, iov, count); return wrapPositional(writev, fd, offset, iov, count);
} }
......
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
#include <folly/portability/IOVec.h> #include <folly/portability/IOVec.h>
#include <folly/portability/SysTypes.h> #include <folly/portability/SysTypes.h>
#if defined(FOLLY_HAVE_PREADV) && !FOLLY_HAVE_PREADV #if !FOLLY_HAVE_PREADV
extern "C" ssize_t preadv(int fd, const iovec* iov, int count, off_t offset); extern "C" ssize_t preadv(int fd, const iovec* iov, int count, off_t offset);
#endif #endif
#if defined(FOLLY_HAVE_PWRITEV) && !FOLLY_HAVE_PWRITEV #if !FOLLY_HAVE_PWRITEV
extern "C" ssize_t pwritev(int fd, const iovec* iov, int count, off_t offset); extern "C" ssize_t pwritev(int fd, const iovec* iov, int count, off_t offset);
#endif #endif
......
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