x86: In ld.so, diagnose missing APX support in APX-only builds
[glibc.git] / sysdeps / unix / sysv / linux / mmap_internal.h
blobb2c2e2703eb3b8f259cd2d1b08de7ba6379a92e3
1 /* Common mmap definition for Linux implementation.
2 Copyright (C) 2017-2024 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/>. */
19 #ifndef MMAP_INTERNAL_LINUX_H
20 #define MMAP_INTERNAL_LINUX_H 1
22 #include <stdint.h>
24 /* This is the minimum mmap2 unit size accept by the kernel. An architecture
25 with multiple minimum page sizes (such as m68k) might define it as -1 and
26 thus it will queried at runtime. */
27 #ifndef MMAP2_PAGE_UNIT
28 # define MMAP2_PAGE_UNIT 4096ULL
29 #endif
31 #if MMAP2_PAGE_UNIT == -1ULL
32 static uint64_t page_unit;
33 # define MMAP_CHECK_PAGE_UNIT() \
34 if (page_unit == 0) \
35 page_unit = __getpagesize ();
36 # undef MMAP2_PAGE_UNIT
37 # define MMAP2_PAGE_UNIT page_unit
38 #else
39 # define MMAP_CHECK_PAGE_UNIT()
40 #endif
42 /* Do not accept offset not multiple of page size. */
43 #define MMAP_OFF_LOW_MASK (MMAP2_PAGE_UNIT - 1)
45 #include <mmap_call.h>
47 #endif /* MMAP_INTERNAL_LINUX_H */