* include/atomic.h: Define catomic_and if not already defined.
[glibc.git] / signal / tst-sigset.c
blobd47adcc0d43c3e42c49a94cca4a3b26f490bc813
1 /* Test sig*set functions. */
3 #include <signal.h>
4 #include <stdio.h>
6 #define TEST_FUNCTION do_test ()
7 static int
8 do_test (void)
10 int result = 0;
11 int sig = -1;
13 #define TRY(call) \
14 if (call) \
15 { \
16 printf ("%s (sig = %d): %m\n", #call, sig); \
17 result = 1; \
18 } \
19 else
22 sigset_t set;
23 TRY (sigemptyset (&set) != 0);
25 #ifdef SIGRTMAX
26 int max_sig = SIGRTMAX;
27 #else
28 int max_sig = NSIG - 1;
29 #endif
31 for (sig = 1; sig <= max_sig; ++sig)
33 TRY (sigismember (&set, sig) != 0);
34 TRY (sigaddset (&set, sig) != 0);
35 TRY (sigismember (&set, sig) == 0);
36 TRY (sigdelset (&set, sig) != 0);
37 TRY (sigismember (&set, sig) != 0);
40 return result;
43 #include "../test-skeleton.c"