]>
Commit | Line | Data |
---|---|---|
158d5fa0 | 1 | /* Common mmap definition for Linux implementation. |
688903eb | 2 | Copyright (C) 2017-2018 Free Software Foundation, Inc. |
158d5fa0 AZ |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
16 | License along with the GNU C Library; if not, see | |
17 | <http://www.gnu.org/licenses/>. */ | |
18 | ||
19 | #ifndef MMAP_INTERNAL_LINUX_H | |
20 | #define MMAP_INTERNAL_LINUX_H 1 | |
21 | ||
22 | /* This is the minimum mmap2 unit size accept by the kernel. An architecture | |
23 | with multiple minimum page sizes (such as m68k) might define it as -1 and | |
24 | thus it will queried at runtime. */ | |
25 | #ifndef MMAP2_PAGE_UNIT | |
26 | # define MMAP2_PAGE_UNIT 4096ULL | |
27 | #endif | |
28 | ||
29 | #if MMAP2_PAGE_UNIT == -1 | |
1f14d0c3 | 30 | static uint64_t page_unit; |
158d5fa0 AZ |
31 | # define MMAP_CHECK_PAGE_UNIT() \ |
32 | if (page_unit == 0) \ | |
33 | page_unit = __getpagesize (); | |
1f14d0c3 AZ |
34 | # undef MMAP2_PAGE_UNIT |
35 | # define MMAP2_PAGE_UNIT page_unit | |
158d5fa0 | 36 | #else |
158d5fa0 AZ |
37 | # define MMAP_CHECK_PAGE_UNIT() |
38 | #endif | |
39 | ||
40 | /* Do not accept offset not multiple of page size. */ | |
41 | #define MMAP_OFF_LOW_MASK (MMAP2_PAGE_UNIT - 1) | |
42 | ||
43 | /* An architecture may override this. */ | |
44 | #ifndef MMAP_CALL | |
45 | # define MMAP_CALL(__nr, __addr, __len, __prot, __flags, __fd, __offset) \ | |
46 | INLINE_SYSCALL_CALL (__nr, __addr, __len, __prot, __flags, __fd, __offset) | |
47 | #endif | |
48 | ||
49 | #endif /* MMAP_INTERNAL_LINUX_H */ |