Commit 3027a430 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Lift the accept4 check

Summary: [Folly] Lift the `accept4` check to an explicit preprocessor symbol set at configure time.

Reviewed By: gkmhub

Differential Revision: D15802038

fbshipit-source-id: e85a258bb6650af42ab149b0bff4854196c3157d
parent e170172b
......@@ -70,6 +70,7 @@ check_symbol_exists(pthread_atfork pthread.h FOLLY_HAVE_PTHREAD_ATFORK)
# Unfortunately check_symbol_exists() does not work for memrchr():
# it fails complaining that there are multiple overloaded versions of memrchr()
check_function_exists(memrchr FOLLY_HAVE_MEMRCHR)
check_symbol_exists(accept4 sys/socket.h FOLLY_HAVE_ACCEPT4)
check_symbol_exists(preadv sys/uio.h FOLLY_HAVE_PREADV)
check_symbol_exists(pwritev sys/uio.h FOLLY_HAVE_PWRITEV)
check_symbol_exists(clock_gettime time.h FOLLY_HAVE_CLOCK_GETTIME)
......
......@@ -43,10 +43,13 @@
#endif
#cmakedefine FOLLY_HAVE_MEMRCHR 1
#cmakedefine FOLLY_HAVE_ACCEPT4 1
#cmakedefine FOLLY_HAVE_PREADV 1
#cmakedefine FOLLY_HAVE_PWRITEV 1
#cmakedefine FOLLY_HAVE_CLOCK_GETTIME 1
#cmakedefine FOLLY_HAVE_PIPE2 1
#cmakedefine FOLLY_HAVE_SENDMMSG 1
#cmakedefine FOLLY_HAVE_RECVMMSG 1
#cmakedefine FOLLY_HAVE_OPENSSL_ASN1_TIME_DIFF 1
#cmakedefine FOLLY_HAVE_IFUNC 1
......@@ -78,5 +81,3 @@
#cmakedefine01 FOLLY_LIBRARY_SANITIZE_ADDRESS
#cmakedefine FOLLY_SUPPORT_SHARED_LIBRARY 1
#cmakedefine FOLLY_HAVE_SENDMMSG 1
#cmakedefine FOLLY_HAVE_RECVMMSG 1
......@@ -847,7 +847,7 @@ void AsyncServerSocket::handlerReady(
}
// Accept a new client socket
#ifdef SOCK_NONBLOCK
#if FOLLY_HAVE_ACCEPT4
auto clientSocket = NetworkSocket::fromFd(
accept4(fd.toFd(), saddr, &addrLen, SOCK_NONBLOCK));
#else
......@@ -942,7 +942,7 @@ void AsyncServerSocket::handlerReady(
return;
}
#ifndef SOCK_NONBLOCK
#if !FOLLY_HAVE_ACCEPT4
// Explicitly set the new connection to non-blocking mode
if (netops::set_socket_non_blocking(clientSocket) != 0) {
closeNoInt(clientSocket);
......
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