blob: 16152010a6664ced92caa27b4e01baf890ec8c2e [file] [log] [blame]
njn25e49d8e72002-09-23 09:36:25 +00001#include <unistd.h>
njn83b62cb2009-04-15 03:12:43 +00002#include "tests/sys_mman.h"
njn25e49d8e72002-09-23 09:36:25 +00003#include <stdio.h>
4#include <stdlib.h>
5
6/* Point of this is that the fd of an PROT_EXEC segment is -1, so Valgrind
7 shouldn't add it to its list of exe segs, and thus it won't be discarded
8 upon the munmap() (so no "discard" message). */
9
10int main()
11{
12 void* m;
13
njn83b62cb2009-04-15 03:12:43 +000014 m = mmap(NULL, 100, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
njn25e49d8e72002-09-23 09:36:25 +000015
16 if (m == (void*)-1) {
17 fprintf(stderr, "error mmapping\n");
18 exit(1);
19 }
20
21 munmap(m, 100);
22
23 return 0;
24}