1#ifndef __VSF_LINUX_SYS_MMAN_H__
2#define __VSF_LINUX_SYS_MMAN_H__
6#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
7# include "../sys/types.h"
19#if VSF_LINUX_CFG_WRAPPER == ENABLED
20#define mmap VSF_LINUX_WRAPPER(mmap)
21#define mmap64 VSF_LINUX_WRAPPER(mmap64)
22#define munmap VSF_LINUX_WRAPPER(munmap)
23#define mprotect VSF_LINUX_WRAPPER(mprotect)
27#define PROT_READ VSF_FILE_ATTR_READ
28#define PROT_WRITE VSF_FILE_ATTR_WRITE
29#define PROT_EXEC VSF_FILE_ATTR_EXECUTE
37#define MAP_ANONYMOUS 0x20
38#define MAP_ANON MAP_ANONYMOUS
40#define MAP_FAILED ((void *)-1)
44#define MS_INVALIDATE 4
46#if VSF_LINUX_APPLET_USE_SYS_MMAN == ENABLED
58# ifndef __VSF_APPLET__
63#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_SYS_MMAN_LIB__))\
64 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_SYS_MMAN == ENABLED
66#ifndef VSF_LINUX_APPLET_SYS_MMAN_VPLT
67# if VSF_LINUX_USE_APPLET == ENABLED
68# define VSF_LINUX_APPLET_SYS_MMAN_VPLT \
69 ((vsf_linux_sys_mman_vplt_t *)(VSF_LINUX_APPLET_VPLT->sys_mman_vplt))
71# define VSF_LINUX_APPLET_SYS_MMAN_VPLT \
72 ((vsf_linux_sys_mman_vplt_t *)vsf_vplt((void *)0))
76#define VSF_LINUX_APPLET_SYS_MMAN_ENTRY(__NAME) \
77 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_SYS_MMAN_VPLT, __NAME)
78#define VSF_LINUX_APPLET_SYS_MMAN_IMP(...) \
79 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_SYS_MMAN_VPLT, __VA_ARGS__)
81VSF_LINUX_APPLET_SYS_MMAN_IMP(
shm_open,
int,
const char *name,
int oflag,
mode_t mode) {
83 return VSF_LINUX_APPLET_SYS_MMAN_ENTRY(
shm_open)(name, oflag, mode);
85VSF_LINUX_APPLET_SYS_MMAN_IMP(
shm_unlink,
int,
const char *name) {
87 return VSF_LINUX_APPLET_SYS_MMAN_ENTRY(
shm_unlink)(name);
89VSF_LINUX_APPLET_SYS_MMAN_IMP(
mmap,
void *,
void *addr,
size_t len,
int prot,
int flags,
int fildes,
off_t off) {
91 return VSF_LINUX_APPLET_SYS_MMAN_ENTRY(
mmap)(addr, len, prot, flags, fildes, off);
93VSF_LINUX_APPLET_SYS_MMAN_IMP(
mmap64,
void *,
void *addr,
size_t len,
int prot,
int flags,
int fildes,
off64_t off) {
95 return VSF_LINUX_APPLET_SYS_MMAN_ENTRY(
mmap64)(addr, len, prot, flags, fildes, off);
97VSF_LINUX_APPLET_SYS_MMAN_IMP(
munmap,
int,
void *addr,
size_t len) {
99 return VSF_LINUX_APPLET_SYS_MMAN_ENTRY(
munmap)(addr, len);
101VSF_LINUX_APPLET_SYS_MMAN_IMP(
mprotect,
int,
void *addr,
size_t len,
int prot) {
103 return VSF_LINUX_APPLET_SYS_MMAN_ENTRY(
mprotect)(addr, len, prot);
105VSF_LINUX_APPLET_SYS_MMAN_IMP(
msync,
int,
void *addr,
size_t len,
int flags) {
107 return VSF_LINUX_APPLET_SYS_MMAN_ENTRY(
msync)(addr, len, flags);
115void *
mmap(
void *addr,
size_t len,
int prot,
int flags,
int fildes,
off_t off);
116void *
mmap64(
void *addr,
size_t len,
int prot,
int flags,
int fildes,
off64_t off);
117int munmap(
void *addr,
size_t len);
118int mprotect(
void *addr,
size_t len,
int prot);
119int msync(
void *addr,
size_t len,
int flags);
123static inline int mlock(
const void *addr,
size_t len) {
return 0; }
124static inline int mlock2(
const void *addr,
size_t len,
unsigned int flags) {
return 0; }
125static inline int munlock(
const void *addr,
size_t len) {
return 0; }
126static inline int mlockall(
int flags) {
return 0; }
127static inline int munlockall(
void) {
return 0; }
long long off64_t
Definition types.h:97
unsigned int mode_t
Definition types.h:87
long off_t
Definition types.h:95
int shm_open(const char *name, int oflag, mode_t mode)
Definition vsf_linux.c:3834
int msync(void *addr, size_t len, int flags)
Definition vsf_linux.c:3803
#define mmap
Definition mman.h:20
__VSF_VPLT_DECORATOR__ vsf_linux_sys_mman_vplt_t vsf_linux_sys_mman_vplt
Definition vsf_linux.c:4829
#define munmap
Definition mman.h:22
int shm_unlink(const char *name)
Definition vsf_linux.c:3839
#define mprotect
Definition mman.h:23
#define mmap64
Definition mman.h:21
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(shm_unlink)
vsf_vplt_info_t info
Definition mman.h:48
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(msync)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(munmap)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mmap)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mmap64)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(shm_open)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mprotect)
#define __VSF_VPLT_DECORATOR__
Definition vsf_cfg.h:93
#define VSF_APPLET_VPLT_ENTRY_FUNC_TRACE()
Definition vsf_cfg.h:165