Fix the detection of preadv and pwritev on OSX in OSS
authorChristopher Dykes <cdykes@fb.com>
Fri, 20 May 2016 21:26:38 +0000 (14:26 -0700)
committerFacebook Github Bot 3 <facebook-github-bot-3-bot@fb.com>
Fri, 20 May 2016 21:38:32 +0000 (14:38 -0700)
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

folly/portability/SysUio.cpp
folly/portability/SysUio.h

index 1a51728d4527e25f7c43869fbf9bfb2e41fa775a..556c8bd3112eef8900c499735a04d55bc528be59 100755 (executable)
@@ -47,13 +47,13 @@ static int wrapPositional(F f, int fd, off_t offset, Args... args) {
   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) {
   return wrapPositional(readv, fd, offset, iov, count);
 }
 #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) {
   return wrapPositional(writev, fd, offset, iov, count);
 }
index aa243d51d7eed841ef1b026be16382fb41f22100..000df3f45eccd2ea41cf0731912d7c7b978897a4 100644 (file)
 #include <folly/portability/IOVec.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);
 #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);
 #endif