2023-01-13 20:06:27 +00:00
|
|
|
/* sys/mman.h: Memory allocation and deallocation. */
|
|
|
|
|
2023-03-12 14:32:09 +00:00
|
|
|
#ifndef _SYS_MMAN_H
|
|
|
|
#define _SYS_MMAN_H
|
2023-01-13 18:08:02 +00:00
|
|
|
|
|
|
|
#include <bits/mmap-flags.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2023-01-13 18:27:53 +00:00
|
|
|
#define PAGE_SIZE 4096UL
|
2023-01-13 18:08:02 +00:00
|
|
|
|
|
|
|
#define MAP_FAILED (void*)-1
|
|
|
|
|
2023-08-02 20:44:54 +00:00
|
|
|
#define MS_SYNC 1
|
|
|
|
#define MS_ASYNC 2
|
|
|
|
#define MS_INVALIDATE 4
|
|
|
|
|
2023-10-15 11:09:56 +00:00
|
|
|
#define MADV_NORMAL 0
|
|
|
|
#define MADV_RANDOM 1
|
|
|
|
|
2023-01-13 18:08:02 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
2023-03-14 19:43:15 +00:00
|
|
|
/* Map a file into memory. */
|
|
|
|
void* mmap(void* addr, size_t len, int prot, int flags, int fd, off_t offset);
|
|
|
|
|
|
|
|
/* Remove a memory mapping. */
|
|
|
|
int munmap(void* addr, size_t len);
|
2023-01-13 18:08:02 +00:00
|
|
|
|
2023-08-02 20:44:54 +00:00
|
|
|
/* Write modified shared memory back to its associated file. */
|
|
|
|
int msync(void* addr, size_t len, int flags);
|
|
|
|
|
2023-10-15 11:09:56 +00:00
|
|
|
/* Give advice about the use of memory. */
|
|
|
|
int madvise(void* addr, size_t length, int advice);
|
|
|
|
|
2023-08-03 08:32:52 +00:00
|
|
|
/* Create a new POSIX shared memory object. */
|
|
|
|
int shm_open(const char* name, int oflag, mode_t mode);
|
|
|
|
|
|
|
|
/* Delete a POSIX shared memory object from the file system. */
|
|
|
|
int shm_unlink(const char* name);
|
|
|
|
|
2023-01-13 18:08:02 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|