diff options
author | Sven Eden <yamakuzure@gmx.net> | 2017-04-27 11:30:28 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-05-17 15:22:16 +0200 |
commit | 66ecc207e203db5434610395cd04c40ae8727b58 (patch) | |
tree | 4808a261a6e58dcdbc9e8616f18cce65b2a49b83 /src/basic/signal-util.h | |
parent | 4f8a2329ef626675895974d53a6afad68a0d255a (diff) |
Prep v229: Add missing fixes from upstream [1/6] src/basic
Diffstat (limited to 'src/basic/signal-util.h')
-rw-r--r-- | src/basic/signal-util.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/basic/signal-util.h b/src/basic/signal-util.h index 3f22fd46e..7013c51a3 100644 --- a/src/basic/signal-util.h +++ b/src/basic/signal-util.h @@ -40,5 +40,17 @@ int signal_from_string(const char *s) _pure_; int signal_from_string_try_harder(const char *s); #if 0 /// UNNEEDED by elogind + void nop_signal_handler(int sig); #endif // 0 + +static inline void block_signals_reset(sigset_t *ss) { + assert_se(sigprocmask(SIG_SETMASK, ss, NULL) >= 0); +} + +#define BLOCK_SIGNALS(...) \ + _cleanup_(block_signals_reset) sigset_t _saved_sigset = ({ \ + sigset_t t; \ + assert_se(sigprocmask_many(SIG_BLOCK, &t, __VA_ARGS__, -1) >= 0); \ + t; \ + }) |