1 /*
2 * List signal numbers that are valid arguments for sigaction syscall.
3 *
4 * Copyright (c) 2017-2021 Dmitry V. Levin <ldv@strace.io>
5 * All rights reserved.
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10 #include "tests.h"
11
12 #include <signal.h>
13 #include <stdio.h>
14
15 int
16 main(void)
17 {
18 for (unsigned int i = 1; i < 32; ++i) {
19 static const struct sigaction ign = { .sa_handler = SIG_IGN };
20 static const struct sigaction dfl = { .sa_handler = SIG_DFL };
21 struct sigaction act;
22
23 if (sigaction(i, &ign, NULL) ||
24 sigaction(i, NULL, &act) ||
25 ign.sa_handler != act.sa_handler ||
26 sigaction(i, &dfl, NULL) ||
27 sigaction(i, NULL, &act) ||
28 dfl.sa_handler != act.sa_handler)
29 continue;
30
31 printf("%u\n", i);
32 }
33
34 return 0;
35 }