1 mman.h |
1 /*- |
|
2 * Copyright (c) 1982, 1986, 1993 |
|
3 * The Regents of the University of California. All rights reserved. |
|
4 * © Portions copyright (c) 2006 Symbian Software Ltd. All rights reserved. |
|
5 * |
|
6 * Redistribution and use in source and binary forms, with or without |
|
7 * modification, are permitted provided that the following conditions |
|
8 * are met: |
|
9 * 1. Redistributions of source code must retain the above copyright |
|
10 * notice, this list of conditions and the following disclaimer. |
|
11 * 2. Redistributions in binary form must reproduce the above copyright |
|
12 * notice, this list of conditions and the following disclaimer in the |
|
13 * documentation and/or other materials provided with the distribution. |
|
14 * 4. Neither the name of the University nor the names of its contributors |
|
15 * may be used to endorse or promote products derived from this software |
|
16 * without specific prior written permission. |
|
17 * |
|
18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
|
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
|
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
|
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
|
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
28 * SUCH DAMAGE. |
|
29 * © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved. |
|
30 * @(#)mman.h 8.2 (Berkeley) 1/9/95 |
|
31 * $FreeBSD: src/sys/sys/mman.h,v 1.40 2005/04/02 12:33:31 das Exp $ |
|
32 */ |
|
33 |
|
34 #ifndef _SYS_MMAN_H_ |
|
35 #define _SYS_MMAN_H_ |
|
36 #ifdef __cplusplus |
|
37 extern "C" |
|
38 { |
|
39 #endif |
|
40 |
|
41 #include <sys/cdefs.h> |
|
42 #include <sys/_types.h> |
|
43 |
|
44 #if __BSD_VISIBLE |
|
45 /* |
|
46 * Inheritance for minherit() |
|
47 */ |
|
48 #define INHERIT_SHARE 0 |
|
49 #define INHERIT_COPY 1 |
|
50 #define INHERIT_NONE 2 |
|
51 #endif |
|
52 |
|
53 /* |
|
54 * Protections are chosen from these bits, or-ed together |
|
55 */ |
|
56 #define PROT_NONE 0x00 /* no permissions */ |
|
57 #define PROT_READ 0x01 /* pages can be read */ |
|
58 #define PROT_WRITE 0x02 /* pages can be written */ |
|
59 #define PROT_EXEC 0x04 /* pages can be executed */ |
|
60 |
|
61 /* |
|
62 * Flags contain sharing type and options. |
|
63 * Sharing types; choose one. |
|
64 */ |
|
65 #define MAP_SHARED 0x0001 /* share changes */ |
|
66 #define MAP_PRIVATE 0x0002 /* changes are private */ |
|
67 #if __BSD_VISIBLE |
|
68 #define MAP_COPY MAP_PRIVATE /* Obsolete */ |
|
69 #endif |
|
70 |
|
71 /* |
|
72 * Other flags |
|
73 */ |
|
74 #define MAP_FIXED 0x0010 /* map addr must be exactly as requested */ |
|
75 |
|
76 /* |
|
77 * Error return from mmap() |
|
78 */ |
|
79 #define MAP_FAILED ((void *)-1) |
|
80 |
|
81 /* |
|
82 * msync() flags |
|
83 */ |
|
84 #define MS_SYNC 0x0000 /* msync synchronously */ |
|
85 #define MS_ASYNC 0x0001 /* return immediately */ |
|
86 #define MS_INVALIDATE 0x0002 /* invalidate all cached data */ |
|
87 |
|
88 #ifndef _MODE_T_DECLARED |
|
89 typedef __mode_t mode_t; |
|
90 #define _MODE_T_DECLARED |
|
91 #endif |
|
92 |
|
93 #ifndef _OFF_T_DECLARED |
|
94 typedef __off_t off_t; |
|
95 #define _OFF_T_DECLARED |
|
96 #endif |
|
97 |
|
98 #ifndef _SIZE_T_DECLARED |
|
99 typedef __size_t size_t; |
|
100 #define _SIZE_T_DECLARED |
|
101 #endif |
|
102 |
|
103 #ifndef _KERNEL |
|
104 |
|
105 __BEGIN_DECLS |
|
106 /* |
|
107 * XXX not yet implemented: posix_mem_offset(), posix_typed_mem_get_info(), |
|
108 * posix_typed_mem_open(). |
|
109 */ |
|
110 #ifndef _MMAP_DECLARED |
|
111 #define _MMAP_DECLARED |
|
112 IMPORT_C void * mmap(void *, size_t, int, int, int, off_t); |
|
113 #endif |
|
114 IMPORT_C int mprotect(const void *, size_t, int); |
|
115 IMPORT_C int msync(void *, size_t, int); |
|
116 IMPORT_C int munmap(void *, size_t); |
|
117 __END_DECLS |
|
118 |
|
119 #endif /* !_KERNEL */ |
|
120 |
|
121 #ifdef __cplusplus |
|
122 } |
|
123 #endif //__cplusplus |
|
124 |
|
125 #endif /* !_SYS_MMAN_H_ */ |