Commit 4ad9455e authored by James Donald's avatar James Donald Committed by Facebook Github Bot

Make defined(__linux__) checks consistent for -Wundef

Reviewed By: yfeldblum

Differential Revision: D19235483

fbshipit-source-id: 5caea4efb3e811f78f1be3f05adc315bccb0fc0d
parent 7e693d01
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <folly/Subprocess.h> #include <folly/Subprocess.h>
#if __linux__ #if defined(__linux__)
#include <sys/prctl.h> #include <sys/prctl.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>
...@@ -546,7 +546,7 @@ int Subprocess::prepareChild( ...@@ -546,7 +546,7 @@ int Subprocess::prepareChild(
} }
} }
#if __linux__ #if defined(__linux__)
// Opt to receive signal on parent death, if requested // Opt to receive signal on parent death, if requested
if (options.parentDeathSignal_ != 0) { if (options.parentDeathSignal_ != 0) {
const auto parentDeathSignal = const auto parentDeathSignal =
......
...@@ -383,7 +383,7 @@ class Subprocess { ...@@ -383,7 +383,7 @@ class Subprocess {
return *this; return *this;
} }
#if __linux__ #if defined(__linux__)
/** /**
* Child will receive a signal when the parent *thread* exits. * Child will receive a signal when the parent *thread* exits.
* *
...@@ -463,7 +463,7 @@ class Subprocess { ...@@ -463,7 +463,7 @@ class Subprocess {
return *this; return *this;
} }
#if __linux__ #if defined(__linux__)
/** /**
* This is an experimental feature, it is best you don't use it at this * This is an experimental feature, it is best you don't use it at this
* point of time. * point of time.
...@@ -494,12 +494,12 @@ class Subprocess { ...@@ -494,12 +494,12 @@ class Subprocess {
bool processGroupLeader_{false}; bool processGroupLeader_{false};
bool detach_{false}; bool detach_{false};
std::string childDir_; // "" keeps the parent's working directory std::string childDir_; // "" keeps the parent's working directory
#if __linux__ #if defined(__linux__)
int parentDeathSignal_{0}; int parentDeathSignal_{0};
#endif #endif
DangerousPostForkPreExecCallback* dangerousPostForkPreExecCallback_{ DangerousPostForkPreExecCallback* dangerousPostForkPreExecCallback_{
nullptr}; nullptr};
#if __linux__ #if defined(__linux__)
// none means `vfork()` instead of a custom `clone()` // none means `vfork()` instead of a custom `clone()`
// Optional<> is used because value of '0' means do clone without any flags. // Optional<> is used because value of '0' means do clone without any flags.
Optional<clone_flags_t> cloneFlags_; Optional<clone_flags_t> cloneFlags_;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#pragma once #pragma once
#if __linux__ && !__ANDROID__ #if defined(__linux__) && !defined(__ANDROID__)
#define FOLLY_HAVE_TIMERFD #define FOLLY_HAVE_TIMERFD
#endif #endif
......
...@@ -277,7 +277,7 @@ void AsyncServerSocket::useExistingSockets( ...@@ -277,7 +277,7 @@ void AsyncServerSocket::useExistingSockets(
SocketAddress address; SocketAddress address;
address.setFromLocalAddress(fd); address.setFromLocalAddress(fd);
#if __linux__ #if defined(__linux__)
if (noTransparentTls_) { if (noTransparentTls_) {
// Ignore return value, errors are ok // Ignore return value, errors are ok
netops::setsockopt(fd, SOL_SOCKET, SO_NO_TRANSPARENT_TLS, nullptr, 0); netops::setsockopt(fd, SOL_SOCKET, SO_NO_TRANSPARENT_TLS, nullptr, 0);
...@@ -315,7 +315,7 @@ void AsyncServerSocket::bindSocket( ...@@ -315,7 +315,7 @@ void AsyncServerSocket::bindSocket(
} }
} }
#if __linux__ #if defined(__linux__)
if (noTransparentTls_) { if (noTransparentTls_) {
// Ignore return value, errors are ok // Ignore return value, errors are ok
netops::setsockopt(fd, SOL_SOCKET, SO_NO_TRANSPARENT_TLS, nullptr, 0); netops::setsockopt(fd, SOL_SOCKET, SO_NO_TRANSPARENT_TLS, nullptr, 0);
...@@ -451,7 +451,7 @@ void AsyncServerSocket::bind(uint16_t port) { ...@@ -451,7 +451,7 @@ void AsyncServerSocket::bind(uint16_t port) {
SocketAddress::getFamilyNameFrom(res->ai_addr, "<unknown>")); SocketAddress::getFamilyNameFrom(res->ai_addr, "<unknown>"));
} }
#if __linux__ #if defined(__linux__)
if (noTransparentTls_) { if (noTransparentTls_) {
// Ignore return value, errors are ok // Ignore return value, errors are ok
netops::setsockopt(s, SOL_SOCKET, SO_NO_TRANSPARENT_TLS, nullptr, 0); netops::setsockopt(s, SOL_SOCKET, SO_NO_TRANSPARENT_TLS, nullptr, 0);
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <sstream> #include <sstream>
#include <thread> #include <thread>
#if __linux__ #if defined(__linux__)
#include <linux/sockios.h> #include <linux/sockios.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
...@@ -268,7 +268,7 @@ void disableTransparentFunctions( ...@@ -268,7 +268,7 @@ void disableTransparentFunctions(
(void)fd; (void)fd;
(void)noTransparentTls; (void)noTransparentTls;
(void)noTSocks; (void)noTSocks;
#if __linux__ #if defined(__linux__)
if (noTransparentTls) { if (noTransparentTls) {
// Ignore return value, errors are ok // Ignore return value, errors are ok
VLOG(5) << "Disabling TTLS for fd " << fd; VLOG(5) << "Disabling TTLS for fd " << fd;
...@@ -1731,7 +1731,7 @@ int AsyncSocket::setRecvBufSize(size_t bufsize) { ...@@ -1731,7 +1731,7 @@ int AsyncSocket::setRecvBufSize(size_t bufsize) {
return 0; return 0;
} }
#if __linux__ #if defined(__linux__)
size_t AsyncSocket::getSendBufInUse() const { size_t AsyncSocket::getSendBufInUse() const {
if (fd_ == NetworkSocket()) { if (fd_ == NetworkSocket()) {
std::stringstream issueString; std::stringstream issueString;
......
...@@ -727,7 +727,7 @@ class AsyncSocket : virtual public AsyncTransportWrapper { ...@@ -727,7 +727,7 @@ class AsyncSocket : virtual public AsyncTransportWrapper {
*/ */
int setRecvBufSize(size_t bufsize); int setRecvBufSize(size_t bufsize);
#if __linux__ #if defined(__linux__)
/** /**
* @brief This method is used to get the number of bytes that are currently * @brief This method is used to get the number of bytes that are currently
* stored in the TCP send/tx buffer * stored in the TCP send/tx buffer
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include <glog/logging.h> #include <glog/logging.h>
#if __linux__ && !__ANDROID__ #if defined(__linux__) && !defined(__ANDROID__)
#define FOLLY_HAVE_EVENTFD #define FOLLY_HAVE_EVENTFD
#include <folly/io/async/EventFDWrapper.h> #include <folly/io/async/EventFDWrapper.h>
#endif #endif
......
...@@ -3751,7 +3751,7 @@ TEST(AsyncSocketTest, V4TosReflectTest) { ...@@ -3751,7 +3751,7 @@ TEST(AsyncSocketTest, V4TosReflectTest) {
} }
#endif #endif
#if __linux__ #if defined(__linux__)
TEST(AsyncSocketTest, getBufInUse) { TEST(AsyncSocketTest, getBufInUse) {
EventBase eventBase; EventBase eventBase;
std::shared_ptr<AsyncServerSocket> server( std::shared_ptr<AsyncServerSocket> server(
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// Android only, prctl is only used when pthread_setname_np // Android only, prctl is only used when pthread_setname_np
// and pthread_getname_np are not avilable. // and pthread_getname_np are not avilable.
#if __linux__ #if defined(__linux__)
#define FOLLY_DETAIL_HAS_PRCTL_PR_SET_NAME 1 #define FOLLY_DETAIL_HAS_PRCTL_PR_SET_NAME 1
#else #else
#define FOLLY_DETAIL_HAS_PRCTL_PR_SET_NAME 0 #define FOLLY_DETAIL_HAS_PRCTL_PR_SET_NAME 0
......
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