1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 *   Copyright (c) International Business Machines  Corp., 2001
4 */
5
6/*\
7 * [Description]
8 *
9 * Set signals to be ignored.
10 */
11
12#include "tst_test.h"
13
14static int siglist[] = { SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGABRT, SIGIOT,
15	SIGBUS, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2, SIGPIPE, SIGALRM,
16	SIGTERM,
17#ifdef SIGSTKFLT
18	SIGSTKFLT,
19#endif
20	SIGCHLD, SIGCONT, SIGTSTP, SIGTTIN,
21	SIGTTOU, SIGURG, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF,
22	SIGWINCH, SIGIO, SIGPWR, SIGSYS,
23#ifdef SIGUNUSED
24	SIGUNUSED
25#endif
26};
27
28static volatile int ign_handler;
29
30static void sighandler(int sig LTP_ATTRIBUTE_UNUSED)
31{
32	ign_handler = 1;
33}
34
35static void do_test(unsigned int n)
36{
37	pid_t pid;
38
39	SAFE_SIGNAL(siglist[n], sighandler);
40	SAFE_SIGNAL(siglist[n], SIG_IGN);
41
42	pid = getpid();
43
44	SAFE_KILL(pid, siglist[n]);
45	TST_EXP_EQ_SSZ(ign_handler, 0);
46}
47
48static struct tst_test test = {
49	.tcnt = ARRAY_SIZE(siglist),
50	.test = do_test,
51};
52