aboutsummaryrefslogtreecommitdiffstats
path: root/src/system/SignalFD.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/system/SignalFD.cxx')
-rw-r--r--src/system/SignalFD.cxx14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/system/SignalFD.cxx b/src/system/SignalFD.cxx
index 92d2eec01..14193c893 100644
--- a/src/system/SignalFD.cxx
+++ b/src/system/SignalFD.cxx
@@ -23,33 +23,29 @@
#include "FatalError.hxx"
#include <assert.h>
-#include <unistd.h>
#include <sys/signalfd.h>
void
SignalFD::Create(const sigset_t &mask)
{
- fd = ::signalfd(fd, &mask, SFD_NONBLOCK|SFD_CLOEXEC);
- if (fd < 0)
+ if (!fd.CreateSignalFD(&mask))
FatalSystemError("signalfd() failed");
}
void
SignalFD::Close()
{
- if (fd >= 0) {
- ::close(fd);
- fd = -1;
- }
+ if (fd.IsDefined())
+ fd.Close();
}
int
SignalFD::Read()
{
- assert(fd >= 0);
+ assert(fd.IsDefined());
signalfd_siginfo info;
- return read(fd, &info, sizeof(info)) > 0
+ return fd.Read(&info, sizeof(info)) > 0
? info.ssi_signo
: -1;
}