net/SocketDescriptor: make accept4() mandatory on Linux
This commit is contained in:
parent
1f3ce380ed
commit
ba3b422ce5
@ -241,7 +241,7 @@ AC_SEARCH_LIBS([socket], [network socket])
|
|||||||
AC_SEARCH_LIBS([gethostbyname], [nsl])
|
AC_SEARCH_LIBS([gethostbyname], [nsl])
|
||||||
|
|
||||||
if test x$host_is_linux = xyes; then
|
if test x$host_is_linux = xyes; then
|
||||||
AC_CHECK_FUNCS(accept4 linkat)
|
AC_CHECK_FUNCS(linkat)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_FUNCS(getpwnam_r getpwuid_r)
|
AC_CHECK_FUNCS(getpwnam_r getpwuid_r)
|
||||||
|
@ -77,7 +77,7 @@ SocketDescriptor::Close()
|
|||||||
SocketDescriptor
|
SocketDescriptor
|
||||||
SocketDescriptor::Accept()
|
SocketDescriptor::Accept()
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ACCEPT4
|
#ifdef __linux__
|
||||||
int connection_fd = ::accept4(Get(), nullptr, nullptr, SOCK_CLOEXEC);
|
int connection_fd = ::accept4(Get(), nullptr, nullptr, SOCK_CLOEXEC);
|
||||||
#else
|
#else
|
||||||
int connection_fd = ::accept(Get(), nullptr, nullptr);
|
int connection_fd = ::accept(Get(), nullptr, nullptr);
|
||||||
@ -90,7 +90,7 @@ SocketDescriptor::Accept()
|
|||||||
SocketDescriptor
|
SocketDescriptor
|
||||||
SocketDescriptor::AcceptNonBlock() const
|
SocketDescriptor::AcceptNonBlock() const
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ACCEPT4
|
#ifdef __linux__
|
||||||
int connection_fd = ::accept4(Get(), nullptr, nullptr,
|
int connection_fd = ::accept4(Get(), nullptr, nullptr,
|
||||||
SOCK_CLOEXEC|SOCK_NONBLOCK);
|
SOCK_CLOEXEC|SOCK_NONBLOCK);
|
||||||
#else
|
#else
|
||||||
@ -105,7 +105,7 @@ SocketDescriptor
|
|||||||
SocketDescriptor::AcceptNonBlock(StaticSocketAddress &address) const
|
SocketDescriptor::AcceptNonBlock(StaticSocketAddress &address) const
|
||||||
{
|
{
|
||||||
address.SetMaxSize();
|
address.SetMaxSize();
|
||||||
#ifdef HAVE_ACCEPT4
|
#ifdef __linux__
|
||||||
int connection_fd = ::accept4(Get(), address, &address.size,
|
int connection_fd = ::accept4(Get(), address, &address.size,
|
||||||
SOCK_CLOEXEC|SOCK_NONBLOCK);
|
SOCK_CLOEXEC|SOCK_NONBLOCK);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user