2012-02-11 19:31:25 +01:00
|
|
|
#ifndef _SYS_MMAN_H_
|
|
|
|
#define _SYS_MMAN_H_
|
2008-11-19 13:26:10 +01:00
|
|
|
|
2012-02-11 19:31:25 +01:00
|
|
|
#include <sys/featuretest.h>
|
2008-11-19 13:26:10 +01:00
|
|
|
|
2012-02-11 19:31:25 +01:00
|
|
|
#include <machine/ansi.h>
|
2012-06-06 00:50:13 +02:00
|
|
|
#include <minix/type.h>
|
2012-02-11 19:31:25 +01:00
|
|
|
|
|
|
|
#ifdef _BSD_SIZE_T_
|
|
|
|
typedef _BSD_SIZE_T_ size_t;
|
|
|
|
#undef _BSD_SIZE_T_
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/ansi.h>
|
|
|
|
|
|
|
|
#ifndef mode_t
|
|
|
|
typedef __mode_t mode_t;
|
|
|
|
#define mode_t __mode_t
|
2008-11-19 13:26:10 +01:00
|
|
|
#endif
|
|
|
|
|
2012-02-11 19:31:25 +01:00
|
|
|
#ifndef off_t
|
|
|
|
typedef __off_t off_t; /* file offset */
|
|
|
|
#define off_t __off_t
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Protections are chosen from these bits, or-ed together
|
|
|
|
*/
|
2008-11-19 13:26:10 +01:00
|
|
|
#define PROT_NONE 0x00 /* no permissions */
|
|
|
|
#define PROT_READ 0x01 /* pages can be read */
|
|
|
|
#define PROT_WRITE 0x02 /* pages can be written */
|
|
|
|
#define PROT_EXEC 0x04 /* pages can be executed */
|
|
|
|
|
2012-02-11 19:31:25 +01:00
|
|
|
/*
|
|
|
|
* Flags contain sharing type and options.
|
|
|
|
* Sharing types; choose one.
|
|
|
|
*/
|
|
|
|
#ifndef __minix
|
|
|
|
#define MAP_SHARED 0x0001 /* share changes */
|
|
|
|
#endif
|
|
|
|
#define MAP_PRIVATE 0x0002 /* changes are private */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mapping type
|
|
|
|
*/
|
|
|
|
#define MAP_ANON 0x0004 /* anonymous memory */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Minix specific flags.
|
|
|
|
*/
|
2008-11-19 13:26:10 +01:00
|
|
|
#define MAP_PREALLOC 0x0008 /* not on-demand */
|
|
|
|
#define MAP_CONTIG 0x0010 /* contiguous in physical memory */
|
|
|
|
#define MAP_LOWER16M 0x0020 /* physically below 16MB */
|
2009-02-12 13:26:08 +01:00
|
|
|
#define MAP_ALIGN64K 0x0040 /* physically aligned at 64kB */
|
2009-09-21 16:23:10 +02:00
|
|
|
#define MAP_LOWER1M 0x0080 /* physically below 16MB */
|
2012-02-11 19:31:25 +01:00
|
|
|
#define MAP_ALIGNMENT_64KB MAP_ALIGN64K
|
|
|
|
|
2012-04-11 17:15:15 +02:00
|
|
|
#define MAP_FIXED 0x0200 /* require mapping to happen at hint */
|
2012-06-06 00:50:13 +02:00
|
|
|
#define MAP_THIRDPARTY 0x0400 /* perform on behalf of any process */
|
2012-06-06 19:05:28 +02:00
|
|
|
#define MAP_UNINITIALIZED 0x0800 /* do not clear memory */
|
2012-04-11 17:15:15 +02:00
|
|
|
|
2012-02-11 19:31:25 +01:00
|
|
|
/*
|
|
|
|
* Error indicator returned by mmap(2)
|
|
|
|
*/
|
|
|
|
#define MAP_FAILED ((void *) -1) /* mmap() failed */
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
#ifndef __minix
|
|
|
|
void * mmap(void *, size_t, int, int, int, off_t);
|
|
|
|
int munmap(void *, size_t);
|
|
|
|
#else
|
|
|
|
void * minix_mmap(void *, size_t, int, int, int, off_t);
|
2012-06-06 00:50:13 +02:00
|
|
|
void * minix_mmap_for(endpoint_t, void *, size_t, int, int, int, off_t);
|
2012-02-11 19:31:25 +01:00
|
|
|
int minix_munmap(void *, size_t);
|
|
|
|
void * vm_remap(int d, int s, void *da, void *sa, size_t si);
|
|
|
|
void * vm_remap_ro(int d, int s, void *da, void *sa, size_t si);
|
|
|
|
int vm_unmap(int endpt, void *addr);
|
|
|
|
unsigned long vm_getphys(int endpt, void *addr);
|
|
|
|
u8_t vm_getrefcount(int endpt, void *addr);
|
|
|
|
#endif /* __minix */
|
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* !_SYS_MMAN_H_ */
|