1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (c) 2015 Fujitsu Ltd. 4 * Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com> 5 */ 6 7 #ifndef LAPI_MMAP_H__ 8 #define LAPI_MMAP_H__ 9 10 #include "config.h" 11 12 #ifndef MAP_HUGETLB 13 # define MAP_HUGETLB 0x40000 14 #endif 15 16 #ifndef MADV_REMOVE 17 # define MADV_REMOVE 9 18 #endif 19 20 #ifndef MADV_DONTFORK 21 # define MADV_DONTFORK 10 22 #endif 23 24 #ifndef MADV_DOFORK 25 # define MADV_DOFORK 11 26 #endif 27 28 #ifndef MADV_HWPOISON 29 # define MADV_HWPOISON 100 30 #endif 31 32 #ifndef MADV_SOFT_OFFLINE 33 # define MADV_SOFT_OFFLINE 101 34 #endif 35 36 #ifndef MADV_MERGEABLE 37 # define MADV_MERGEABLE 12 38 #endif 39 40 #ifndef MADV_UNMERGEABLE 41 # define MADV_UNMERGEABLE 13 42 #endif 43 44 #ifndef MADV_HUGEPAGE 45 # define MADV_HUGEPAGE 14 46 #endif 47 48 #ifndef MADV_NOHUGEPAGE 49 # define MADV_NOHUGEPAGE 15 50 #endif 51 52 #ifndef MADV_DONTDUMP 53 # define MADV_DONTDUMP 16 54 #endif 55 56 #ifndef MADV_DODUMP 57 # define MADV_DODUMP 17 58 #endif 59 60 #ifndef MADV_FREE 61 # define MADV_FREE 8 62 #endif 63 64 #ifndef MADV_WIPEONFORK 65 # define MADV_WIPEONFORK 18 66 # define MADV_KEEPONFORK 19 67 #endif 68 69 #ifndef MAP_FIXED_NOREPLACE 70 71 #ifdef __alpha__ 72 # define MAP_FIXED_NOREPLACE 0x200000 73 #else 74 # define MAP_FIXED_NOREPLACE 0x100000 75 #endif 76 77 #endif /* MAP_FIXED_NOREPLACE */ 78 79 #ifdef HAVE_SYS_SHM_H 80 # include <sys/shm.h> 81 # define MMAP_GRANULARITY SHMLBA 82 #else 83 # include <unistd.h> 84 # define MMAP_GRANULARITY getpagesize() 85 #endif /* HAVE_SYS_SHM_H */ 86 87 #endif /* LAPI_MMAP_H__ */ 88