net/SocketDescriptor: make eventfd() and signalfd() mandatory on Linux
This commit is contained in:
@@ -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"
|
||||||
|
@@ -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
|
||||||
{
|
{
|
||||||
|
@@ -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
|
||||||
|
|
||||||
|
@@ -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__ */
|
||||||
|
Reference in New Issue
Block a user