[PATCH] libc/sysdeps/linux/common/bits/wchar.h: resync with glibc, fix build issue...
[uclibc-ng.git] / libc / sysdeps / linux / common / bits / mman-shared.h
blob98c9e1d3c700335b95ef641d84cedf738e1a444d
1 /* Memory-mapping-related declarations/definitions, not architecture-specific.
2 Copyright (C) 2017-2018 Free Software Foundation, Inc.
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.
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.
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/>. */
18 #ifndef _SYS_MMAN_H
19 # error "Never use <bits/mman-shared.h> directly; include <sys/mman.h> instead."
20 #endif
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
30 /* Flags for mlock2. */
31 # ifndef MLOCK_ONFAULT
32 # define MLOCK_ONFAULT 1U
33 # endif
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
41 __BEGIN_DECLS
43 #if 0
44 /* Create a new memory file descriptor. NAME is a name for debugging.
45 FLAGS is a combination of the MFD_* constants. */
46 int memfd_create (const char *__name, unsigned int __flags) __THROW;
47 #endif
49 /* Lock pages from ADDR (inclusive) to ADDR + LENGTH (exclusive) into
50 memory. FLAGS is a combination of the MLOCK_* flags above. */
51 int mlock2 (const void *__addr, size_t __length, unsigned int __flags) __THROW;
53 /* Allocate a new protection key, with the PKEY_DISABLE_* bits
54 specified in ACCESS_RIGHTS. The protection key mask for the
55 current thread is updated to match the access privilege for the new
56 key. */
57 int pkey_alloc (unsigned int __flags, unsigned int __access_rights) __THROW;
59 /* Update the access rights for the current thread for KEY, which must
60 have been allocated using pkey_alloc. */
61 int pkey_set (int __key, unsigned int __access_rights) __THROW;
63 /* Return the access rights for the current thread for KEY, which must
64 have been allocated using pkey_alloc. */
65 int pkey_get (int _key) __THROW;
67 /* Free an allocated protection key, which must have been allocated
68 using pkey_alloc. */
69 int pkey_free (int __key) __THROW;
71 /* Apply memory protection flags for KEY to the specified address
72 range. */
73 int pkey_mprotect (void *__addr, size_t __len, int __prot, int __pkey) __THROW;
75 __END_DECLS
77 #endif /* __USE_GNU */