1 //===-- Macros defined in sys/mman.h header file --------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_MACROS_SYS_MMAN_MACROS_H
10 #define LLVM_LIBC_MACROS_SYS_MMAN_MACROS_H
12 // Use definitions from <linux/mman.h> to dispatch arch-specific flag values.
13 // For example, MCL_CURRENT/MCL_FUTURE/MCL_ONFAULT are different on different
15 #if __has_include(<linux/mman.h>)
16 #include <linux/mman.h>
18 #error "cannot use <sys/mman.h> without proper system headers."
21 // Some posix standard flags may not be defined in system headers.
24 #define MAP_FAILED ((void *)-1)
27 // Posix memory advise flags. (posix_madvise)
28 #ifndef POSIX_MADV_NORMAL
29 #define POSIX_MADV_NORMAL MADV_NORMAL
32 #ifndef POSIX_MADV_SEQUENTIAL
33 #define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
36 #ifndef POSIX_MADV_RANDOM
37 #define POSIX_MADV_RANDOM MADV_RANDOM
40 #ifndef POSIX_MADV_WILLNEED
41 #define POSIX_MADV_WILLNEED MADV_WILLNEED
44 #ifndef POSIX_MADV_DONTNEED
45 #define POSIX_MADV_DONTNEED MADV_DONTNEED
48 #endif // LLVM_LIBC_MACROS_SYS_MMAN_MACROS_H