1 /*
2  * Copyright (c) 2024, Tenstorrent AI ULC
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_INCLUDE_ZEPHYR_POSIX_SYS_MMAN_H_
8 #define ZEPHYR_INCLUDE_ZEPHYR_POSIX_SYS_MMAN_H_
9 
10 #include <stddef.h>
11 #include <sys/types.h>
12 
13 #define PROT_NONE  0x0
14 #define PROT_READ  0x1
15 #define PROT_WRITE 0x2
16 #define PROT_EXEC  0x4
17 
18 #define MAP_SHARED  0x1
19 #define MAP_PRIVATE 0x2
20 #define MAP_FIXED   0x4
21 
22 /* for Linux compatibility */
23 #define MAP_ANONYMOUS 0x20
24 
25 #define MS_SYNC       0x0
26 #define MS_ASYNC      0x1
27 #define MS_INVALIDATE 0x2
28 
29 #define MAP_FAILED ((void *)-1)
30 
31 #define MCL_CURRENT 0
32 #define MCL_FUTURE  1
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 int mlock(const void *addr, size_t len);
39 int mlockall(int flags);
40 void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);
41 int msync(void *addr, size_t length, int flags);
42 int munlock(const void *addr, size_t len);
43 int munlockall(void);
44 int munmap(void *addr, size_t len);
45 int shm_open(const char *name, int oflag, mode_t mode);
46 int shm_unlink(const char *name);
47 
48 #ifdef __cplusplus
49 }
50 #endif
51 
52 #endif /* ZEPHYR_INCLUDE_ZEPHYR_POSIX_SYS_MMAN_H_ */
53