From ba3b422ce597ef373aadcfcbaff091907e5f78cb Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 21 Aug 2018 10:53:54 +0200 Subject: [PATCH] net/SocketDescriptor: make accept4() mandatory on Linux --- configure.ac | 2 +- src/net/SocketDescriptor.cxx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 057c8bda9..3c9dac15e 100644 --- a/configure.ac +++ b/configure.ac @@ -241,7 +241,7 @@ AC_SEARCH_LIBS([socket], [network socket]) AC_SEARCH_LIBS([gethostbyname], [nsl]) if test x$host_is_linux = xyes; then - AC_CHECK_FUNCS(accept4 linkat) + AC_CHECK_FUNCS(linkat) fi AC_CHECK_FUNCS(getpwnam_r getpwuid_r) diff --git a/src/net/SocketDescriptor.cxx b/src/net/SocketDescriptor.cxx index a5f752342..178d9f057 100644 --- a/src/net/SocketDescriptor.cxx +++ b/src/net/SocketDescriptor.cxx @@ -77,7 +77,7 @@ SocketDescriptor::Close() SocketDescriptor SocketDescriptor::Accept() { -#ifdef HAVE_ACCEPT4 +#ifdef __linux__ int connection_fd = ::accept4(Get(), nullptr, nullptr, SOCK_CLOEXEC); #else int connection_fd = ::accept(Get(), nullptr, nullptr); @@ -90,7 +90,7 @@ SocketDescriptor::Accept() SocketDescriptor SocketDescriptor::AcceptNonBlock() const { -#ifdef HAVE_ACCEPT4 +#ifdef __linux__ int connection_fd = ::accept4(Get(), nullptr, nullptr, SOCK_CLOEXEC|SOCK_NONBLOCK); #else @@ -105,7 +105,7 @@ SocketDescriptor SocketDescriptor::AcceptNonBlock(StaticSocketAddress &address) const { address.SetMaxSize(); -#ifdef HAVE_ACCEPT4 +#ifdef __linux__ int connection_fd = ::accept4(Get(), address, &address.size, SOCK_CLOEXEC|SOCK_NONBLOCK); #else