]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/bits/mman-shared.h
1 /* Memory-mapping-related declarations/definitions, not architecture-specific.
2 Copyright (C) 2017-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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 <https://www.gnu.org/licenses/>. */
20 # error "Never use <bits/mman-shared.h> directly; include <sys/mman.h> instead."
24 /* Flags for mremap. */
25 # define MREMAP_MAYMOVE 1
26 # define MREMAP_FIXED 2
28 /* Flags for memfd_create. */
30 # define MFD_CLOEXEC 1U
31 # define MFD_ALLOW_SEALING 2U
32 # define MFD_HUGETLB 4U
35 /* Flags for mlock2. */
36 # ifndef MLOCK_ONFAULT
37 # define MLOCK_ONFAULT 1U
40 /* Access rights for pkey_alloc. */
41 # ifndef PKEY_DISABLE_ACCESS
42 # define PKEY_DISABLE_ACCESS 0x1
43 # define PKEY_DISABLE_WRITE 0x2
48 /* Create a new memory file descriptor. NAME is a name for debugging.
49 FLAGS is a combination of the MFD_* constants. */
50 int memfd_create (const char *__name
, unsigned int __flags
) __THROW
;
52 /* Lock pages from ADDR (inclusive) to ADDR + LENGTH (exclusive) into
53 memory. FLAGS is a combination of the MLOCK_* flags above. */
54 int mlock2 (const void *__addr
, size_t __length
, unsigned int __flags
) __THROW
;
56 /* Allocate a new protection key, with the PKEY_DISABLE_* bits
57 specified in ACCESS_RIGHTS. The protection key mask for the
58 current thread is updated to match the access privilege for the new
60 int pkey_alloc (unsigned int __flags
, unsigned int __access_rights
) __THROW
;
62 /* Update the access rights for the current thread for KEY, which must
63 have been allocated using pkey_alloc. */
64 int pkey_set (int __key
, unsigned int __access_rights
) __THROW
;
66 /* Return the access rights for the current thread for KEY, which must
67 have been allocated using pkey_alloc. */
68 int pkey_get (int __key
) __THROW
;
70 /* Free an allocated protection key, which must have been allocated
72 int pkey_free (int __key
) __THROW
;
74 /* Apply memory protection flags for KEY to the specified address
76 int pkey_mprotect (void *__addr
, size_t __len
, int __prot
, int __pkey
) __THROW
;
80 #endif /* __USE_GNU */