• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2003, Intel Corporation. All rights reserved.
3  * Copyright (c) 2013, Cyril Hrubis <chrubis@suse.cz>
4  *
5  * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
6  * This file is licensed under the GPL license.  For the full content
7  * of this license, see the COPYING file at the top level of this
8  * source tree.
9  *
10  * Testing passing an invalid signals to sigrelse().
11  * After sighold is called on an invalid signal, sigrelse() should
12  * return -1 and set errno to EINVAL
13  *
14  * The invalid signal passed to sigrelse() depends on the argument
15  * passed to this program.
16  */
17 
18 #include <stdio.h>
19 #include <signal.h>
20 #include <errno.h>
21 #include <stdint.h>
22 #include <setjmp.h>
23 #include "posixtest.h"
24 
25 static const int sigs[] = {-1, -10000, INT32_MIN, INT32_MIN + 1};
26 
main(void)27 int main(void)
28 {
29 	int i, ret, err = 0;
30 
31 	for (i = 0; i < sizeof(sigs) / sizeof(int); i++) {
32 		ret = sigrelse(sigs[i]);
33 
34 		if (ret != -1 || errno != EINVAL) {
35 			err++;
36 			printf("Failed sigrelse(%i) ret=%i errno=%i\n",
37 			       sigs[i], ret, errno);
38 		}
39 	}
40 
41 	if (err) {
42 		printf("Test FAILED\n");
43 		return PTS_FAIL;
44 	} else {
45 		printf("Test PASSED\n");
46 		return PTS_PASS;
47 	}
48 }
49