1 /* 2 * Copyright (c) 2015 Fujitsu Ltd. 3 * Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com> 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License as 7 * published by the Free Software Foundation; either version 2 of 8 * the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it would be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. 17 */ 18 19 #ifndef LAPI_MMAP_H__ 20 #define LAPI_MMAP_H__ 21 22 #include "config.h" 23 24 #ifndef MAP_HUGETLB 25 # define MAP_HUGETLB 0x40000 26 #endif 27 28 #ifndef MADV_REMOVE 29 # define MADV_REMOVE 9 30 #endif 31 32 #ifndef MADV_DONTFORK 33 # define MADV_DONTFORK 10 34 #endif 35 36 #ifndef MADV_DOFORK 37 # define MADV_DOFORK 11 38 #endif 39 40 #ifndef MADV_HWPOISON 41 # define MADV_HWPOISON 100 42 #endif 43 44 #ifndef MADV_SOFT_OFFLINE 45 # define MADV_SOFT_OFFLINE 101 46 #endif 47 48 #ifndef MADV_MERGEABLE 49 # define MADV_MERGEABLE 12 50 #endif 51 52 #ifndef MADV_UNMERGEABLE 53 # define MADV_UNMERGEABLE 13 54 #endif 55 56 #ifndef MADV_HUGEPAGE 57 # define MADV_HUGEPAGE 14 58 #endif 59 60 #ifndef MADV_NOHUGEPAGE 61 # define MADV_NOHUGEPAGE 15 62 #endif 63 64 #ifndef MADV_DONTDUMP 65 # define MADV_DONTDUMP 16 66 #endif 67 68 #ifndef MADV_DODUMP 69 # define MADV_DODUMP 17 70 #endif 71 72 #ifndef MADV_FREE 73 # define MADV_FREE 8 74 #endif 75 76 #ifndef MADV_WIPEONFORK 77 # define MADV_WIPEONFORK 18 78 # define MADV_KEEPONFORK 19 79 #endif 80 81 #ifdef HAVE_SYS_SHM_H 82 # include <sys/shm.h> 83 # define MMAP_GRANULARITY SHMLBA 84 #else 85 # include <unistd.h> 86 # define MMAP_GRANULARITY getpagesize() 87 #endif /* HAVE_SYS_SHM_H */ 88 89 #endif /* LAPI_MMAP_H__ */ 90