system/SignalFD: throw exception on error

This commit is contained in:
Max Kellermann 2018-08-06 11:53:45 +02:00
parent 5b09504a71
commit dd18fe34a7
3 changed files with 6 additions and 3 deletions

View File

@ -32,6 +32,8 @@ typedef BoundMethod<void()> SignalHandler;
/** /**
* Initialise the signal monitor subsystem. * Initialise the signal monitor subsystem.
*
* Throws on error.
*/ */
void void
SignalMonitorInit(EventLoop &loop); SignalMonitorInit(EventLoop &loop);

View File

@ -20,7 +20,7 @@
#include "config.h" #include "config.h"
#ifdef USE_SIGNALFD #ifdef USE_SIGNALFD
#include "SignalFD.hxx" #include "SignalFD.hxx"
#include "FatalError.hxx" #include "Error.hxx"
#include <assert.h> #include <assert.h>
#include <sys/signalfd.h> #include <sys/signalfd.h>
@ -29,7 +29,7 @@ void
SignalFD::Create(const sigset_t &mask) SignalFD::Create(const sigset_t &mask)
{ {
if (!fd.CreateSignalFD(&mask)) if (!fd.CreateSignalFD(&mask))
FatalSystemError("signalfd() failed"); throw MakeErrno("signalfd() failed");
} }
int int

View File

@ -35,9 +35,10 @@ public:
/** /**
* Create the signalfd or update its mask. * Create the signalfd or update its mask.
* *
* All errors are fatal. * Throws on error.
*/ */
void Create(const sigset_t &mask); void Create(const sigset_t &mask);
void Close() { void Close() {
fd.Close(); fd.Close();
} }