]> granicus.if.org Git - strace/blob - tests/check_sigblock.c
Update copyright headers
[strace] / tests / check_sigblock.c
1 /*
2  * Check that the specified signal number is blocked/unblocked.
3  *
4  * Copyright (c) 2017-2018 Dmitry V. Levin <ldv@altlinux.org>
5  * All rights reserved.
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9
10 #include "tests.h"
11 #include <signal.h>
12 #include <stdlib.h>
13
14 int
15 main(int ac, char **av)
16 {
17         if (ac != 3)
18                 error_msg_and_fail("usage: check_sigblock 0|1 signum");
19
20         const int block = !!atoi(av[1]);
21         const int signum = atoi(av[2]);
22         sigset_t mask;
23
24         sigemptyset(&mask);
25         if (sigprocmask(SIG_SETMASK, NULL, &mask))
26                 perror_msg_and_fail("sigprocmask");
27
28         return block ^ sigismember(&mask, signum);
29 }