]>
Commit | Line | Data |
---|---|---|
663996b3 MS |
1 | #pragma once |
2 | ||
3 | /*** | |
4 | This file is part of systemd. | |
5 | ||
e3bff60a | 6 | Copyright 2010-2015 Lennart Poettering |
663996b3 MS |
7 | |
8 | systemd is free software; you can redistribute it and/or modify it | |
9 | under the terms of the GNU Lesser General Public License as published by | |
10 | the Free Software Foundation; either version 2.1 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | systemd is distributed in the hope that it will be useful, but | |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | Lesser General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU Lesser General Public License | |
19 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
20 | ***/ | |
21 | ||
86f210e9 | 22 | #include <signal.h> |
e735f4d4 | 23 | |
e3bff60a MP |
24 | #include "macro.h" |
25 | ||
86f210e9 MP |
26 | int reset_all_signal_handlers(void); |
27 | int reset_signal_mask(void); | |
e3bff60a | 28 | |
86f210e9 MP |
29 | int ignore_signals(int sig, ...); |
30 | int default_signals(int sig, ...); | |
31 | int sigaction_many(const struct sigaction *sa, ...); | |
e3bff60a | 32 | |
86f210e9 MP |
33 | int sigset_add_many(sigset_t *ss, ...); |
34 | int sigprocmask_many(int how, sigset_t *old, ...); | |
e3bff60a | 35 | |
86f210e9 MP |
36 | const char *signal_to_string(int i) _const_; |
37 | int signal_from_string(const char *s) _pure_; | |
e3bff60a | 38 | |
86f210e9 | 39 | int signal_from_string_try_harder(const char *s); |
db2df898 MP |
40 | |
41 | void nop_signal_handler(int sig); | |
4c89c718 MP |
42 | |
43 | static inline void block_signals_reset(sigset_t *ss) { | |
44 | assert_se(sigprocmask(SIG_SETMASK, ss, NULL) >= 0); | |
45 | } | |
46 | ||
47 | #define BLOCK_SIGNALS(...) \ | |
48 | _cleanup_(block_signals_reset) sigset_t _saved_sigset = ({ \ | |
49 | sigset_t t; \ | |
50 | assert_se(sigprocmask_many(SIG_BLOCK, &t, __VA_ARGS__, -1) >= 0); \ | |
51 | t; \ | |
52 | }) |