1570af302Sopenharmony_ci#include <sys/mman.h> 2570af302Sopenharmony_ci#include "options.h" 3570af302Sopenharmony_ci#define T(t) (t*)0; 4570af302Sopenharmony_ci#define F(t,n) {t *y = &x.n;} 5570af302Sopenharmony_ci#define C(n) switch(n){case n:;} 6570af302Sopenharmony_cistatic void f() 7570af302Sopenharmony_ci{ 8570af302Sopenharmony_ciT(mode_t) 9570af302Sopenharmony_ciT(off_t) 10570af302Sopenharmony_ciT(size_t) 11570af302Sopenharmony_ci 12570af302Sopenharmony_ciC(PROT_EXEC) 13570af302Sopenharmony_ciC(PROT_NONE) 14570af302Sopenharmony_ciC(PROT_READ) 15570af302Sopenharmony_ciC(PROT_WRITE) 16570af302Sopenharmony_ciC(MAP_FIXED) 17570af302Sopenharmony_ciC(MAP_PRIVATE) 18570af302Sopenharmony_ciC(MAP_SHARED) 19570af302Sopenharmony_ci#ifdef _XOPEN_SOURCE 20570af302Sopenharmony_ciC(MS_ASYNC) 21570af302Sopenharmony_ciC(MS_INVALIDATE) 22570af302Sopenharmony_ciC(MS_SYNC) 23570af302Sopenharmony_ci#endif 24570af302Sopenharmony_ciC(MCL_CURRENT) 25570af302Sopenharmony_ciC(MCL_FUTURE) 26570af302Sopenharmony_ci{void *x = MAP_FAILED;} 27570af302Sopenharmony_ciC(POSIX_MADV_DONTNEED) 28570af302Sopenharmony_ciC(POSIX_MADV_NORMAL) 29570af302Sopenharmony_ciC(POSIX_MADV_RANDOM) 30570af302Sopenharmony_ciC(POSIX_MADV_SEQUENTIAL) 31570af302Sopenharmony_ciC(POSIX_MADV_WILLNEED) 32570af302Sopenharmony_ci 33570af302Sopenharmony_ci#ifdef POSIX_TYPED_MEMORY_OBJECTS 34570af302Sopenharmony_ciC(POSIX_TYPED_MEM_ALLOCATE) 35570af302Sopenharmony_ciC(POSIX_TYPED_MEM_ALLOCATE_CONTIG) 36570af302Sopenharmony_ciC(POSIX_TYPED_MEM_MAP_ALLOCATABLE) 37570af302Sopenharmony_ci{ 38570af302Sopenharmony_cistruct posix_typed_mem_info x; 39570af302Sopenharmony_ciF(size_t,posix_tmi_length) 40570af302Sopenharmony_ci} 41570af302Sopenharmony_ciint(*p)(const void*restrict,size_t,off_t*restrict,size_t*restrict,int*restrict) = posix_mem_offset; 42570af302Sopenharmony_ciint(*p)(int,struct posix_typed_mem_info*) = posix_typed_mem_get_info; 43570af302Sopenharmony_ciint(*p)(const char*,int,int) = posix_typed_mem_open; 44570af302Sopenharmony_ci#endif 45570af302Sopenharmony_ci 46570af302Sopenharmony_ci{int(*p)(const void*,size_t) = mlock;} 47570af302Sopenharmony_ci{int(*p)(int) = mlockall;} 48570af302Sopenharmony_ci{void*(*p)(void*,size_t,int,int,int,off_t) = mmap;} 49570af302Sopenharmony_ci{int(*p)(void*,size_t,int) = mprotect;} 50570af302Sopenharmony_ci#ifdef _XOPEN_SOURCE 51570af302Sopenharmony_ci{int(*p)(void*,size_t,int) = msync;} 52570af302Sopenharmony_ci#endif 53570af302Sopenharmony_ci{int(*p)(const void*,size_t) = munlock;} 54570af302Sopenharmony_ci{int(*p)(void) = munlockall;} 55570af302Sopenharmony_ci{int(*p)(void*,size_t) = munmap;} 56570af302Sopenharmony_ci{int(*p)(void*,size_t,int) = posix_madvise;} 57570af302Sopenharmony_ci#ifdef POSIX_SHARED_MEMORY_OBJECTS 58570af302Sopenharmony_ci{int(*p)(const char*,int,mode_t) = shm_open;} 59570af302Sopenharmony_ci{int(*p)(const char*) = shm_unlink;} 60570af302Sopenharmony_ci#endif 61570af302Sopenharmony_ci} 62