xref: /aosp_15_r20/external/ltp/testcases/kernel/syscalls/signal/signal02.c (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker // SPDX-License-Identifier: GPL-2.0-or-later
2*49cdfc7eSAndroid Build Coastguard Worker /*
3*49cdfc7eSAndroid Build Coastguard Worker  * Copyright (c) International Business Machines  Corp., 2001
4*49cdfc7eSAndroid Build Coastguard Worker  */
5*49cdfc7eSAndroid Build Coastguard Worker 
6*49cdfc7eSAndroid Build Coastguard Worker /*\
7*49cdfc7eSAndroid Build Coastguard Worker  * [Description]
8*49cdfc7eSAndroid Build Coastguard Worker  *
9*49cdfc7eSAndroid Build Coastguard Worker  * Test that we get an error using illegal signals.
10*49cdfc7eSAndroid Build Coastguard Worker  */
11*49cdfc7eSAndroid Build Coastguard Worker 
12*49cdfc7eSAndroid Build Coastguard Worker #include "tst_test.h"
13*49cdfc7eSAndroid Build Coastguard Worker 
14*49cdfc7eSAndroid Build Coastguard Worker static int sigs[] = { _NSIG + 1, SIGKILL, SIGSTOP };
15*49cdfc7eSAndroid Build Coastguard Worker 
do_test(unsigned int n)16*49cdfc7eSAndroid Build Coastguard Worker static void do_test(unsigned int n)
17*49cdfc7eSAndroid Build Coastguard Worker {
18*49cdfc7eSAndroid Build Coastguard Worker 	TST_EXP_FAIL2((long)signal(sigs[n], SIG_IGN), EINVAL);
19*49cdfc7eSAndroid Build Coastguard Worker }
20*49cdfc7eSAndroid Build Coastguard Worker 
21*49cdfc7eSAndroid Build Coastguard Worker static struct tst_test test = {
22*49cdfc7eSAndroid Build Coastguard Worker 	.tcnt = ARRAY_SIZE(sigs),
23*49cdfc7eSAndroid Build Coastguard Worker 	.test = do_test,
24*49cdfc7eSAndroid Build Coastguard Worker };
25