1 /*
2 * Copyright (c) 2002, 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 Make sure that none of the signals listed in this array below are
9 found in "signalset" after sigemptyset() is called on it.
10
11 */
12
13 #include <stdio.h>
14 #include <signal.h>
15 #include <string.h>
16 #include "posixtest.h"
17
18 #define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
19
main(void)20 int main(void)
21 {
22
23 int siglist[] = { SIGABRT, SIGALRM, SIGBUS, SIGCHLD,
24 SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT,
25 SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGSTOP,
26 SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU, SIGUSR1,
27 SIGUSR2,
28 #ifdef SIGPOLL
29 SIGPOLL,
30 #endif
31 #ifdef SIGPROF
32 SIGPROF,
33 #endif
34 SIGSYS,
35 SIGTRAP, SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ
36 };
37
38 sigset_t signalset;
39 int i, test_failed = 0;
40
41 if (sigemptyset(&signalset) == -1) {
42 perror("sigemptyset failed -- test aborted");
43 return -1;
44 }
45
46 for (i = NUMSIGNALS - 1; i >= 0; i--) {
47 if (sigismember(&signalset, siglist[i]) == 1) {
48 #ifdef DEBUG
49 printf("sigemptyset did not clear set of signal %s\n",
50 siglist[i]);
51 #endif
52 test_failed = 1;
53 }
54 }
55
56 if (test_failed == 1) {
57 return PTS_FAIL;
58 }
59
60 printf("sigemptyset passed\n");
61 return PTS_PASS;
62 }
63