From: Christopher Dykes Date: Fri, 20 May 2016 21:26:38 +0000 (-0700) Subject: Fix the detection of preadv and pwritev on OSX in OSS X-Git-Tag: 2016.07.26~212 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f464accb69e96176e5a313da5d24d76ee5297ca2;p=folly.git 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 --- diff --git a/folly/portability/SysUio.cpp b/folly/portability/SysUio.cpp index 1a51728d..556c8bd3 100755 --- a/folly/portability/SysUio.cpp +++ b/folly/portability/SysUio.cpp @@ -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); } diff --git a/folly/portability/SysUio.h b/folly/portability/SysUio.h index aa243d51..000df3f4 100644 --- a/folly/portability/SysUio.h +++ b/folly/portability/SysUio.h @@ -20,10 +20,10 @@ #include #include -#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