source: trunk/sys/dietlibc/include/sys/mman.h @ 1

Last change on this file since 1 was 1, checked in by alain, 5 years ago

First import

File size: 3.3 KB
Line 
1#ifndef _SYS_MMAN_H
2#define _SYS_MMAN_H
3
4#include <sys/types.h>
5
6#define MREMAP_MAYMOVE  1UL
7#define MREMAP_FIXED    2UL
8
9#define PROT_READ       0x1             /* page can be read */
10#define PROT_WRITE      0x2             /* page can be written */
11#define PROT_EXEC       0x4             /* page can be executed */
12#define PROT_NONE       0x0             /* page can not be accessed */
13
14#define MAP_SHARED      0x0001          /* Share changes */
15#define MAP_PRIVATE     0x0002          /* Changes are private */
16#define MAP_ANONYMOUS   0x0004          /* don't use a file */
17#define MAP_GROWSDOWN   0x0008          /* stack-like segment */
18#define MAP_STACK       0x0008
19#define MAP_LOCKED      0x0010          /* pages are locked */
20#define MAP_HUGETLB     0x0020          /* Allocate the mapping using "huge pages." */
21#define MAP_FIXED       0x0040          /* Interpret addr exactly */
22#define MAP_DENYWRITE   0x200000        /* ETXTBSY */
23#define MAP_EXECUTABLE  0x400000        /* mark it as an executable */
24#define MAP_32BIT       0x800000        /* Put the mapping into the first 2 Gigabytes of the process address space. */
25
26#define MAP_POPULATE    0x010000
27#define MAP_NORESERVE   0x020000        /* don't check for reservations */
28
29
30#define MS_ASYNC        0x0001          /* sync memory asynchronously */
31#define MS_INVALIDATE   0x0002          /* invalidate mappings & caches */
32#define MS_SYNC         0x0004          /* synchronous memory sync */
33#define MCL_CURRENT     1               /* lock all current mappings */
34#define MCL_FUTURE      2               /* lock all future mappings */
35#define MADV_NORMAL     0x0             /* default page-in behavior */
36#define MADV_RANDOM     0x1             /* page-in minimum required */
37#define MADV_SEQUENTIAL 0x2             /* read-ahead aggressively */
38#define MADV_WILLNEED   0x3             /* pre-fault pages */
39#define MADV_DONTNEED   0x4             /* discard these pages */
40#define MADV_MIGRATE    0x5             /* migrate page on next-touch */
41
42/* compatibility flags */
43#define MAP_ANON        MAP_ANONYMOUS
44#define MAP_FILE        0
45
46#define MAP_FAILED      ((void *) -1)
47
48void *mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset);
49
50int munmap (void *__addr, size_t __len);
51extern int mprotect (void *__addr, size_t __len, int __prot);
52extern int msync (void *__addr, size_t __len, int __flags);
53extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
54                     unsigned long __may_move);
55extern int mincore (void *__start, size_t __len, unsigned char *__vec);
56
57/* Public structure used by mcntl */
58typedef struct
59{
60  uint_t mi_cid;                /* cluster id */
61  uint_t mi_cx;                 /* cluster x coordinate */
62  uint_t mi_cy;                 /* cluster y coordinate */
63  uint_t mi_cz;                 /* cluster z coordinate */
64} minfo_t;
65
66/* Commands used by mcntl */
67#define MCNTL_READ           0x0
68#define MCNTL_L1_iFLUSH      0x1
69#define MCNTL_MOVE           0x2 /* this operation is not implemented in this version */
70
71/**
72 * Control of process virtual address & core caches
73 *
74 * @op       : (in) one of MCNTL_XXX operations
75 * @addr     : (in) virtual address (will be arround to page base address)
76 * @len      : (in) number of pages
77 * @info     : (in/out) addr related info
78 *
79 * @return   : 0 if OK
80 *
81 * Rationale:
82 *   MCNTL_READ    : fills info structre and doesn't need len parameter.
83 *   MCNTL_MOVE    : uses info structre as input parameter and must be initialized correctly.
84 **/
85extern int mcntl(int op, void *vaddr, size_t len, minfo_t *info);
86
87int mlockall(int flags) ;
88int mlock(const void *addr, size_t len);
89int munlock(const void *addr, size_t len);
90int munlockall(void);
91
92int madvise(void *start, size_t length, int advice);
93
94#define _POSIX_MAPPED_FILES
95
96#endif
Note: See TracBrowser for help on using the repository browser.