6 static int sigalrm_received
= 0;
7 static void sigalrm_handler(int signr
)
11 static int sigrtmin_received
= 0;
12 static void sigrtmin_handler(int signr
)
17 static int breakme
= 0;
19 // at least on MacOS, there is no SIGRTMIN.
20 // So, use any other signal instead.
21 #define SIGRTMIN SIGUSR1
24 int main (int argc
, char *argv
[])
27 fprintf(stderr
, "starting ...\n");
28 sa
.sa_handler
= sigalrm_handler
;
29 sigemptyset(&sa
.sa_mask
);
32 if (sigaction (SIGALRM
, &sa
, NULL
) != 0)
34 if (kill(getpid(), SIGALRM
) != 0)
37 if (sigalrm_received
== 1)
38 fprintf (stderr
, "ok: 1st SIGALRM received\n");
40 fprintf (stderr
, "wrong 1st: unexpected value %d sigalrm_received\n",
43 if (kill(getpid(), SIGALRM
) != 0)
46 if (sigalrm_received
== 2)
47 fprintf (stderr
, "ok: 2nd SIGALRM received\n");
49 fprintf (stderr
, "wrong 2nd: unexpected value %d sigalrm_received\n",
52 system("../tests/true");
55 sa
.sa_handler
= sigrtmin_handler
;
56 sigemptyset(&sa
.sa_mask
);
59 if (sigaction (SIGRTMIN
, &sa
, NULL
) != 0)
61 if (kill(getpid(), SIGRTMIN
) != 0)
62 perror("kill sigrtmin");
63 if (sigrtmin_received
== 1)
64 fprintf (stderr
, "ok: SIGRTMIN received\n");
66 fprintf (stderr
, "wrong sigrtmin: unexpected value %d sigrtmin_received\n",