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 *
11 * After sighold is called on an invalid signal it should return -1 and set
12 * errno to EINVAL
13 */
14
15
16 #include <stdio.h>
17 #include <signal.h>
18 #include <errno.h>
19 #include <stdint.h>
20 #include "posixtest.h"
21
22 static const int sigs[] = {-1, -10000, INT32_MIN, INT32_MIN + 1};
23
24 #define NUMSIGNALS (sizeof(sigs) / sizeof(sigs[0]))
25
main(void)26 int main(void)
27 {
28 int i, ret, err = 0;
29
30 for (i = 0; i < (int)NUMSIGNALS; i++) {
31 ret = sighold(sigs[i]);
32
33 if (ret != -1 || errno != EINVAL) {
34 err++;
35 printf("Failed sighold(%i) ret=%i errno=%i\n",
36 sigs[i], ret, errno);
37 }
38 }
39
40 if (err) {
41 printf("Test FAILED\n");
42 return PTS_FAIL;
43 } else {
44 printf("Test PASSED\n");
45 return PTS_PASS;
46 }
47 }
48