5 #include <sys/sendfile.h>
9 const unsigned long size = sysconf(_SC_PAGESIZE);
11 /* write instruction pointer length to the log */
12 if (write(-1, NULL, 2 * sizeof(void *)) >= 0)
15 /* just a noticeable line in the log */
16 if (munmap(&main, 0) >= 0)
24 const unsigned long mask = ~(size - 1);
25 const unsigned long addr = (unsigned long) &main;
27 /* SIGSEGV is expected */
28 (void) munmap((void *) ((addr & mask) - size * 2), size * 4);
29 (void) munmap((void *) ((addr & mask) - size * 2), size * 4);
34 if (wait(&status) != pid ||
35 !WIFSIGNALED(status) ||
36 WTERMSIG(status) != SIGSEGV)
39 /* dump process map for debug purposes */
41 if (!open("/proc/self/maps", O_RDONLY))
42 (void) sendfile(1, 0, NULL, size);