[LICM] allow MemoryAccess creation failure (#116813)
[llvm-project.git] / libc / include / llvm-libc-macros / sys-mman-macros.h
bloba6dc6d96b5b79de700b9c66cea698be0dcb304fc
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 //===----------------------------------------------------------------------===//
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
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
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
27 // Posix memory advise flags. (posix_madvise)
28 #ifndef POSIX_MADV_NORMAL
29 #define POSIX_MADV_NORMAL MADV_NORMAL
30 #endif
32 #ifndef POSIX_MADV_SEQUENTIAL
33 #define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
34 #endif
36 #ifndef POSIX_MADV_RANDOM
37 #define POSIX_MADV_RANDOM MADV_RANDOM
38 #endif
40 #ifndef POSIX_MADV_WILLNEED
41 #define POSIX_MADV_WILLNEED MADV_WILLNEED
42 #endif
44 #ifndef POSIX_MADV_DONTNEED
45 #define POSIX_MADV_DONTNEED MADV_DONTNEED
46 #endif
48 #endif // LLVM_LIBC_MACROS_SYS_MMAN_MACROS_H