net/SocketDescriptor: make eventfd() and signalfd() mandatory on Linux

This commit is contained in:
Max Kellermann
2018-08-20 17:16:07 +02:00
parent 13b3e9e7b3
commit 7ad440ca1c
4 changed files with 9 additions and 29 deletions

View File

@@ -18,7 +18,7 @@
*/ */
#include "config.h" #include "config.h"
#ifdef USE_EVENTFD #ifdef __linux__
#include "EventFD.hxx" #include "EventFD.hxx"
#include "system/Error.hxx" #include "system/Error.hxx"
#include "util/Compiler.h" #include "util/Compiler.h"

View File

@@ -37,15 +37,9 @@
#include <poll.h> #include <poll.h>
#endif #endif
#ifdef USE_EVENTFD
#include <sys/eventfd.h>
#endif
#ifdef USE_SIGNALFD
#include <sys/signalfd.h>
#endif
#ifdef __linux__ #ifdef __linux__
#include <sys/eventfd.h>
#include <sys/signalfd.h>
#include <sys/inotify.h> #include <sys/inotify.h>
#endif #endif
@@ -222,7 +216,7 @@ FileDescriptor::CheckDuplicate(int new_fd) noexcept
#endif #endif
#ifdef USE_EVENTFD #ifdef __linux__
bool bool
FileDescriptor::CreateEventFD(unsigned initval) noexcept FileDescriptor::CreateEventFD(unsigned initval) noexcept
@@ -231,10 +225,6 @@ FileDescriptor::CreateEventFD(unsigned initval) noexcept
return fd >= 0; return fd >= 0;
} }
#endif
#ifdef USE_SIGNALFD
bool bool
FileDescriptor::CreateSignalFD(const sigset_t *mask) noexcept FileDescriptor::CreateSignalFD(const sigset_t *mask) noexcept
{ {
@@ -246,10 +236,6 @@ FileDescriptor::CreateSignalFD(const sigset_t *mask) noexcept
return true; return true;
} }
#endif
#ifdef __linux__
bool bool
FileDescriptor::CreateInotify() noexcept FileDescriptor::CreateInotify() noexcept
{ {

View File

@@ -39,7 +39,7 @@
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef USE_SIGNALFD #ifdef __linux__
#include <signal.h> #include <signal.h>
#endif #endif
@@ -181,15 +181,9 @@ public:
bool CheckDuplicate(int new_fd) noexcept; bool CheckDuplicate(int new_fd) noexcept;
#endif #endif
#ifdef USE_EVENTFD
bool CreateEventFD(unsigned initval=0) noexcept;
#endif
#ifdef USE_SIGNALFD
bool CreateSignalFD(const sigset_t *mask) noexcept;
#endif
#ifdef __linux__ #ifdef __linux__
bool CreateEventFD(unsigned initval=0) noexcept;
bool CreateSignalFD(const sigset_t *mask) noexcept;
bool CreateInotify() noexcept; bool CreateInotify() noexcept;
#endif #endif

View File

@@ -18,7 +18,7 @@
*/ */
#include "config.h" #include "config.h"
#ifdef USE_SIGNALFD #ifdef __linux__
#include "SignalFD.hxx" #include "SignalFD.hxx"
#include "Error.hxx" #include "Error.hxx"
@@ -43,4 +43,4 @@ SignalFD::Read() noexcept
: -1; : -1;
} }
#endif /* USE_SIGNALFD */ #endif /* __linux__ */