Revision | 7cc754bc93eafa78695ec03bb0e4e8256d52c76d (tree) |
---|---|
Time | 2018-02-04 04:29:51 |
Author | Waldemar Brodkorb <wbx@ucli...> |
Commiter | Waldemar Brodkorb |
bits/mman.h: consolidate header file
Sync with GNU C library and consolidate duplicate non
architecture specific defines.
MAP_UNINITIALIZED is only defined to 0x4000000 and used by
the Linux kernel when CONFIG_MMAP_ALLOW_UNINITIALIZED is enabled.
CONFIG_MMAP_ALLOW_UNINITIALIZED is only available for nommu.
See Documentation/nommu-mmap.txt.
@@ -9,6 +9,12 @@ | ||
9 | 9 | |
10 | 10 | #include <features.h> |
11 | 11 | |
12 | +#ifdef __ARCH_USE_MMU__ | |
13 | +# define _MAP_UNINITIALIZED 0 | |
14 | +#else | |
15 | +# define _MAP_UNINITIALIZED MAP_UNINITIALIZED | |
16 | +#endif | |
17 | + | |
12 | 18 | /* Prepare for the case that `__builtin_expect' is not available. */ |
13 | 19 | #if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ < 96 |
14 | 20 | #define __builtin_expect(x, expected_value) (x) |
@@ -569,7 +569,7 @@ struct elf_resolve *_dl_load_elf_shared_library(unsigned int rflags, | ||
569 | 569 | return NULL; |
570 | 570 | } |
571 | 571 | header = _dl_mmap((void *) 0, _dl_pagesize, PROT_READ | PROT_WRITE, |
572 | - MAP_PRIVATE | MAP_ANONYMOUS | MAP_UNINITIALIZED, -1, 0); | |
572 | + MAP_PRIVATE | MAP_ANONYMOUS | _MAP_UNINITIALIZED, -1, 0); | |
573 | 573 | if (_dl_mmap_check_error(header)) { |
574 | 574 | _dl_dprintf(2, "%s:%i: can't map '%s'\n", _dl_progname, __LINE__, libname); |
575 | 575 | _dl_internal_error_number = LD_ERROR_MMAP_FAILED; |
@@ -235,7 +235,7 @@ void *_dl_malloc(size_t size) | ||
235 | 235 | |
236 | 236 | _dl_debug_early("mmapping more memory\n"); |
237 | 237 | _dl_mmap_zero = _dl_malloc_addr = _dl_mmap((void *) 0, rounded_size, |
238 | - PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_UNINITIALIZED, -1, 0); | |
238 | + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | _MAP_UNINITIALIZED, -1, 0); | |
239 | 239 | if (_dl_mmap_check_error(_dl_mmap_zero)) { |
240 | 240 | _dl_dprintf(2, "%s: mmap of a spare page failed!\n", _dl_progname); |
241 | 241 | _dl_exit(20); |
@@ -0,0 +1,39 @@ | ||
1 | +/* Definitions for POSIX memory map interface. Linux/AArch64 version. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
3 | + | |
4 | + The GNU C Library is free software; you can redistribute it and/or | |
5 | + modify it under the terms of the GNU Lesser General Public | |
6 | + License as published by the Free Software Foundation; either | |
7 | + version 2.1 of the License, or (at your option) any later version. | |
8 | + | |
9 | + The GNU C Library is distributed in the hope that it will be useful, | |
10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | + Lesser General Public License for more details. | |
13 | + | |
14 | + You should have received a copy of the GNU Lesser General Public | |
15 | + License along with the GNU C Library. If not, see | |
16 | + <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#ifndef _SYS_MMAN_H | |
19 | +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." | |
20 | +#endif | |
21 | + | |
22 | +/* The following definitions basically come from the kernel headers. | |
23 | + But the kernel header is not namespace clean. */ | |
24 | + | |
25 | +/* These are Linux-specific. */ | |
26 | +#ifdef __USE_MISC | |
27 | +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ | |
28 | +# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ | |
29 | +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ | |
30 | +# define MAP_LOCKED 0x02000 /* Lock the mapping. */ | |
31 | +# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ | |
32 | +# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ | |
33 | +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ | |
34 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
35 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
36 | +#endif | |
37 | + | |
38 | +/* Include generic Linux declarations. */ | |
39 | +#include <bits/mman-linux.h> |
@@ -1,6 +1,5 @@ | ||
1 | 1 | /* Definitions for POSIX memory map interface. Linux/Alpha version. |
2 | - Copyright (C) 1997, 1998, 2000, 2003, 2006 Free Software Foundation, Inc. | |
3 | - This file is part of the GNU C Library. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
4 | 3 | |
5 | 4 | The GNU C Library is free software; you can redistribute it and/or |
6 | 5 | modify it under the terms of the GNU Lesser General Public |
@@ -13,7 +12,7 @@ | ||
13 | 12 | Lesser General Public License for more details. |
14 | 13 | |
15 | 14 | You should have received a copy of the GNU Lesser General Public |
16 | - License along with the GNU C Library; if not, see | |
15 | + License along with the GNU C Library. If not, see | |
17 | 16 | <http://www.gnu.org/licenses/>. */ |
18 | 17 | |
19 | 18 | #ifndef _SYS_MMAN_H |
@@ -23,43 +22,7 @@ | ||
23 | 22 | /* The following definitions basically come from the kernel headers. |
24 | 23 | But the kernel header is not namespace clean. */ |
25 | 24 | |
26 | - | |
27 | -/* Protections are chosen from these bits, OR'd together. The | |
28 | - implementation does not necessarily support PROT_EXEC or PROT_WRITE | |
29 | - without PROT_READ. The only guarantees are that no writing will be | |
30 | - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ | |
31 | - | |
32 | -#define PROT_READ 0x1 /* Page can be read. */ | |
33 | -#define PROT_WRITE 0x2 /* Page can be written. */ | |
34 | -#define PROT_EXEC 0x4 /* Page can be executed. */ | |
35 | -#define PROT_NONE 0x0 /* Page can not be accessed. */ | |
36 | -#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of | |
37 | - growsdown vma (mprotect only). */ | |
38 | -#define PROT_GROWSUP 0x02000000 /* Extend change to start of | |
39 | - growsup vma (mprotect only). */ | |
40 | - | |
41 | -/* Sharing types (must choose one and only one of these). */ | |
42 | -#define MAP_SHARED 0x01 /* Share changes. */ | |
43 | -#define MAP_PRIVATE 0x02 /* Changes are private. */ | |
44 | -#ifdef __USE_MISC | |
45 | -# define MAP_TYPE 0x0f /* Mask for type of mapping. */ | |
46 | -#endif | |
47 | - | |
48 | -/* Other flags. */ | |
49 | -#define MAP_FIXED 0x100 /* Interpret addr exactly. */ | |
50 | -#ifdef __USE_MISC | |
51 | -# define MAP_FILE 0 | |
52 | -# define MAP_ANONYMOUS 0x10 /* Don't use a file. */ | |
53 | -# define MAP_ANON MAP_ANONYMOUS | |
54 | -#endif | |
55 | - | |
56 | -/* Not used by Linux, but here to make sure we don't clash with | |
57 | - OSF/1 defines. */ | |
58 | -#if 0 && defined __USE_BSD | |
59 | -# define MAP_HASSEMAPHORE 0x0200 | |
60 | -# define MAP_INHERIT 0x0400 | |
61 | -# define MAP_UNALIGNED 0x0800 | |
62 | -#endif | |
25 | +#define __MAP_ANONYMOUS 0x10 /* Don't use a file. */ | |
63 | 26 | |
64 | 27 | /* These are Linux-specific. */ |
65 | 28 | #ifdef __USE_MISC |
@@ -70,50 +33,33 @@ | ||
70 | 33 | # define MAP_NORESERVE 0x10000 /* Don't check for reservations. */ |
71 | 34 | # define MAP_POPULATE 0x20000 /* Populate (prefault) pagetables. */ |
72 | 35 | # define MAP_NONBLOCK 0x40000 /* Do not block on IO. */ |
73 | -# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could | |
74 | - be uninitialized. */ | |
36 | +# define MAP_STACK 0x80000 /* Allocation is for a stack. */ | |
37 | +# define MAP_HUGETLB 0x100000 /* Create huge page mapping. */ | |
75 | 38 | #endif |
76 | 39 | |
77 | -/* Flags to `msync'. */ | |
78 | -#define MS_ASYNC 1 /* Sync memory asynchronously. */ | |
79 | -#define MS_SYNC 2 /* Synchronous memory sync. */ | |
80 | -#define MS_INVALIDATE 4 /* Invalidate the caches. */ | |
81 | - | |
82 | 40 | /* Flags for `mlockall'. */ |
83 | -#define MCL_CURRENT 8192 /* Lock all currently mapped pages. */ | |
84 | -#define MCL_FUTURE 16384 /* Lock all additions to address | |
85 | - space. */ | |
41 | +#define MCL_CURRENT 8192 | |
42 | +#define MCL_FUTURE 16384 | |
43 | +#define MCL_ONFAULT 32768 | |
86 | 44 | |
87 | -/* Flags for `mremap'. */ | |
88 | -#ifdef __USE_GNU | |
89 | -# define MREMAP_MAYMOVE 1 | |
90 | -# define MREMAP_FIXED 2 | |
91 | -#endif | |
45 | +#include <bits/mman-linux.h> | |
92 | 46 | |
93 | -/* Advice to `madvise'. */ | |
94 | -#ifdef __USE_BSD | |
95 | -# define MADV_NORMAL 0 /* No further special treatment. */ | |
96 | -# define MADV_RANDOM 1 /* Expect random page references. */ | |
97 | -# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
98 | -# define MADV_WILLNEED 3 /* Will need these pages. */ | |
99 | -# define MADV_DONTNEED 6 /* Don't need these pages. */ | |
100 | -# define MADV_REMOVE 9 /* Remove these pages and resources. */ | |
101 | -# define MADV_DONTFORK 10 /* Do not inherit across fork. */ | |
102 | -# define MADV_DOFORK 11 /* Do inherit across fork. */ | |
103 | -#endif | |
47 | +/* Values that differ from standard <mman-linux.h>. For the most part newer | |
48 | + values are shared, but older values are skewed. */ | |
104 | 49 | |
105 | -/* The POSIX people had to invent similar names for the same things. */ | |
106 | -#ifdef __USE_XOPEN2K | |
107 | -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ | |
108 | -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ | |
109 | -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
110 | -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ | |
111 | -# define POSIX_MADV_DONTNEED 6 /* Don't need these pages. */ | |
112 | -#endif | |
50 | +#undef MAP_FIXED | |
51 | +#define MAP_FIXED 0x100 | |
113 | 52 | |
114 | -/* Not used by Linux, but here to make sure we don't clash with | |
115 | - OSF/1 defines. */ | |
116 | -#if 0 && defined __USE_BSD | |
117 | -# define MADV_DONTNEED_COMPAT 4 /* Old version? */ | |
118 | -# define MADV_SPACEAVAIL 5 /* Ensure resources are available. */ | |
53 | +#undef MS_SYNC | |
54 | +#define MS_SYNC 2 | |
55 | +#undef MS_INVALIDATE | |
56 | +#define MS_INVALIDATE 4 | |
57 | + | |
58 | +#ifdef __USE_MISC | |
59 | +# undef MADV_DONTNEED | |
60 | +# define MADV_DONTNEED 6 | |
61 | +#endif | |
62 | +#ifdef __USE_XOPEN2K | |
63 | +# undef POSIX_MADV_DONTNEED | |
64 | +# define POSIX_MADV_DONTNEED 6 | |
119 | 65 | #endif |
@@ -0,0 +1,40 @@ | ||
1 | +/* Definitions for POSIX memory map interface. Linux/ARM version. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
3 | + | |
4 | + The GNU C Library is free software; you can redistribute it and/or | |
5 | + modify it under the terms of the GNU Lesser General Public | |
6 | + License as published by the Free Software Foundation; either | |
7 | + version 2.1 of the License, or (at your option) any later version. | |
8 | + | |
9 | + The GNU C Library is distributed in the hope that it will be useful, | |
10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | + Lesser General Public License for more details. | |
13 | + | |
14 | + You should have received a copy of the GNU Lesser General Public | |
15 | + License along with the GNU C Library. If not, see | |
16 | + <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#ifndef _SYS_MMAN_H | |
19 | +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." | |
20 | +#endif | |
21 | + | |
22 | +/* The following definitions basically come from the kernel headers. | |
23 | + But the kernel header is not namespace clean. */ | |
24 | + | |
25 | +/* These are Linux-specific. */ | |
26 | +#ifdef __USE_MISC | |
27 | +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ | |
28 | +# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ | |
29 | +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ | |
30 | +# define MAP_LOCKED 0x02000 /* Lock the mapping. */ | |
31 | +# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ | |
32 | +# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ | |
33 | +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ | |
34 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
35 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
36 | +# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could - be uninitialized. */ | |
37 | +#endif | |
38 | + | |
39 | +/* Include generic Linux declarations. */ | |
40 | +#include <bits/mman-linux.h> |
@@ -1,6 +1,5 @@ | ||
1 | 1 | /* Definitions for POSIX memory map interface. Linux/generic version. |
2 | - Copyright (C) 1997,2000,2003,2005,2006,2009 Free Software Foundation, Inc. | |
3 | - This file is part of the GNU C Library. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
4 | 3 | |
5 | 4 | The GNU C Library is free software; you can redistribute it and/or |
6 | 5 | modify it under the terms of the GNU Lesser General Public |
@@ -23,36 +22,6 @@ | ||
23 | 22 | /* The following definitions basically come from the kernel headers. |
24 | 23 | But the kernel header is not namespace clean. */ |
25 | 24 | |
26 | - | |
27 | -/* Protections are chosen from these bits, OR'd together. The | |
28 | - implementation does not necessarily support PROT_EXEC or PROT_WRITE | |
29 | - without PROT_READ. The only guarantees are that no writing will be | |
30 | - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ | |
31 | - | |
32 | -#define PROT_READ 0x1 /* Page can be read. */ | |
33 | -#define PROT_WRITE 0x2 /* Page can be written. */ | |
34 | -#define PROT_EXEC 0x4 /* Page can be executed. */ | |
35 | -#define PROT_NONE 0x0 /* Page can not be accessed. */ | |
36 | -#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of | |
37 | - growsdown vma (mprotect only). */ | |
38 | -#define PROT_GROWSUP 0x02000000 /* Extend change to start of | |
39 | - growsup vma (mprotect only). */ | |
40 | - | |
41 | -/* Sharing types (must choose one and only one of these). */ | |
42 | -#define MAP_SHARED 0x01 /* Share changes. */ | |
43 | -#define MAP_PRIVATE 0x02 /* Changes are private. */ | |
44 | -#ifdef __USE_MISC | |
45 | -# define MAP_TYPE 0x0f /* Mask for type of mapping. */ | |
46 | -#endif | |
47 | - | |
48 | -/* Other flags. */ | |
49 | -#define MAP_FIXED 0x10 /* Interpret addr exactly. */ | |
50 | -#ifdef __USE_MISC | |
51 | -# define MAP_FILE 0 | |
52 | -# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ | |
53 | -# define MAP_ANON MAP_ANONYMOUS | |
54 | -#endif | |
55 | - | |
56 | 25 | /* These are Linux-specific. */ |
57 | 26 | #ifdef __USE_MISC |
58 | 27 | # define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ |
@@ -63,49 +32,8 @@ | ||
63 | 32 | # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ |
64 | 33 | # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ |
65 | 34 | # define MAP_STACK 0x20000 /* Allocation is for a stack. */ |
66 | -# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could | |
67 | - be uninitialized. */ | |
35 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
36 | +# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could - be uninitialized. */ | |
68 | 37 | #endif |
69 | 38 | |
70 | -/* Flags to `msync'. */ | |
71 | -#define MS_ASYNC 1 /* Sync memory asynchronously. */ | |
72 | -#define MS_SYNC 4 /* Synchronous memory sync. */ | |
73 | -#define MS_INVALIDATE 2 /* Invalidate the caches. */ | |
74 | - | |
75 | -/* Flags for `mlockall'. */ | |
76 | -#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ | |
77 | -#define MCL_FUTURE 2 /* Lock all additions to address | |
78 | - space. */ | |
79 | - | |
80 | -/* Flags for `mremap'. */ | |
81 | -#ifdef __USE_GNU | |
82 | -# define MREMAP_MAYMOVE 1 | |
83 | -# define MREMAP_FIXED 2 | |
84 | -#endif | |
85 | - | |
86 | -/* only define for MMU targets, no-MMU does not support madvise. */ | |
87 | -#ifdef __ARCH_USE_MMU__ | |
88 | -/* Advice to `madvise'. */ | |
89 | -# ifdef __USE_BSD | |
90 | -# define MADV_NORMAL 0 /* No further special treatment. */ | |
91 | -# define MADV_RANDOM 1 /* Expect random page references. */ | |
92 | -# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
93 | -# define MADV_WILLNEED 3 /* Will need these pages. */ | |
94 | -# define MADV_DONTNEED 4 /* Don't need these pages. */ | |
95 | -# define MADV_REMOVE 9 /* Remove these pages and resources. */ | |
96 | -# define MADV_DONTFORK 10 /* Do not inherit across fork. */ | |
97 | -# define MADV_DOFORK 11 /* Do inherit across fork. */ | |
98 | -# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ | |
99 | -# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ | |
100 | -# define MADV_HWPOISON 100 /* Poison a page for testing. */ | |
101 | -# endif | |
102 | - | |
103 | -/* The POSIX people had to invent similar names for the same things. */ | |
104 | -# ifdef __USE_XOPEN2K | |
105 | -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ | |
106 | -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ | |
107 | -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
108 | -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ | |
109 | -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ | |
110 | -# endif | |
111 | -#endif | |
39 | +#include <bits/mman-linux.h> |
@@ -0,0 +1,117 @@ | ||
1 | +/* Definitions for POSIX memory map interface. Linux generic version. | |
2 | + Copyright (C) 2001-2018 Free Software Foundation, Inc. | |
3 | + | |
4 | + The GNU C Library is free software; you can redistribute it and/or | |
5 | + modify it under the terms of the GNU Lesser General Public | |
6 | + License as published by the Free Software Foundation; either | |
7 | + version 2.1 of the License, or (at your option) any later version. | |
8 | + | |
9 | + The GNU C Library is distributed in the hope that it will be useful, | |
10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | + Lesser General Public License for more details. | |
13 | + | |
14 | + You should have received a copy of the GNU Lesser General Public | |
15 | + License along with the GNU C Library; if not, see | |
16 | + <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#ifndef _SYS_MMAN_H | |
19 | +# error "Never use <bits/mman-linux.h> directly; include <sys/mman.h> instead." | |
20 | +#endif | |
21 | + | |
22 | +/* The following definitions basically come from the kernel headers. | |
23 | + But the kernel header is not namespace clean. */ | |
24 | + | |
25 | + | |
26 | +/* Protections are chosen from these bits, OR'd together. The | |
27 | + implementation does not necessarily support PROT_EXEC or PROT_WRITE | |
28 | + without PROT_READ. The only guarantees are that no writing will be | |
29 | + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ | |
30 | + | |
31 | +#define PROT_READ 0x1 /* Page can be read. */ | |
32 | +#define PROT_WRITE 0x2 /* Page can be written. */ | |
33 | +#define PROT_EXEC 0x4 /* Page can be executed. */ | |
34 | +#define PROT_NONE 0x0 /* Page can not be accessed. */ | |
35 | +#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of | |
36 | + growsdown vma (mprotect only). */ | |
37 | +#define PROT_GROWSUP 0x02000000 /* Extend change to start of | |
38 | + growsup vma (mprotect only). */ | |
39 | + | |
40 | +/* Sharing types (must choose one and only one of these). */ | |
41 | +#define MAP_SHARED 0x01 /* Share changes. */ | |
42 | +#define MAP_PRIVATE 0x02 /* Changes are private. */ | |
43 | +#ifdef __USE_MISC | |
44 | +# define MAP_TYPE 0x0f /* Mask for type of mapping. */ | |
45 | +#endif | |
46 | + | |
47 | +/* Other flags. */ | |
48 | +#define MAP_FIXED 0x10 /* Interpret addr exactly. */ | |
49 | +#ifdef __USE_MISC | |
50 | +# define MAP_FILE 0 | |
51 | +# ifdef __MAP_ANONYMOUS | |
52 | +# define MAP_ANONYMOUS __MAP_ANONYMOUS /* Don't use a file. */ | |
53 | +# else | |
54 | +# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ | |
55 | +# endif | |
56 | +# define MAP_ANON MAP_ANONYMOUS | |
57 | +/* When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. */ | |
58 | +# define MAP_HUGE_SHIFT 26 | |
59 | +# define MAP_HUGE_MASK 0x3f | |
60 | +#endif | |
61 | + | |
62 | +/* Flags to `msync'. */ | |
63 | +#define MS_ASYNC 1 /* Sync memory asynchronously. */ | |
64 | +#define MS_SYNC 4 /* Synchronous memory sync. */ | |
65 | +#define MS_INVALIDATE 2 /* Invalidate the caches. */ | |
66 | + | |
67 | +/* Flags for `mremap'. */ | |
68 | +#ifdef __USE_GNU | |
69 | +# define MREMAP_MAYMOVE 1 | |
70 | +# define MREMAP_FIXED 2 | |
71 | +#endif | |
72 | + | |
73 | +/* only define for MMU targets, no-MMU does not support madvise. */ | |
74 | +#ifdef __ARCH_USE_MMU__ | |
75 | +/* Advice to `madvise'. */ | |
76 | +# ifdef __USE_MISC | |
77 | +# define MADV_NORMAL 0 /* No further special treatment. */ | |
78 | +# define MADV_RANDOM 1 /* Expect random page references. */ | |
79 | +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
80 | +# define MADV_WILLNEED 3 /* Will need these pages. */ | |
81 | +# define MADV_DONTNEED 4 /* Don't need these pages. */ | |
82 | +# define MADV_FREE 8 /* Free pages only if memory pressure. */ | |
83 | +# define MADV_REMOVE 9 /* Remove these pages and resources. */ | |
84 | +# define MADV_DONTFORK 10 /* Do not inherit across fork. */ | |
85 | +# define MADV_DOFORK 11 /* Do inherit across fork. */ | |
86 | +# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ | |
87 | +# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ | |
88 | +# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */ | |
89 | +# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */ | |
90 | +# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, | |
91 | + overrides the coredump filter bits. */ | |
92 | +# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */ | |
93 | +# define MADV_WIPEONFORK 18 /* Zero memory on fork, child only. */ | |
94 | +# define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK. */ | |
95 | +# define MADV_HWPOISON 100 /* Poison a page for testing. */ | |
96 | +# endif | |
97 | + | |
98 | +/* The POSIX people had to invent similar names for the same things. */ | |
99 | +# ifdef __USE_XOPEN2K | |
100 | +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ | |
101 | +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ | |
102 | +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
103 | +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ | |
104 | +# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ | |
105 | +# endif | |
106 | +#endif | |
107 | + | |
108 | +/* Flags for `mlockall'. */ | |
109 | +#ifndef MCL_CURRENT | |
110 | +# define MCL_CURRENT 1 /* Lock all currently mapped pages. */ | |
111 | +# define MCL_FUTURE 2 /* Lock all additions to address | |
112 | + space. */ | |
113 | +# define MCL_ONFAULT 4 /* Lock all pages that are | |
114 | + faulted in. */ | |
115 | +#endif | |
116 | + | |
117 | +#include <bits/mman-shared.h> |
@@ -0,0 +1,75 @@ | ||
1 | +/* Memory-mapping-related declarations/definitions, not architecture-specific. | |
2 | + Copyright (C) 2017-2018 Free Software Foundation, Inc. | |
3 | + | |
4 | + The GNU C Library is free software; you can redistribute it and/or | |
5 | + modify it under the terms of the GNU Lesser General Public | |
6 | + License as published by the Free Software Foundation; either | |
7 | + version 2.1 of the License, or (at your option) any later version. | |
8 | + | |
9 | + The GNU C Library is distributed in the hope that it will be useful, | |
10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | + Lesser General Public License for more details. | |
13 | + | |
14 | + You should have received a copy of the GNU Lesser General Public | |
15 | + License along with the GNU C Library; if not, see | |
16 | + <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#ifndef _SYS_MMAN_H | |
19 | +# error "Never use <bits/mman-shared.h> directly; include <sys/mman.h> instead." | |
20 | +#endif | |
21 | + | |
22 | +#ifdef __USE_GNU | |
23 | +/* Flags for memfd_create. */ | |
24 | +# ifndef MFD_CLOEXEC | |
25 | +# define MFD_CLOEXEC 1U | |
26 | +# define MFD_ALLOW_SEALING 2U | |
27 | +# define MFD_HUGETLB 4U | |
28 | +# endif | |
29 | + | |
30 | +/* Flags for mlock2. */ | |
31 | +# ifndef MLOCK_ONFAULT | |
32 | +# define MLOCK_ONFAULT 1U | |
33 | +# endif | |
34 | + | |
35 | +/* Access rights for pkey_alloc. */ | |
36 | +# ifndef PKEY_DISABLE_ACCESS | |
37 | +# define PKEY_DISABLE_ACCESS 0x1 | |
38 | +# define PKEY_DISABLE_WRITE 0x2 | |
39 | +# endif | |
40 | + | |
41 | +__BEGIN_DECLS | |
42 | + | |
43 | +/* Create a new memory file descriptor. NAME is a name for debugging. | |
44 | + FLAGS is a combination of the MFD_* constants. */ | |
45 | +int memfd_create (const char *__name, unsigned int __flags) __THROW; | |
46 | + | |
47 | +/* Lock pages from ADDR (inclusive) to ADDR + LENGTH (exclusive) into | |
48 | + memory. FLAGS is a combination of the MLOCK_* flags above. */ | |
49 | +int mlock2 (const void *__addr, size_t __length, unsigned int __flags) __THROW; | |
50 | + | |
51 | +/* Allocate a new protection key, with the PKEY_DISABLE_* bits | |
52 | + specified in ACCESS_RIGHTS. The protection key mask for the | |
53 | + current thread is updated to match the access privilege for the new | |
54 | + key. */ | |
55 | +int pkey_alloc (unsigned int __flags, unsigned int __access_rights) __THROW; | |
56 | + | |
57 | +/* Update the access rights for the current thread for KEY, which must | |
58 | + have been allocated using pkey_alloc. */ | |
59 | +int pkey_set (int __key, unsigned int __access_rights) __THROW; | |
60 | + | |
61 | +/* Return the access rights for the current thread for KEY, which must | |
62 | + have been allocated using pkey_alloc. */ | |
63 | +int pkey_get (int _key) __THROW; | |
64 | + | |
65 | +/* Free an allocated protection key, which must have been allocated | |
66 | + using pkey_alloc. */ | |
67 | +int pkey_free (int __key) __THROW; | |
68 | + | |
69 | +/* Apply memory protection flags for KEY to the specified address | |
70 | + range. */ | |
71 | +int pkey_mprotect (void *__addr, size_t __len, int __prot, int __pkey) __THROW; | |
72 | + | |
73 | +__END_DECLS | |
74 | + | |
75 | +#endif /* __USE_GNU */ |
@@ -1,6 +1,5 @@ | ||
1 | 1 | /* Definitions for POSIX memory map interface. Linux/HPPA version. |
2 | - Copyright (C) 1997-2015 Free Software Foundation, Inc. | |
3 | - This file is part of the GNU C Library. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
4 | 3 | |
5 | 4 | The GNU C Library is free software; you can redistribute it and/or |
6 | 5 | modify it under the terms of the GNU Lesser General Public |
@@ -58,6 +57,8 @@ | ||
58 | 57 | # define MAP_GROWSDOWN 0x8000 /* Stack-like segment */ |
59 | 58 | # define MAP_POPULATE 0x10000 /* Populate (prefault) pagetables */ |
60 | 59 | # define MAP_NONBLOCK 0x20000 /* Do not block on IO */ |
60 | +# define MAP_STACK 0x40000 /* Create for process/thread stacks */ | |
61 | +# define MAP_HUGETLB 0x80000 /* Create a huge page mapping */ | |
61 | 62 | #endif |
62 | 63 | |
63 | 64 | /* Flags to "msync" */ |
@@ -68,6 +69,7 @@ | ||
68 | 69 | /* Flags to "mlockall" */ |
69 | 70 | #define MCL_CURRENT 1 /* Lock all current mappings */ |
70 | 71 | #define MCL_FUTURE 2 /* Lock all future mappings */ |
72 | +#define MCL_ONFAULT 4 /* Lock all pages that are faulted in */ | |
71 | 73 | |
72 | 74 | /* Flags for `mremap'. */ |
73 | 75 | #ifdef __USE_GNU |
@@ -82,27 +84,21 @@ | ||
82 | 84 | # define MADV_SEQUENTIAL 2 /* Expect sequential page references */ |
83 | 85 | # define MADV_WILLNEED 3 /* Will need these pages */ |
84 | 86 | # define MADV_DONTNEED 4 /* Dont need these pages */ |
85 | -# define MADV_SPACEAVAIL 5 /* Insure that resources are reserved */ | |
86 | -# define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */ | |
87 | -# define MADV_VPS_INHERIT 7 /* Inherit parents page size */ | |
87 | +# define MADV_FREE 8 /* Free pages only if memory pressure. */ | |
88 | 88 | # define MADV_REMOVE 9 /* Remove these pages and resources. */ |
89 | 89 | # define MADV_DONTFORK 10 /* Do not inherit across fork. */ |
90 | 90 | # define MADV_DOFORK 11 /* Do inherit across fork. */ |
91 | 91 | # define MADV_MERGEABLE 65 /* KSM may merge identical pages */ |
92 | 92 | # define MADV_UNMERGEABLE 66 /* KSM may not merge identical pages */ |
93 | -#endif | |
94 | - | |
95 | -/* The range 12-64 is reserved for page size specification. */ | |
96 | -/* These are Linux-specific. */ | |
97 | -#ifdef __USE_MISC | |
98 | -# define MADV_4K_PAGES 12 /* Use 4K pages. */ | |
99 | -# define MADV_16K_PAGES 14 /* Use 16K pages. */ | |
100 | -# define MADV_64K_PAGES 16 /* Use 64K pages. */ | |
101 | -# define MADV_256K_PAGES 18 /* Use 256K pages. */ | |
102 | -# define MADV_1M_PAGES 20 /* Use 1 Megabyte pages. */ | |
103 | -# define MADV_4M_PAGES 22 /* Use 4 Megabyte pages. */ | |
104 | -# define MADV_16M_PAGES 24 /* Use 16 Megabyte pages. */ | |
105 | -# define MADV_64M_PAGES 26 /* Use 64 Megabyte pages. */ | |
93 | +# define MADV_HUGEPAGE 67 /* Worth backing with hugepages */ | |
94 | +# define MADV_NOHUGEPAGE 68 /* Not worth backing with hugepages */ | |
95 | +# define MADV_DONTDUMP 69 /* Explicity exclude from the core dump, | |
96 | + overrides the coredump filter bits */ | |
97 | +# define MADV_DODUMP 70 /* Clear the MADV_NODUMP flag */ | |
98 | +# define MADV_WIPEONFORK 71 /* Zero memory on fork, child only. */ | |
99 | +# define MADV_KEEPONFORK 72 /* Undo MADV_WIPEONFORK. */ | |
100 | +# define MADV_HWPOISON 100 /* Poison a page for testing. */ | |
101 | +# define MADV_SOFT_OFFLINE 101 /* Soft offline page for testing. */ | |
106 | 102 | #endif |
107 | 103 | |
108 | 104 | /* The POSIX people had to invent similar names for the same things. */ |
@@ -113,3 +109,5 @@ | ||
113 | 109 | # define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ |
114 | 110 | # define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ |
115 | 111 | #endif |
112 | + | |
113 | +#include <bits/mman-shared.h> |
@@ -0,0 +1,44 @@ | ||
1 | +/* Definitions for POSIX memory map interface. Linux/x86 version. | |
2 | + Copyright (C) 2001-2018 Free Software Foundation, Inc. | |
3 | + | |
4 | + The GNU C Library is free software; you can redistribute it and/or | |
5 | + modify it under the terms of the GNU Lesser General Public | |
6 | + License as published by the Free Software Foundation; either | |
7 | + version 2.1 of the License, or (at your option) any later version. | |
8 | + | |
9 | + The GNU C Library is distributed in the hope that it will be useful, | |
10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | + Lesser General Public License for more details. | |
13 | + | |
14 | + You should have received a copy of the GNU Lesser General Public | |
15 | + License along with the GNU C Library; if not, see | |
16 | + <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#ifndef _SYS_MMAN_H | |
19 | +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." | |
20 | +#endif | |
21 | + | |
22 | +/* The following definitions basically come from the kernel headers. | |
23 | + But the kernel header is not namespace clean. */ | |
24 | + | |
25 | +/* Other flags. */ | |
26 | +#ifdef __USE_MISC | |
27 | +# define MAP_32BIT 0x40 /* Only give out 32-bit addresses. */ | |
28 | +#endif | |
29 | + | |
30 | +/* These are Linux-specific. */ | |
31 | +#ifdef __USE_MISC | |
32 | +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ | |
33 | +# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ | |
34 | +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ | |
35 | +# define MAP_LOCKED 0x02000 /* Lock the mapping. */ | |
36 | +# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ | |
37 | +# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ | |
38 | +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ | |
39 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
40 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
41 | +#endif | |
42 | + | |
43 | +/* Include generic Linux declarations. */ | |
44 | +#include <bits/mman-linux.h> |
@@ -1,4 +1,40 @@ | ||
1 | +/* Definitions for POSIX memory map interface. Linux/ia64 version. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
3 | + | |
4 | + The GNU C Library is free software; you can redistribute it and/or | |
5 | + modify it under the terms of the GNU Lesser General Public | |
6 | + License as published by the Free Software Foundation; either | |
7 | + version 2.1 of the License, or (at your option) any later version. | |
8 | + | |
9 | + The GNU C Library is distributed in the hope that it will be useful, | |
10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | + Lesser General Public License for more details. | |
13 | + | |
14 | + You should have received a copy of the GNU Lesser General Public | |
15 | + License along with the GNU C Library; if not, see | |
16 | + <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#ifndef _SYS_MMAN_H | |
19 | +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." | |
20 | +#endif | |
21 | + | |
22 | +/* The following definitions basically come from the kernel headers. | |
23 | + But the kernel header is not namespace clean. */ | |
24 | + | |
25 | +/* These are Linux-specific. */ | |
1 | 26 | #ifdef __USE_MISC |
27 | +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ | |
2 | 28 | # define MAP_GROWSUP 0x00200 /* Register stack-like segment */ |
29 | +# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ | |
30 | +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ | |
31 | +# define MAP_LOCKED 0x02000 /* Lock the mapping. */ | |
32 | +# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ | |
33 | +# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ | |
34 | +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ | |
35 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
36 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
3 | 37 | #endif |
4 | -#include <bits/mman-common.h> | |
38 | + | |
39 | +/* Include generic Linux declarations. */ | |
40 | +#include <bits/mman-linux.h> |
@@ -0,0 +1,40 @@ | ||
1 | +/* Definitions for POSIX memory map interface. Linux/m68k version. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
3 | + | |
4 | + The GNU C Library is free software; you can redistribute it and/or | |
5 | + modify it under the terms of the GNU Lesser General Public | |
6 | + License as published by the Free Software Foundation; either | |
7 | + version 2.1 of the License, or (at your option) any later version. | |
8 | + | |
9 | + The GNU C Library is distributed in the hope that it will be useful, | |
10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | + Lesser General Public License for more details. | |
13 | + | |
14 | + You should have received a copy of the GNU Lesser General Public | |
15 | + License along with the GNU C Library. If not, see | |
16 | + <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#ifndef _SYS_MMAN_H | |
19 | +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." | |
20 | +#endif | |
21 | + | |
22 | +/* The following definitions basically come from the kernel headers. | |
23 | + But the kernel header is not namespace clean. */ | |
24 | + | |
25 | +/* These are Linux-specific. */ | |
26 | +#ifdef __USE_MISC | |
27 | +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ | |
28 | +# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ | |
29 | +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ | |
30 | +# define MAP_LOCKED 0x02000 /* Lock the mapping. */ | |
31 | +# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ | |
32 | +# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ | |
33 | +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ | |
34 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
35 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
36 | +# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could - be uninitialized. */ | |
37 | +#endif | |
38 | + | |
39 | +/* Include generic Linux declarations. */ | |
40 | +#include <bits/mman-linux.h> |
@@ -0,0 +1,39 @@ | ||
1 | +/* Definitions for POSIX memory map interface. Linux/MicroBlaze version. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
3 | + | |
4 | + The GNU C Library is free software; you can redistribute it and/or | |
5 | + modify it under the terms of the GNU Lesser General Public License as | |
6 | + published by the Free Software Foundation; either version 2.1 of the | |
7 | + License, or (at your option) any later version. | |
8 | + | |
9 | + The GNU C Library is distributed in the hope that it will be useful, | |
10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | + Lesser General Public License for more details. | |
13 | + | |
14 | + You should have received a copy of the GNU Lesser General Public | |
15 | + License along with the GNU C Library; if not, see | |
16 | + <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#ifndef _SYS_MMAN_H | |
19 | +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." | |
20 | +#endif | |
21 | + | |
22 | +/* The following definitions basically come from the kernel headers. | |
23 | + But the kernel header is not namespace clean. */ | |
24 | + | |
25 | +#ifdef __USE_MISC | |
26 | +/* These are Linux-specific. */ | |
27 | +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ | |
28 | +# define MAP_DENYWRITE 0x00800 /* ETXTBSY. */ | |
29 | +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ | |
30 | +# define MAP_LOCKED 0x02000 /* Lock the mapping. */ | |
31 | +# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ | |
32 | +# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ | |
33 | +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ | |
34 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
35 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
36 | +#endif | |
37 | + | |
38 | +/* Include generic Linux declarations. */ | |
39 | +#include <bits/mman-linux.h> |
@@ -1,7 +1,5 @@ | ||
1 | 1 | /* Definitions for POSIX memory map interface. Linux/MIPS version. |
2 | - Copyright (C) 1997, 2000, 2003, 2004, 2005, 2006 | |
3 | - Free Software Foundation, Inc. | |
4 | - This file is part of the GNU C Library. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
5 | 3 | |
6 | 4 | The GNU C Library is free software; you can redistribute it and/or |
7 | 5 | modify it under the terms of the GNU Lesser General Public |
@@ -14,7 +12,7 @@ | ||
14 | 12 | Lesser General Public License for more details. |
15 | 13 | |
16 | 14 | You should have received a copy of the GNU Lesser General Public |
17 | - License along with the GNU C Library; if not, see | |
15 | + License along with the GNU C Library. If not, see | |
18 | 16 | <http://www.gnu.org/licenses/>. */ |
19 | 17 | |
20 | 18 | #ifndef _SYS_MMAN_H |
@@ -24,84 +22,24 @@ | ||
24 | 22 | /* The following definitions basically come from the kernel headers. |
25 | 23 | But the kernel header is not namespace clean. */ |
26 | 24 | |
27 | - | |
28 | -/* Protections are chosen from these bits, OR'd together. The | |
29 | - implementation does not necessarily support PROT_EXEC or PROT_WRITE | |
30 | - without PROT_READ. The only guarantees are that no writing will be | |
31 | - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ | |
32 | - | |
33 | -#define PROT_READ 0x1 /* Page can be read. */ | |
34 | -#define PROT_WRITE 0x2 /* Page can be written. */ | |
35 | -#define PROT_EXEC 0x4 /* Page can be executed. */ | |
36 | -#define PROT_NONE 0x0 /* Page can not be accessed. */ | |
37 | -#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of | |
38 | - growsdown vma (mprotect only). */ | |
39 | -#define PROT_GROWSUP 0x02000000 /* Extend change to start of | |
40 | - growsup vma (mprotect only). */ | |
41 | - | |
42 | -/* Sharing types (must choose one and only one of these). */ | |
43 | -#define MAP_SHARED 0x01 /* Share changes. */ | |
44 | -#define MAP_PRIVATE 0x02 /* Changes are private. */ | |
45 | -#ifdef __USE_MISC | |
46 | -# define MAP_TYPE 0x0f /* Mask for type of mapping. */ | |
47 | -#endif | |
48 | - | |
49 | -/* Other flags. */ | |
50 | -#define MAP_FIXED 0x10 /* Interpret addr exactly. */ | |
51 | -#ifdef __USE_MISC | |
52 | -# define MAP_FILE 0 | |
53 | -# define MAP_ANONYMOUS 0x0800 /* Don't use a file. */ | |
54 | -# define MAP_ANON MAP_ANONYMOUS | |
55 | -# define MAP_RENAME MAP_ANONYMOUS | |
56 | -#endif | |
57 | - | |
58 | 25 | /* These are Linux-specific. */ |
59 | 26 | #ifdef __USE_MISC |
60 | 27 | # define MAP_NORESERVE 0x0400 /* don't check for reservations */ |
61 | -# define MAP_ANONYMOUS 0x0800 /* don't use a file */ | |
62 | 28 | # define MAP_GROWSDOWN 0x1000 /* stack-like segment */ |
63 | 29 | # define MAP_DENYWRITE 0x2000 /* ETXTBSY */ |
64 | 30 | # define MAP_EXECUTABLE 0x4000 /* mark it as an executable */ |
65 | 31 | # define MAP_LOCKED 0x8000 /* pages are locked */ |
66 | 32 | # define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ |
67 | 33 | # define MAP_NONBLOCK 0x20000 /* do not block on IO */ |
68 | -# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could | |
69 | - be uninitialized. */ | |
34 | +# define MAP_STACK 0x40000 /* Allocation is for a stack. */ | |
35 | +# define MAP_HUGETLB 0x80000 /* Create huge page mapping. */ | |
70 | 36 | #endif |
71 | 37 | |
72 | -/* Flags to `msync'. */ | |
73 | -#define MS_ASYNC 1 /* Sync memory asynchronously. */ | |
74 | -#define MS_SYNC 4 /* Synchronous memory sync. */ | |
75 | -#define MS_INVALIDATE 2 /* Invalidate the caches. */ | |
76 | - | |
77 | -/* Flags for `mlockall'. */ | |
78 | -#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ | |
79 | -#define MCL_FUTURE 2 /* Lock all additions to address | |
80 | - space. */ | |
81 | - | |
82 | -/* Flags for `mremap'. */ | |
83 | -#ifdef __USE_GNU | |
84 | -# define MREMAP_MAYMOVE 1 | |
85 | -# define MREMAP_FIXED 2 | |
86 | -#endif | |
38 | +#define __MAP_ANONYMOUS 0x0800 | |
87 | 39 | |
88 | -/* Advice to `madvise'. */ | |
89 | -#ifdef __USE_BSD | |
90 | -# define MADV_NORMAL 0 /* No further special treatment. */ | |
91 | -# define MADV_RANDOM 1 /* Expect random page references. */ | |
92 | -# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
93 | -# define MADV_WILLNEED 3 /* Will need these pages. */ | |
94 | -# define MADV_DONTNEED 4 /* Don't need these pages. */ | |
95 | -# define MADV_REMOVE 9 /* Remove these pages and resources. */ | |
96 | -# define MADV_DONTFORK 10 /* Do not inherit across fork. */ | |
97 | -# define MADV_DOFORK 11 /* Do inherit across fork. */ | |
98 | -#endif | |
40 | +/* Include generic Linux declarations. */ | |
41 | +#include <bits/mman-linux.h> | |
99 | 42 | |
100 | -/* The POSIX people had to invent similar names for the same things. */ | |
101 | -#ifdef __USE_XOPEN2K | |
102 | -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ | |
103 | -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ | |
104 | -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
105 | -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ | |
106 | -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ | |
43 | +#ifdef __USE_MISC | |
44 | +# define MAP_RENAME MAP_ANONYMOUS | |
107 | 45 | #endif |
@@ -4,7 +4,7 @@ | ||
4 | 4 | */ |
5 | 5 | |
6 | 6 | /* Definitions for POSIX memory map interface. Linux/NDS32 version. |
7 | - Copyright (C) 1997, 2000, 2003, 2004 Free Software Foundation, Inc. | |
7 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
8 | 8 | |
9 | 9 | The GNU C Library is free software; you can redistribute it and/or |
10 | 10 | modify it under the terms of the GNU Lesser General Public |
@@ -28,37 +28,6 @@ | ||
28 | 28 | /* The following definitions basically come from the kernel headers. |
29 | 29 | But the kernel header is not namespace clean. */ |
30 | 30 | |
31 | - | |
32 | -/* Protections are chosen from these bits, OR'd together. The | |
33 | - implementation does not necessarily support PROT_EXEC or PROT_WRITE | |
34 | - without PROT_READ. The only guarantees are that no writing will be | |
35 | - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ | |
36 | - | |
37 | -#define PROT_READ 0x1 /* Page can be read. */ | |
38 | -#define PROT_WRITE 0x2 /* Page can be written. */ | |
39 | -#define PROT_EXEC 0x4 /* Page can be executed. */ | |
40 | -#define PROT_NONE 0x0 /* Page can not be accessed. */ | |
41 | -#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of | |
42 | - growsdown vma (mprotect only). */ | |
43 | -#define PROT_GROWSUP 0x02000000 /* Extend change to start of | |
44 | - growsup vma (mprotect only). */ | |
45 | - | |
46 | -/* Sharing types (must choose one and only one of these). */ | |
47 | -#define MAP_SHARED 0x01 /* Share changes. */ | |
48 | -#define MAP_PRIVATE 0x02 /* Changes are private. */ | |
49 | -#ifdef __USE_MISC | |
50 | -# define MAP_TYPE 0x0f /* Mask for type of mapping. */ | |
51 | -#endif | |
52 | - | |
53 | -/* Other flags. */ | |
54 | -#define MAP_FIXED 0x10 /* Interpret addr exactly. */ | |
55 | -#ifdef __USE_MISC | |
56 | -# define MAP_FILE 0x00 | |
57 | -# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ | |
58 | -# define MAP_ANON MAP_ANONYMOUS | |
59 | -# define MAP_RENAME MAP_ANONYMOUS | |
60 | -#endif | |
61 | - | |
62 | 31 | /* These are Linux-specific. */ |
63 | 32 | #ifdef __USE_MISC |
64 | 33 | # define MAP_GROWSDOWN 0x0100 /* stack-like segment */ |
@@ -68,40 +37,9 @@ | ||
68 | 37 | # define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
69 | 38 | # define MAP_POPULATE 0x08000 /* populate (prefault) pagetables */ |
70 | 39 | # define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
71 | -# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could | |
72 | - be uninitialized. */ | |
73 | -#endif | |
74 | - | |
75 | -/* Flags to `msync'. */ | |
76 | -#define MS_ASYNC 1 /* Sync memory asynchronously. */ | |
77 | -#define MS_INVALIDATE 2 /* Invalidate the caches. */ | |
78 | -#define MS_SYNC 4 /* Synchronous memory sync. */ | |
79 | - | |
80 | -/* Flags for `mlockall'. */ | |
81 | -#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ | |
82 | -#define MCL_FUTURE 2 /* Lock all additions to address | |
83 | - space. */ | |
84 | - | |
85 | -/* Advice to `madvise'. */ | |
86 | -#ifdef __USE_BSD | |
87 | -#define MADV_NORMAL 0 /* default page-in behavior */ | |
88 | -#define MADV_RANDOM 1 /* page-in minimum required */ | |
89 | -#define MADV_SEQUENTIAL 2 /* read-ahead aggressively */ | |
90 | -#define MADV_WILLNEED 3 /* pre-fault pages */ | |
91 | -#define MADV_DONTNEED 4 /* discard these pages */ | |
92 | -#endif | |
93 | - | |
94 | -/* The POSIX people had to invent similar names for the same things. */ | |
95 | -#ifdef __USE_XOPEN2K | |
96 | -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ | |
97 | -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ | |
98 | -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
99 | -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ | |
100 | -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ | |
40 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
41 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
101 | 42 | #endif |
102 | 43 | |
103 | -/* Flags for `mremap'. */ | |
104 | -#ifdef __USE_GNU | |
105 | -# define MREMAP_MAYMOVE 1 | |
106 | -# define MREMAP_FIXED 2 | |
107 | -#endif | |
44 | +/* Include generic Linux declarations. */ | |
45 | +#include <bits/mman-linux.h> |
@@ -0,0 +1,39 @@ | ||
1 | +/* Definitions for POSIX memory map interface. Linux/Nios II version. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
3 | + | |
4 | + The GNU C Library is free software; you can redistribute it and/or | |
5 | + modify it under the terms of the GNU Lesser General Public | |
6 | + License as published by the Free Software Foundation; either | |
7 | + version 2.1 of the License, or (at your option) any later version. | |
8 | + | |
9 | + The GNU C Library is distributed in the hope that it will be useful, | |
10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | + Lesser General Public License for more details. | |
13 | + | |
14 | + You should have received a copy of the GNU Lesser General Public | |
15 | + License along with the GNU C Library. If not, see | |
16 | + <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#ifndef _SYS_MMAN_H | |
19 | +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." | |
20 | +#endif | |
21 | + | |
22 | +/* The following definitions basically come from the kernel headers. | |
23 | + But the kernel header is not namespace clean. */ | |
24 | + | |
25 | +/* These are Linux-specific. */ | |
26 | +#ifdef __USE_MISC | |
27 | +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ | |
28 | +# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ | |
29 | +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ | |
30 | +# define MAP_LOCKED 0x02000 /* Lock the mapping. */ | |
31 | +# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ | |
32 | +# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ | |
33 | +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ | |
34 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
35 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
36 | +#endif | |
37 | + | |
38 | +/* Include generic Linux declarations. */ | |
39 | +#include <bits/mman-linux.h> |
@@ -1,6 +1,5 @@ | ||
1 | 1 | /* Definitions for POSIX memory map interface. Linux/PowerPC version. |
2 | - Copyright (C) 1997, 2000, 2003, 2005, 2006 Free Software Foundation, Inc. | |
3 | - This file is part of the GNU C Library. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
4 | 3 | |
5 | 4 | The GNU C Library is free software; you can redistribute it and/or |
6 | 5 | modify it under the terms of the GNU Lesser General Public |
@@ -17,41 +16,13 @@ | ||
17 | 16 | <http://www.gnu.org/licenses/>. */ |
18 | 17 | |
19 | 18 | #ifndef _SYS_MMAN_H |
20 | -# error "Never use <bits/mman.h> directly; iclude <sys/mman.h> instead." | |
19 | +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." | |
21 | 20 | #endif |
22 | 21 | |
23 | 22 | /* The following definitions basically come from the kernel headers. |
24 | 23 | But the kernel header is not namespace clean. */ |
25 | 24 | |
26 | - | |
27 | -/* Protections are chosen from these bits, OR'd together. The | |
28 | - implementation does not necessarily support PROT_EXEC or PROT_WRITE | |
29 | - without PROT_READ. The only guarantees are that no writing will be | |
30 | - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ | |
31 | - | |
32 | -#define PROT_READ 0x1 /* Page can be read. */ | |
33 | -#define PROT_WRITE 0x2 /* Page can be written. */ | |
34 | -#define PROT_EXEC 0x4 /* Page can be executed. */ | |
35 | -#define PROT_NONE 0x0 /* Page can not be accessed. */ | |
36 | -#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of | |
37 | - growsdown vma (mprotect only). */ | |
38 | -#define PROT_GROWSUP 0x02000000 /* Extend change to start of | |
39 | - growsup vma (mprotect only). */ | |
40 | - | |
41 | -/* Sharing types (must choose one and only one of these). */ | |
42 | -#define MAP_SHARED 0x001 /* Share changes. */ | |
43 | -#define MAP_PRIVATE 0x002 /* Changes are private. */ | |
44 | -#ifdef __USE_MISC | |
45 | -# define MAP_TYPE 0x00f /* Mask for type of mapping. */ | |
46 | -#endif | |
47 | - | |
48 | -/* Other flags. */ | |
49 | -#define MAP_FIXED 0x010 /* Interpret addr exactly. */ | |
50 | -#ifdef __USE_MISC | |
51 | -# define MAP_FILE 0x000 | |
52 | -# define MAP_ANONYMOUS 0x020 /* Don't use a file. */ | |
53 | -# define MAP_ANON MAP_ANONYMOUS | |
54 | -#endif | |
25 | +#define PROT_SAO 0x10 /* Strong Access Ordering. */ | |
55 | 26 | |
56 | 27 | /* These are Linux-specific. */ |
57 | 28 | #ifdef __USE_MISC |
@@ -62,44 +33,16 @@ | ||
62 | 33 | # define MAP_NORESERVE 0x00040 /* Don't check for reservations. */ |
63 | 34 | # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ |
64 | 35 | # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ |
65 | -# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could | |
66 | - be uninitialized. */ | |
36 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
37 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
67 | 38 | #endif |
68 | 39 | |
69 | -/* Flags to `msync'. */ | |
70 | -#define MS_ASYNC 1 /* Sync memory asynchronously. */ | |
71 | -#define MS_SYNC 4 /* Synchronous memory sync. */ | |
72 | -#define MS_INVALIDATE 2 /* Invalidate the caches. */ | |
73 | - | |
74 | 40 | /* Flags for `mlockall'. */ |
75 | 41 | #define MCL_CURRENT 0x2000 /* Lock all currently mapped pages. */ |
76 | 42 | #define MCL_FUTURE 0x4000 /* Lock all additions to address |
77 | 43 | space. */ |
44 | +#define MCL_ONFAULT 0x8000 /* Lock all pages that are | |
45 | + faulted in. */ | |
78 | 46 | |
79 | - | |
80 | -/* Flags for `mremap'. */ | |
81 | -#ifdef __USE_GNU | |
82 | -# define MREMAP_MAYMOVE 1 | |
83 | -# define MREMAP_FIXED 2 | |
84 | -#endif | |
85 | - | |
86 | -/* Advice to `madvise'. */ | |
87 | -#ifdef __USE_BSD | |
88 | -# define MADV_NORMAL 0 /* No further special treatment. */ | |
89 | -# define MADV_RANDOM 1 /* Expect random page references. */ | |
90 | -# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
91 | -# define MADV_WILLNEED 3 /* Will need these pages. */ | |
92 | -# define MADV_DONTNEED 4 /* Don't need these pages. */ | |
93 | -# define MADV_REMOVE 9 /* Remove these pages and resources. */ | |
94 | -# define MADV_DONTFORK 10 /* Do not inherit across fork. */ | |
95 | -# define MADV_DOFORK 11 /* Do inherit across fork. */ | |
96 | -#endif | |
97 | - | |
98 | -/* The POSIX people had to invent similar names for the same things. */ | |
99 | -#ifdef __USE_XOPEN2K | |
100 | -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ | |
101 | -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ | |
102 | -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
103 | -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ | |
104 | -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ | |
105 | -#endif | |
47 | +/* Include generic Linux declarations. */ | |
48 | +#include <bits/mman-linux.h> |
@@ -0,0 +1,40 @@ | ||
1 | +/* Definitions for POSIX memory map interface. Linux/SH version. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
3 | + | |
4 | + The GNU C Library is free software; you can redistribute it and/or | |
5 | + modify it under the terms of the GNU Lesser General Public | |
6 | + License as published by the Free Software Foundation; either | |
7 | + version 2.1 of the License, or (at your option) any later version. | |
8 | + | |
9 | + The GNU C Library is distributed in the hope that it will be useful, | |
10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | + Lesser General Public License for more details. | |
13 | + | |
14 | + You should have received a copy of the GNU Lesser General Public | |
15 | + License along with the GNU C Library; if not, see | |
16 | + <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#ifndef _SYS_MMAN_H | |
19 | +# error "Never include this file directly. Use <sys/mman.h> instead" | |
20 | +#endif | |
21 | + | |
22 | +/* The following definitions basically come from the kernel headers. | |
23 | + But the kernel header is not namespace clean. */ | |
24 | + | |
25 | +/* These are Linux-specific. */ | |
26 | +#ifdef __USE_MISC | |
27 | +# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */ | |
28 | +# define MAP_DENYWRITE 0x0800 /* ETXTBSY */ | |
29 | +# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */ | |
30 | +# define MAP_LOCKED 0x2000 /* Lock the mapping. */ | |
31 | +# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */ | |
32 | +# define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */ | |
33 | +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ | |
34 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
35 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
36 | +# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could - be uninitialized. */ | |
37 | +#endif | |
38 | + | |
39 | +/* Include generic Linux declarations. */ | |
40 | +#include <bits/mman-linux.h> |
@@ -1,6 +1,5 @@ | ||
1 | 1 | /* Definitions for POSIX memory map interface. Linux/SPARC version. |
2 | - Copyright (C) 1997,1999,2000,2003,2005,2006 Free Software Foundation, Inc. | |
3 | - This file is part of the GNU C Library. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
4 | 3 | |
5 | 4 | The GNU C Library is free software; you can redistribute it and/or |
6 | 5 | modify it under the terms of the GNU Lesser General Public |
@@ -24,36 +23,6 @@ | ||
24 | 23 | But the kernel header is not namespace clean. */ |
25 | 24 | |
26 | 25 | |
27 | -/* Protections are chosen from these bits, OR'd together. The | |
28 | - implementation does not necessarily support PROT_EXEC or PROT_WRITE | |
29 | - without PROT_READ. The only guarantees are that no writing will be | |
30 | - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ | |
31 | - | |
32 | -#define PROT_READ 0x1 /* Page can be read. */ | |
33 | -#define PROT_WRITE 0x2 /* Page can be written. */ | |
34 | -#define PROT_EXEC 0x4 /* Page can be executed. */ | |
35 | -#define PROT_NONE 0x0 /* Page can not be accessed. */ | |
36 | -#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of | |
37 | - growsdown vma (mprotect only). */ | |
38 | -#define PROT_GROWSUP 0x02000000 /* Extend change to start of | |
39 | - growsup vma (mprotect only). */ | |
40 | - | |
41 | -/* Sharing types (must choose one and only one of these). */ | |
42 | -#define MAP_SHARED 0x01 /* Share changes. */ | |
43 | -#define MAP_PRIVATE 0x02 /* Changes are private. */ | |
44 | -#ifdef __USE_MISC | |
45 | -# define MAP_TYPE 0x0f /* Mask for type of mapping. */ | |
46 | -#endif | |
47 | - | |
48 | -/* Other flags. */ | |
49 | -#define MAP_FIXED 0x10 /* Interpret addr exactly. */ | |
50 | -#ifdef __USE_MISC | |
51 | -# define MAP_FILE 0x00 | |
52 | -# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ | |
53 | -# define MAP_ANON MAP_ANONYMOUS | |
54 | -# define MAP_RENAME MAP_ANONYMOUS | |
55 | -#endif | |
56 | - | |
57 | 26 | /* These are Linux-specific. */ |
58 | 27 | #ifdef __USE_MISC |
59 | 28 | # define MAP_GROWSDOWN 0x0200 /* Stack-like segment. */ |
@@ -64,44 +33,20 @@ | ||
64 | 33 | # define _MAP_NEW 0x80000000 /* Binary compatibility with SunOS. */ |
65 | 34 | # define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */ |
66 | 35 | # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ |
67 | -# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could | |
68 | - be uninitialized. */ | |
36 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
37 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
69 | 38 | #endif |
70 | 39 | |
71 | -/* Flags to `msync'. */ | |
72 | -#define MS_ASYNC 1 /* Sync memory asynchronously. */ | |
73 | -#define MS_SYNC 4 /* Synchronous memory sync. */ | |
74 | -#define MS_INVALIDATE 2 /* Invalidate the caches. */ | |
75 | - | |
76 | 40 | /* Flags for `mlockall'. */ |
77 | 41 | #define MCL_CURRENT 0x2000 /* Lock all currently mapped pages. */ |
78 | 42 | #define MCL_FUTURE 0x4000 /* Lock all additions to address |
79 | 43 | space. */ |
44 | +#define MCL_ONFAULT 0x8000 /* Lock all pages that are | |
45 | + faulted in. */ | |
46 | +/* Include generic Linux declarations. */ | |
47 | +#include <bits/mman-linux.h> | |
80 | 48 | |
81 | -/* Flags for `mremap'. */ | |
82 | -#ifdef __USE_GNU | |
83 | -# define MREMAP_MAYMOVE 1 | |
84 | -# define MREMAP_FIXED 2 | |
85 | -#endif | |
86 | - | |
87 | -/* Advice to `madvise'. */ | |
88 | -#ifdef __USE_BSD | |
89 | -# define MADV_NORMAL 0 /* No further special treatment. */ | |
90 | -# define MADV_RANDOM 1 /* Expect random page references. */ | |
91 | -# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
92 | -# define MADV_WILLNEED 3 /* Will need these pages. */ | |
93 | -# define MADV_DONTNEED 4 /* Don't need these pages. */ | |
94 | -# define MADV_FREE 5 /* Content can be freed (Solaris). */ | |
95 | -# define MADV_REMOVE 9 /* Remove these pages and resources. */ | |
96 | -# define MADV_DONTFORK 10 /* Do not inherit across fork. */ | |
97 | -# define MADV_DOFORK 11 /* Do inherit across fork. */ | |
98 | -#endif | |
99 | - | |
100 | -/* The POSIX people had to invent similar names for the same things. */ | |
101 | -#ifdef __USE_XOPEN2K | |
102 | -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ | |
103 | -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ | |
104 | -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
105 | -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ | |
106 | -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ | |
49 | +/* Other flags. */ | |
50 | +#ifdef __USE_MISC | |
51 | +# define MAP_RENAME MAP_ANONYMOUS | |
107 | 52 | #endif |
@@ -1,5 +1,5 @@ | ||
1 | -/* Definitions for POSIX memory map interface. Linux/SPARC version. | |
2 | - Copyright (C) 1997,1999,2000,2003,2005,2006 Free Software Foundation, Inc. | |
1 | +/* Definitions for POSIX memory map interface. Linux/SPARC64 version. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
3 | 3 | |
4 | 4 | The GNU C Library is free software; you can redistribute it and/or |
5 | 5 | modify it under the terms of the GNU Lesser General Public |
@@ -23,36 +23,6 @@ | ||
23 | 23 | But the kernel header is not namespace clean. */ |
24 | 24 | |
25 | 25 | |
26 | -/* Protections are chosen from these bits, OR'd together. The | |
27 | - implementation does not necessarily support PROT_EXEC or PROT_WRITE | |
28 | - without PROT_READ. The only guarantees are that no writing will be | |
29 | - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ | |
30 | - | |
31 | -#define PROT_READ 0x1 /* Page can be read. */ | |
32 | -#define PROT_WRITE 0x2 /* Page can be written. */ | |
33 | -#define PROT_EXEC 0x4 /* Page can be executed. */ | |
34 | -#define PROT_NONE 0x0 /* Page can not be accessed. */ | |
35 | -#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of | |
36 | - growsdown vma (mprotect only). */ | |
37 | -#define PROT_GROWSUP 0x02000000 /* Extend change to start of | |
38 | - growsup vma (mprotect only). */ | |
39 | - | |
40 | -/* Sharing types (must choose one and only one of these). */ | |
41 | -#define MAP_SHARED 0x01 /* Share changes. */ | |
42 | -#define MAP_PRIVATE 0x02 /* Changes are private. */ | |
43 | -#ifdef __USE_MISC | |
44 | -# define MAP_TYPE 0x0f /* Mask for type of mapping. */ | |
45 | -#endif | |
46 | - | |
47 | -/* Other flags. */ | |
48 | -#define MAP_FIXED 0x10 /* Interpret addr exactly. */ | |
49 | -#ifdef __USE_MISC | |
50 | -# define MAP_FILE 0x00 | |
51 | -# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ | |
52 | -# define MAP_ANON MAP_ANONYMOUS | |
53 | -# define MAP_RENAME MAP_ANONYMOUS | |
54 | -#endif | |
55 | - | |
56 | 26 | /* These are Linux-specific. */ |
57 | 27 | #ifdef __USE_MISC |
58 | 28 | # define MAP_GROWSDOWN 0x0200 /* Stack-like segment. */ |
@@ -63,44 +33,20 @@ | ||
63 | 33 | # define _MAP_NEW 0x80000000 /* Binary compatibility with SunOS. */ |
64 | 34 | # define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */ |
65 | 35 | # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ |
66 | -# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could | |
67 | - be uninitialized. */ | |
36 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
37 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
68 | 38 | #endif |
69 | 39 | |
70 | -/* Flags to `msync'. */ | |
71 | -#define MS_ASYNC 1 /* Sync memory asynchronously. */ | |
72 | -#define MS_SYNC 4 /* Synchronous memory sync. */ | |
73 | -#define MS_INVALIDATE 2 /* Invalidate the caches. */ | |
74 | - | |
75 | 40 | /* Flags for `mlockall'. */ |
76 | 41 | #define MCL_CURRENT 0x2000 /* Lock all currently mapped pages. */ |
77 | 42 | #define MCL_FUTURE 0x4000 /* Lock all additions to address |
78 | 43 | space. */ |
44 | +#define MCL_ONFAULT 0x8000 /* Lock all pages that are | |
45 | + faulted in. */ | |
46 | +/* Include generic Linux declarations. */ | |
47 | +#include <bits/mman-linux.h> | |
79 | 48 | |
80 | -/* Flags for `mremap'. */ | |
81 | -#ifdef __USE_GNU | |
82 | -# define MREMAP_MAYMOVE 1 | |
83 | -# define MREMAP_FIXED 2 | |
84 | -#endif | |
85 | - | |
86 | -/* Advice to `madvise'. */ | |
87 | -#ifdef __USE_BSD | |
88 | -# define MADV_NORMAL 0 /* No further special treatment. */ | |
89 | -# define MADV_RANDOM 1 /* Expect random page references. */ | |
90 | -# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
91 | -# define MADV_WILLNEED 3 /* Will need these pages. */ | |
92 | -# define MADV_DONTNEED 4 /* Don't need these pages. */ | |
93 | -# define MADV_FREE 5 /* Content can be freed (Solaris). */ | |
94 | -# define MADV_REMOVE 9 /* Remove these pages and resources. */ | |
95 | -# define MADV_DONTFORK 10 /* Do not inherit across fork. */ | |
96 | -# define MADV_DOFORK 11 /* Do inherit across fork. */ | |
97 | -#endif | |
98 | - | |
99 | -/* The POSIX people had to invent similar names for the same things. */ | |
100 | -#ifdef __USE_XOPEN2K | |
101 | -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ | |
102 | -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ | |
103 | -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
104 | -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ | |
105 | -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ | |
49 | +/* Other flags. */ | |
50 | +#ifdef __USE_MISC | |
51 | +# define MAP_RENAME MAP_ANONYMOUS | |
106 | 52 | #endif |
@@ -1,4 +1,44 @@ | ||
1 | +/* Definitions for POSIX memory map interface. Linux/x86_64 version. | |
2 | + Copyright (C) 2001-2018 Free Software Foundation, Inc. | |
3 | + | |
4 | + The GNU C Library is free software; you can redistribute it and/or | |
5 | + modify it under the terms of the GNU Lesser General Public | |
6 | + License as published by the Free Software Foundation; either | |
7 | + version 2.1 of the License, or (at your option) any later version. | |
8 | + | |
9 | + The GNU C Library is distributed in the hope that it will be useful, | |
10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | + Lesser General Public License for more details. | |
13 | + | |
14 | + You should have received a copy of the GNU Lesser General Public | |
15 | + License along with the GNU C Library; if not, see | |
16 | + <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#ifndef _SYS_MMAN_H | |
19 | +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." | |
20 | +#endif | |
21 | + | |
22 | +/* The following definitions basically come from the kernel headers. | |
23 | + But the kernel header is not namespace clean. */ | |
24 | + | |
25 | +/* Other flags. */ | |
1 | 26 | #ifdef __USE_MISC |
2 | 27 | # define MAP_32BIT 0x40 /* Only give out 32-bit addresses. */ |
3 | 28 | #endif |
4 | -#include <bits/mman-common.h> | |
29 | + | |
30 | +/* These are Linux-specific. */ | |
31 | +#ifdef __USE_MISC | |
32 | +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ | |
33 | +# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ | |
34 | +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ | |
35 | +# define MAP_LOCKED 0x02000 /* Lock the mapping. */ | |
36 | +# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ | |
37 | +# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ | |
38 | +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ | |
39 | +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ | |
40 | +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ | |
41 | +#endif | |
42 | + | |
43 | +/* Include generic Linux declarations. */ | |
44 | +#include <bits/mman-linux.h> |
@@ -1,6 +1,5 @@ | ||
1 | 1 | /* Definitions for POSIX memory map interface. Linux/Xtensa version. |
2 | - Copyright (C) 1997, 2000, 2007 Free Software Foundation, Inc. | |
3 | - This file is part of the GNU C Library. | |
2 | + Copyright (C) 1997-2018 Free Software Foundation, Inc. | |
4 | 3 | |
5 | 4 | The GNU C Library is free software; you can redistribute it and/or |
6 | 5 | modify it under the terms of the GNU Lesser General Public |
@@ -20,86 +19,25 @@ | ||
20 | 19 | # error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." |
21 | 20 | #endif |
22 | 21 | |
23 | -/* The following definitions basically come from the kernel headers. | |
24 | - But the kernel header is not namespace clean. */ | |
25 | - | |
26 | - | |
27 | -/* Protections are chosen from these bits, OR'd together. The | |
28 | - implementation does not necessarily support PROT_EXEC or PROT_WRITE | |
29 | - without PROT_READ. The only guarantees are that no writing will be | |
30 | - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ | |
31 | - | |
32 | -#define PROT_READ 0x1 /* Page can be read. */ | |
33 | -#define PROT_WRITE 0x2 /* Page can be written. */ | |
34 | -#define PROT_EXEC 0x4 /* Page can be executed. */ | |
35 | -#define PROT_NONE 0x0 /* Page can not be accessed. */ | |
36 | -#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of | |
37 | - growsdown vma (mprotect only). */ | |
38 | -#define PROT_GROWSUP 0x02000000 /* Extend change to start of | |
39 | - growsup vma (mprotect only). */ | |
40 | - | |
41 | -/* Sharing types (must choose one and only one of these). */ | |
42 | -#define MAP_SHARED 0x01 /* Share changes. */ | |
43 | -#define MAP_PRIVATE 0x02 /* Changes are private. */ | |
44 | -#ifdef __USE_MISC | |
45 | -# define MAP_TYPE 0x0f /* Mask for type of mapping. */ | |
46 | -#endif | |
47 | - | |
48 | -/* Other flags. */ | |
49 | -#define MAP_FIXED 0x10 /* Interpret addr exactly. */ | |
50 | -#ifdef __USE_MISC | |
51 | -# define MAP_FILE 0 | |
52 | -# define MAP_ANONYMOUS 0x800 /* Don't use a file. */ | |
53 | -# define MAP_ANON MAP_ANONYMOUS | |
54 | -# define MAP_RENAME MAP_ANONYMOUS | |
55 | -#endif | |
56 | - | |
57 | 22 | /* These are Linux-specific. */ |
58 | 23 | #ifdef __USE_MISC |
24 | +# define MAP_NORESERVE 0x0400 /* Don't check for reservations. */ | |
59 | 25 | # define MAP_GROWSDOWN 0x1000 /* Stack-like segment. */ |
60 | -# define MAP_DENYWRITE 0x2000 /* ETXTBSY */ | |
26 | +# define MAP_DENYWRITE 0x2000 /* ETXTBSY */ | |
61 | 27 | # define MAP_EXECUTABLE 0x4000 /* Mark it as an executable. */ |
62 | 28 | # define MAP_LOCKED 0x8000 /* Lock the mapping. */ |
63 | -# define MAP_NORESERVE 0x0400 /* Don't check for reservations. */ | |
64 | 29 | # define MAP_POPULATE 0x10000 /* Populate (prefault) pagetables. */ |
65 | 30 | # define MAP_NONBLOCK 0x20000 /* Do not block on IO. */ |
66 | -# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could | |
67 | - be uninitialized. */ | |
31 | +# define MAP_STACK 0x40000 /* Allocation is for a stack. */ | |
32 | +# define MAP_HUGETLB 0x80000 /* Create huge page mapping. */ | |
33 | +# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could - be uninitialized. */ | |
68 | 34 | #endif |
69 | 35 | |
70 | -/* Flags to `msync'. */ | |
71 | -#define MS_ASYNC 1 /* Sync memory asynchronously. */ | |
72 | -#define MS_SYNC 4 /* Synchronous memory sync. */ | |
73 | -#define MS_INVALIDATE 2 /* Invalidate the caches. */ | |
36 | +#define __MAP_ANONYMOUS 0x0800 /* Don't use a file */ | |
74 | 37 | |
75 | -/* Flags for `mlockall'. */ | |
76 | -#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ | |
77 | -#define MCL_FUTURE 2 /* Lock all additions to address | |
78 | - space. */ | |
79 | - | |
80 | -/* Flags for `mremap'. */ | |
81 | -#ifdef __USE_GNU | |
82 | -# define MREMAP_MAYMOVE 1 | |
83 | -# define MREMAP_FIXED 2 | |
84 | -#endif | |
38 | +/* Include generic Linux declarations. */ | |
39 | +#include <bits/mman-linux.h> | |
85 | 40 | |
86 | -/* Advice to `madvise'. */ | |
87 | -#ifdef __USE_BSD | |
88 | -# define MADV_NORMAL 0 /* No further special treatment. */ | |
89 | -# define MADV_RANDOM 1 /* Expect random page references. */ | |
90 | -# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
91 | -# define MADV_WILLNEED 3 /* Will need these pages. */ | |
92 | -# define MADV_DONTNEED 4 /* Don't need these pages. */ | |
93 | -# define MADV_REMOVE 9 /* Remove these pages and resources. */ | |
94 | -# define MADV_DONTFORK 10 /* Do not inherit across fork. */ | |
95 | -# define MADV_DOFORK 11 /* Do inherit across fork. */ | |
96 | -#endif | |
97 | - | |
98 | -/* The POSIX people had to invent similar names for the same things. */ | |
99 | -#ifdef __USE_XOPEN2K | |
100 | -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ | |
101 | -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ | |
102 | -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
103 | -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ | |
104 | -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ | |
41 | +#ifdef __USE_MISC | |
42 | +# define MAP_RENAME MAP_ANONYMOUS | |
105 | 43 | #endif |