2008-04-14 02:52:11 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2008, Haiku Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _SYS_MMAN_H
|
|
|
|
#define _SYS_MMAN_H
|
|
|
|
|
2008-05-08 17:42:33 +04:00
|
|
|
#include <sys/cdefs.h>
|
2008-04-14 02:52:11 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
|
2008-08-08 05:00:06 +04:00
|
|
|
/* memory protection for mmap() and others; assignment compatible with
|
|
|
|
B_{READ,WRITE,EXECUTE}_AREA */
|
2008-04-14 02:52:11 +04:00
|
|
|
#define PROT_READ 0x01
|
|
|
|
#define PROT_WRITE 0x02
|
|
|
|
#define PROT_EXEC 0x04
|
|
|
|
#define PROT_NONE 0x00
|
|
|
|
|
2008-05-11 01:30:34 +04:00
|
|
|
/* mmap() flags */
|
2008-04-14 02:52:11 +04:00
|
|
|
#define MAP_SHARED 0x01 /* changes are seen by others */
|
|
|
|
#define MAP_PRIVATE 0x02 /* changes are only seen by caller */
|
|
|
|
#define MAP_FIXED 0x04 /* require mapping to specified addr */
|
|
|
|
#define MAP_ANONYMOUS 0x08 /* no underlying object */
|
|
|
|
#define MAP_ANON MAP_ANONYMOUS
|
|
|
|
|
2008-05-11 01:30:34 +04:00
|
|
|
/* mmap() error return code */
|
2008-04-14 02:52:11 +04:00
|
|
|
#define MAP_FAILED ((void*)-1)
|
|
|
|
|
2008-05-23 01:51:12 +04:00
|
|
|
/* msync() flags */
|
|
|
|
#define MS_ASYNC 0x01
|
|
|
|
#define MS_SYNC 0x02
|
|
|
|
#define MS_INVALIDATE 0x04
|
|
|
|
|
2008-08-08 05:00:06 +04:00
|
|
|
/* posix_madvise() values */
|
|
|
|
#define POSIX_MADV_NORMAL 1
|
|
|
|
#define POSIX_MADV_SEQUENTIAL 2
|
|
|
|
#define POSIX_MADV_RANDOM 3
|
|
|
|
#define POSIX_MADV_WILLNEED 4
|
|
|
|
#define POSIX_MADV_DONTNEED 5
|
|
|
|
|
2008-04-14 02:52:11 +04:00
|
|
|
|
2008-05-08 17:42:33 +04:00
|
|
|
__BEGIN_DECLS
|
2008-04-14 02:52:11 +04:00
|
|
|
|
2008-05-08 17:42:33 +04:00
|
|
|
void* mmap(void* address, size_t length, int protection, int flags,
|
|
|
|
int fd, off_t offset);
|
|
|
|
int munmap(void* address, size_t length);
|
2008-04-14 02:52:11 +04:00
|
|
|
|
2008-08-08 05:00:06 +04:00
|
|
|
int mprotect(void* address, size_t length, int protection);
|
2008-05-23 01:51:12 +04:00
|
|
|
int msync(void* address, size_t length, int flags);
|
|
|
|
|
2008-08-08 05:00:06 +04:00
|
|
|
int posix_madvise(void* address, size_t length, int advice);
|
|
|
|
|
2008-05-08 17:42:33 +04:00
|
|
|
int shm_open(const char* name, int openMode, mode_t permissions);
|
|
|
|
int shm_unlink(const char* name);
|
2008-04-14 02:52:11 +04:00
|
|
|
|
2008-05-08 17:42:33 +04:00
|
|
|
__END_DECLS
|
2008-04-14 02:52:11 +04:00
|
|
|
|
|
|
|
|
2008-05-11 01:30:34 +04:00
|
|
|
#endif /* _SYS_MMAN_H */
|