Commit 795baed3 authored by Max Kellermann's avatar Max Kellermann

system/FileDescriptor: make pipe2() mandatory on Linux

parent 5487d40b
...@@ -241,7 +241,7 @@ AC_SEARCH_LIBS([socket], [network socket]) ...@@ -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(pipe2 accept4 linkat) AC_CHECK_FUNCS(accept4 linkat)
fi fi
AC_CHECK_FUNCS(getpwnam_r getpwuid_r) AC_CHECK_FUNCS(getpwnam_r getpwuid_r)
......
...@@ -120,7 +120,7 @@ FileDescriptor::CreatePipe(FileDescriptor &r, FileDescriptor &w) noexcept ...@@ -120,7 +120,7 @@ FileDescriptor::CreatePipe(FileDescriptor &r, FileDescriptor &w) noexcept
{ {
int fds[2]; int fds[2];
#ifdef HAVE_PIPE2 #ifdef __linux__
const int flags = O_CLOEXEC; const int flags = O_CLOEXEC;
const int result = pipe2(fds, flags); const int result = pipe2(fds, flags);
#elif defined(_WIN32) #elif defined(_WIN32)
...@@ -145,7 +145,7 @@ FileDescriptor::CreatePipeNonBlock(FileDescriptor &r, ...@@ -145,7 +145,7 @@ FileDescriptor::CreatePipeNonBlock(FileDescriptor &r,
{ {
int fds[2]; int fds[2];
#ifdef HAVE_PIPE2 #ifdef __linux__
const int flags = O_CLOEXEC|O_NONBLOCK; const int flags = O_CLOEXEC|O_NONBLOCK;
const int result = pipe2(fds, flags); const int result = pipe2(fds, flags);
#else #else
...@@ -158,7 +158,7 @@ FileDescriptor::CreatePipeNonBlock(FileDescriptor &r, ...@@ -158,7 +158,7 @@ FileDescriptor::CreatePipeNonBlock(FileDescriptor &r,
r = FileDescriptor(fds[0]); r = FileDescriptor(fds[0]);
w = FileDescriptor(fds[1]); w = FileDescriptor(fds[1]);
#ifndef HAVE_PIPE2 #ifndef __linux__
r.SetNonBlocking(); r.SetNonBlocking();
w.SetNonBlocking(); w.SetNonBlocking();
#endif #endif
......
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