1 /* Test sig*set functions.  */
2 
3 #include <signal.h>
4 
5 #include <support/check.h>
6 
7 static int
do_test(void)8 do_test (void)
9 {
10   sigset_t set;
11   TEST_VERIFY (sigemptyset (&set) == 0);
12 
13 #define VERIFY(set, sig)			\
14   TEST_VERIFY (sigismember (&set, sig) == 0);	\
15   TEST_VERIFY (sigaddset (&set, sig) == 0);	\
16   TEST_VERIFY (sigismember (&set, sig) != 0);	\
17   TEST_VERIFY (sigdelset (&set, sig) == 0);	\
18   TEST_VERIFY (sigismember (&set, sig) == 0)
19 
20   /* ISO C99 signals.  */
21   VERIFY (set, SIGINT);
22   VERIFY (set, SIGILL);
23   VERIFY (set, SIGABRT);
24   VERIFY (set, SIGFPE);
25   VERIFY (set, SIGSEGV);
26   VERIFY (set, SIGTERM);
27 
28   /* Historical signals specified by POSIX. */
29   VERIFY (set, SIGHUP);
30   VERIFY (set, SIGQUIT);
31   VERIFY (set, SIGTRAP);
32   VERIFY (set, SIGKILL);
33   VERIFY (set, SIGBUS);
34   VERIFY (set, SIGSYS);
35   VERIFY (set, SIGPIPE);
36   VERIFY (set, SIGALRM);
37 
38   /* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
39   VERIFY (set, SIGURG);
40   VERIFY (set, SIGSTOP);
41   VERIFY (set, SIGTSTP);
42   VERIFY (set, SIGCONT);
43   VERIFY (set, SIGCHLD);
44   VERIFY (set, SIGTTIN);
45   VERIFY (set, SIGTTOU);
46   VERIFY (set, SIGPOLL);
47   VERIFY (set, SIGXCPU);
48   VERIFY (set, SIGXFSZ);
49   VERIFY (set, SIGVTALRM);
50   VERIFY (set, SIGPROF);
51   VERIFY (set, SIGUSR1);
52   VERIFY (set, SIGUSR2);
53 
54   /* Nonstandard signals found in all modern POSIX systems
55      (including both BSD and Linux).  */
56   VERIFY (set, SIGWINCH);
57 
58   /* Arch-specific signals.  */
59 #ifdef SIGEMT
60   VERIFY (set, SIGEMT);
61 #endif
62 #ifdef SIGLOST
63   VERIFY (set, SIGLOST);
64 #endif
65 #ifdef SIGINFO
66   VERIFY (set, SIGINFO);
67 #endif
68 #ifdef SIGSTKFLT
69   VERIFY (set, SIGSTKFLT);
70 #endif
71 #ifdef SIGPWR
72   VERIFY (set, SIGPWR);
73 #endif
74 
75   /* Read-time signals (POSIX.1b real-time extensions).  If they are
76      supported SIGRTMAX value is greater than SIGRTMIN.  */
77   for (int rtsig = SIGRTMIN; rtsig <= SIGRTMAX; rtsig++)
78     {
79       VERIFY (set, rtsig);
80     }
81 
82   return 0;
83 }
84 
85 #include <support/test-driver.c>
86