blob: d47adcc0d43c3e42c49a94cca4a3b26f490bc813 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* Test sig*set functions. */
2
3#include <signal.h>
4#include <stdio.h>
5
6#define TEST_FUNCTION do_test ()
7static int
8do_test (void)
9{
10 int result = 0;
11 int sig = -1;
12
13#define TRY(call) \
14 if (call) \
15 { \
16 printf ("%s (sig = %d): %m\n", #call, sig); \
17 result = 1; \
18 } \
19 else
20
21
22 sigset_t set;
23 TRY (sigemptyset (&set) != 0);
24
25#ifdef SIGRTMAX
26 int max_sig = SIGRTMAX;
27#else
28 int max_sig = NSIG - 1;
29#endif
30
31 for (sig = 1; sig <= max_sig; ++sig)
32 {
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);
38 }
39
40 return result;
41}
42
43#include "../test-skeleton.c"