1 #include "tests/sys_mman.h"
3 #include "arith_include1.c"
5 // For some reason, the stack frame below __GI_write is disappearing.
6 // Therefore, if I don't want the write errors to be merged, I have to
7 // ensure they have a different stack trace. I do this by using this
9 void mywrite(char* buf, int len)
16 struct sigaction sigsegv;
18 char c __attribute__((unused));
20 // This fails due to a bad fd (at one point I was not handling failing
21 // mmap() calls, and would have got a seg fault).
22 char* res1 = mmap(0, 0, PROT_READ, MAP_PRIVATE, -1, 0 );
24 // This succeeds but is meaningless. Important thing is that the size is
25 // zero, so Annelid should not subtract one from the size when doing any
26 // range calculations. (It did at one point, giving 0xffffffff, which
27 // screwed everything up.)
28 char* res2 = mmap(0, 0, PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 );
30 // This succeeds and is useful.
31 char* res3 = mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
33 assert(MAP_FAILED == res1);
35 assert(MAP_FAILED != res3 && NULL != res3);
37 // Intall SEGV handler
38 sigsegv.sa_handler = SEGV_handler;
40 assert( 0 == sigemptyset( &sigsegv.sa_mask ) );
41 assert( 0 == sigaction(SIGSEGV, &sigsegv, NULL) );
44 if (__builtin_setjmp(TTT_jmpbuf) == 0) { c = res3[i]; }
51 assert( 0 == munmap(res3, getpagesize()) );