1 //===-- Macros defined in sys/mman.h header file --------------------------===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIBC_MACROS_SYS_MMAN_MACROS_H 10 #define LLVM_LIBC_MACROS_SYS_MMAN_MACROS_H 11 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 14 // architectures. 15 #if __has_include(<linux/mman.h>) 16 #include <linux/mman.h> 17 #else 18 #error "cannot use <sys/mman.h> without proper system headers." 19 #endif 20 21 // Some posix standard flags may not be defined in system headers. 22 // Posix mmap flags. 23 #ifndef MAP_FAILED 24 #define MAP_FAILED ((void *)-1) 25 #endif 26 27 // Posix memory advise flags. (posix_madvise) 28 #ifndef POSIX_MADV_NORMAL 29 #define POSIX_MADV_NORMAL MADV_NORMAL 30 #endif 31 32 #ifndef POSIX_MADV_SEQUENTIAL 33 #define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL 34 #endif 35 36 #ifndef POSIX_MADV_RANDOM 37 #define POSIX_MADV_RANDOM MADV_RANDOM 38 #endif 39 40 #ifndef POSIX_MADV_WILLNEED 41 #define POSIX_MADV_WILLNEED MADV_WILLNEED 42 #endif 43 44 #ifndef POSIX_MADV_DONTNEED 45 #define POSIX_MADV_DONTNEED MADV_DONTNEED 46 #endif 47 48 #endif // LLVM_LIBC_MACROS_SYS_MMAN_MACROS_H 49