]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/signal-util.h
tree-wide: remove Emacs lines from all files
[thirdparty/systemd.git] / src / basic / signal-util.h
CommitLineData
24882e06
LP
1#pragma once
2
3/***
4 This file is part of systemd.
5
6 Copyright 2010-2015 Lennart Poettering
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
22#include <signal.h>
23
24#include "macro.h"
25
26int reset_all_signal_handlers(void);
27int reset_signal_mask(void);
28
29int ignore_signals(int sig, ...);
30int default_signals(int sig, ...);
31int sigaction_many(const struct sigaction *sa, ...);
32
0c2c2a3a 33int sigset_add_many(sigset_t *ss, ...);
72c0a2c2 34int sigprocmask_many(int how, sigset_t *old, ...);
24882e06
LP
35
36const char *signal_to_string(int i) _const_;
37int signal_from_string(const char *s) _pure_;
38
39int signal_from_string_try_harder(const char *s);
6bedfcbb
LP
40
41void nop_signal_handler(int sig);
0c5eb056
LP
42
43static 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 })