none/tests/fdleak_cmsg_supp.supp: Add suppressions for older glibc
[valgrind.git] / none / tests / solaris / context_link2.c
blob7979b73e06d6329a8b4b85c080a4181567c99d65
1 /* Test of correct simulation for uc->uc_link in a signal handler. */
3 #include <assert.h>
4 #include <signal.h>
5 #include <stdio.h>
6 #include <ucontext.h>
8 static void sighandler(int sig, siginfo_t *sip, void *arg)
10 ucontext_t uc2;
12 /* Current uc_link value has to be equal to (ucontext_t *) arg. */
13 getcontext(&uc2);
14 assert(uc2.uc_link == arg);
17 int main(void)
19 ucontext_t uc;
20 struct sigaction sa;
22 /* Current uc_link value has to be NULL. */
23 if (getcontext(&uc)) {
24 perror("getcontext");
25 return 1;
27 assert(!uc.uc_link);
29 sa.sa_sigaction = sighandler;
30 sa.sa_flags = SA_SIGINFO;
31 if (sigfillset(&sa.sa_mask)) {
32 perror("sigfillset");
33 return 1;
35 if (sigaction(SIGUSR1, &sa, NULL)) {
36 perror("sigaction");
37 return 1;
40 raise(SIGUSR1);
42 /* Current uc_link value has to be NULL. */
43 getcontext(&uc);
44 assert(!uc.uc_link);
46 return 0;