1 /*
2 * Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
3 * Created by: salwan.searty REMOVE-THIS AT intel DOT com
4 * This file is licensed under the GPL license. For the full content
5 * of this license, see the COPYING file at the top level of this
6 * source tree.
7
8 If any of the signals listed in the array below are not is "signalset"
9 after sigfillset is called on it, then fail, otherwise pass.
10 */
11
12 #include <stdio.h>
13 #include <signal.h>
14 #include <string.h>
15 #include "posixtest.h"
16
17 #define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
18
main(void)19 int main(void)
20 {
21 sigset_t signalset;
22 int i, test_failed = 0;
23
24 int siglist[] = { SIGABRT, SIGALRM, SIGBUS, SIGCHLD,
25 SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT,
26 SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGSTOP,
27 SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU, SIGUSR1,
28 SIGUSR2,
29 #ifdef SIGPOLL
30 SIGPOLL,
31 #endif
32 #ifdef SIGPROF
33 SIGPROF,
34 #endif
35 SIGSYS,
36 SIGTRAP, SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ
37 };
38
39 if (sigfillset(&signalset) == -1) {
40 perror("sigfillset failed -- test aborted");
41 return PTS_FAIL;
42 }
43
44 for (i = NUMSIGNALS - 1; i >= 0; i--) {
45 if (sigismember(&signalset, siglist[i]) == 0) {
46 #ifdef DEBUG
47 printf("sigfillset did not insert signal %s\n in set",
48 siglist[i]);
49 #endif
50 test_failed = 1;
51 }
52 }
53
54 if (test_failed == 1) {
55 return PTS_FAIL;
56 }
57
58 printf("Test PASSED\n");
59 return PTS_PASS;
60 }
61