gdbserver_tests: filter out new Missing rpms message
[valgrind.git] / none / tests / linux / blockfault.c
blob3db619239894be2867d3d9a2887f46f36a6ab466
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, ie SIGSEGV, won't work, and is the same as having
14 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;