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