1 /* 2 * Copyright 2008, Haiku Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _SYS_MMAN_H 6 #define _SYS_MMAN_H 7 8 #include <sys/cdefs.h> 9 #include <sys/types.h> 10 11 12 /* memory protection for mmap() and others; assignment compatible with 13 B_{READ,WRITE,EXECUTE}_AREA */ 14 #define PROT_READ 0x01 15 #define PROT_WRITE 0x02 16 #define PROT_EXEC 0x04 17 #define PROT_NONE 0x00 18 19 /* mmap() flags */ 20 #define MAP_SHARED 0x01 /* changes are seen by others */ 21 #define MAP_PRIVATE 0x02 /* changes are only seen by caller */ 22 #define MAP_FIXED 0x04 /* require mapping to specified addr */ 23 #define MAP_ANONYMOUS 0x08 /* no underlying object */ 24 #define MAP_ANON MAP_ANONYMOUS 25 26 /* mmap() error return code */ 27 #define MAP_FAILED ((void*)-1) 28 29 /* msync() flags */ 30 #define MS_ASYNC 0x01 31 #define MS_SYNC 0x02 32 #define MS_INVALIDATE 0x04 33 34 /* posix_madvise() values */ 35 #define POSIX_MADV_NORMAL 1 36 #define POSIX_MADV_SEQUENTIAL 2 37 #define POSIX_MADV_RANDOM 3 38 #define POSIX_MADV_WILLNEED 4 39 #define POSIX_MADV_DONTNEED 5 40 41 42 __BEGIN_DECLS 43 44 void* mmap(void* address, size_t length, int protection, int flags, 45 int fd, off_t offset); 46 int munmap(void* address, size_t length); 47 48 int mprotect(void* address, size_t length, int protection); 49 int msync(void* address, size_t length, int flags); 50 51 int posix_madvise(void* address, size_t length, int advice); 52 53 int shm_open(const char* name, int openMode, mode_t permissions); 54 int shm_unlink(const char* name); 55 56 __END_DECLS 57 58 59 #endif /* _SYS_MMAN_H */ 60