48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
/* sys/mman.h: Memory allocation and deallocation. */
|
|
|
|
#ifndef _SYS_MMAN_H
|
|
#define _SYS_MMAN_H
|
|
|
|
#include <bits/mmap-flags.h>
|
|
#include <sys/types.h>
|
|
|
|
#define PAGE_SIZE 4096UL
|
|
|
|
#define MAP_FAILED (void*)-1
|
|
|
|
#define MS_SYNC 1
|
|
#define MS_ASYNC 2
|
|
#define MS_INVALIDATE 4
|
|
|
|
#define MADV_NORMAL 0
|
|
#define MADV_RANDOM 1
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
/* 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);
|
|
|
|
/* Write modified shared memory back to its associated file. */
|
|
int msync(void* addr, size_t len, int flags);
|
|
|
|
/* Give advice about the use of memory. */
|
|
int madvise(void* addr, size_t length, int advice);
|
|
|
|
/* 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);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|