Bug 497723 - forgot to restore callgrind output cleanup
[valgrind.git] / none / tests / solaris / blockfault.c
blobc11c7c51bfbe3d4a06051fa6b54f7ec9e66bc197
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <signal.h>
4 #include "tests/sys_mman.h"
6 static void handler(int sig, siginfo_t *info, void *v)
8 printf("info: sig=%d code=%d addr=%p\n",
9 info->si_signo, info->si_code, info->si_addr);
10 exit(0);
13 /* Blocking a fault (for example SIGSEGV) won't work,
14 and is the same as having the default handler. */
15 int main()
17 int* unmapped_page = get_unmapped_page();
18 struct sigaction sa;
19 sigset_t mask;
21 sa.sa_sigaction = handler;
22 sigemptyset(&sa.sa_mask);
23 sa.sa_flags = SA_SIGINFO;
25 sigaction(SIGSEGV, &sa, NULL);
27 sigfillset(&mask);
28 sigprocmask(SIG_BLOCK, &mask, NULL);
30 *(volatile int *)unmapped_page = 213;
32 return 0;