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 #ifndef MAP_HUGETLB 23 # define MAP_HUGETLB 0x40000 24 #endif 25 26 #ifndef MADV_REMOVE 27 # define MADV_REMOVE 9 28 #endif 29 30 #ifndef MADV_DONTFORK 31 # define MADV_DONTFORK 10 32 #endif 33 34 #ifndef MADV_DOFORK 35 # define MADV_DOFORK 11 36 #endif 37 38 #ifndef MADV_HWPOISON 39 # define MADV_HWPOISON 100 40 #endif 41 42 #ifndef MADV_SOFT_OFFLINE 43 # define MADV_SOFT_OFFLINE 101 44 #endif 45 46 #ifndef MADV_MERGEABLE 47 # define MADV_MERGEABLE 12 48 #endif 49 50 #ifndef MADV_UNMERGEABLE 51 # define MADV_UNMERGEABLE 13 52 #endif 53 54 #ifndef MADV_HUGEPAGE 55 # define MADV_HUGEPAGE 14 56 #endif 57 58 #ifndef MADV_NOHUGEPAGE 59 # define MADV_NOHUGEPAGE 15 60 #endif 61 62 #ifndef MADV_DONTDUMP 63 # define MADV_DONTDUMP 16 64 #endif 65 66 #ifndef MADV_DODUMP 67 # define MADV_DODUMP 17 68 #endif 69 70 #ifndef MADV_FREE 71 # define MADV_FREE 8 72 #endif 73 74 #ifndef MADV_WIPEONFORK 75 # define MADV_WIPEONFORK 18 76 # define MADV_KEEPONFORK 19 77 #endif 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