Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
9bccf70c | 2 | * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. |
1c79356b A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
43866e37 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
43866e37 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
26 | /*- | |
27 | * Copyright (c) 1982, 1986, 1993 | |
28 | * The Regents of the University of California. All rights reserved. | |
29 | * | |
30 | * Redistribution and use in source and binary forms, with or without | |
31 | * modification, are permitted provided that the following conditions | |
32 | * are met: | |
33 | * 1. Redistributions of source code must retain the above copyright | |
34 | * notice, this list of conditions and the following disclaimer. | |
35 | * 2. Redistributions in binary form must reproduce the above copyright | |
36 | * notice, this list of conditions and the following disclaimer in the | |
37 | * documentation and/or other materials provided with the distribution. | |
38 | * 3. All advertising materials mentioning features or use of this software | |
39 | * must display the following acknowledgement: | |
40 | * This product includes software developed by the University of | |
41 | * California, Berkeley and its contributors. | |
42 | * 4. Neither the name of the University nor the names of its contributors | |
43 | * may be used to endorse or promote products derived from this software | |
44 | * without specific prior written permission. | |
45 | * | |
46 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
47 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
48 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
49 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
50 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
51 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
52 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
53 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
54 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
55 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
56 | * SUCH DAMAGE. | |
57 | * | |
58 | * @(#)mman.h 8.1 (Berkeley) 6/2/93 | |
59 | */ | |
60 | ||
61 | #ifndef _SYS_MMAN_H_ | |
62 | #define _SYS_MMAN_H_ | |
63 | ||
9bccf70c | 64 | #include <sys/appleapiopts.h> |
1c79356b A |
65 | #include <mach/shared_memory_server.h> |
66 | ||
67 | /* | |
68 | * Protections are chosen from these bits, or-ed together | |
69 | */ | |
70 | #define PROT_NONE 0x00 /* no permissions */ | |
71 | #define PROT_READ 0x01 /* pages can be read */ | |
72 | #define PROT_WRITE 0x02 /* pages can be written */ | |
73 | #define PROT_EXEC 0x04 /* pages can be executed */ | |
74 | ||
75 | /* | |
76 | * Flags contain sharing type and options. | |
77 | * Sharing types; choose one. | |
78 | */ | |
79 | #define MAP_SHARED 0x0001 /* share changes */ | |
80 | #define MAP_PRIVATE 0x0002 /* changes are private */ | |
81 | #define MAP_COPY MAP_PRIVATE /* Obsolete */ | |
82 | ||
83 | /* | |
84 | * Other flags | |
85 | */ | |
86 | #define MAP_FIXED 0x0010 /* map addr must be exactly as requested */ | |
87 | #define MAP_RENAME 0x0020 /* Sun: rename private pages to file */ | |
88 | #define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */ | |
55e303ae | 89 | #define MAP_RESERVED0080 0x0080 /* previously unimplemented MAP_INHERIT */ |
1c79356b A |
90 | #define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */ |
91 | #define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */ | |
92 | ||
93 | #ifdef _P1003_1B_VISIBLE | |
94 | /* | |
95 | * Process memory locking | |
96 | */ | |
97 | #define MCL_CURRENT 0x0001 /* Lock only current memory */ | |
98 | #define MCL_FUTURE 0x0002 /* Lock all future memory as well */ | |
99 | ||
100 | #endif /* _P1003_1B_VISIBLE */ | |
101 | ||
102 | /* | |
103 | * Error return from mmap() | |
104 | */ | |
105 | #define MAP_FAILED ((void *)-1) | |
106 | ||
107 | /* | |
108 | * msync() flags | |
109 | */ | |
110 | #define MS_SYNC 0x0000 /* msync synchronously */ | |
111 | #define MS_ASYNC 0x0001 /* return immediately */ | |
112 | #define MS_INVALIDATE 0x0002 /* invalidate all cached data */ | |
113 | ||
114 | #ifndef _POSIX_SOURCE | |
115 | #define MS_KILLPAGES 0x0004 /* invalidate pages, leave mapped */ | |
116 | #define MS_DEACTIVATE 0x0008 /* deactivate pages, leave mapped */ | |
117 | #endif | |
118 | ||
119 | /* | |
120 | * Mapping type | |
121 | */ | |
122 | #define MAP_FILE 0x0000 /* map from file (default) */ | |
123 | #define MAP_ANON 0x1000 /* allocated from memory, swap space */ | |
124 | ||
125 | /* | |
126 | * Advice to madvise | |
127 | */ | |
128 | #define MADV_NORMAL 0 /* no further special treatment */ | |
129 | #define MADV_RANDOM 1 /* expect random page references */ | |
130 | #define MADV_SEQUENTIAL 2 /* expect sequential page references */ | |
131 | #define MADV_WILLNEED 3 /* will need these pages */ | |
132 | #define MADV_DONTNEED 4 /* dont need these pages */ | |
133 | #define MADV_FREE 5 /* dont need these pages, and junk contents */ | |
9bccf70c A |
134 | #define POSIX_MADV_NORMAL MADV_NORMAL |
135 | #define POSIX_MADV_RANDOM MADV_RANDOM | |
136 | #define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL | |
137 | #define POSIX_MADV_WILLNEED MADV_WILLNEED | |
138 | #define POSIX_MADV_DONTNEED MADV_DONTNEED | |
1c79356b A |
139 | |
140 | /* | |
141 | * Return bits from mincore | |
142 | */ | |
143 | #define MINCORE_INCORE 0x1 /* Page is incore */ | |
144 | #define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */ | |
145 | #define MINCORE_MODIFIED 0x4 /* Page has been modified by us */ | |
146 | #define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */ | |
147 | #define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */ | |
148 | ||
149 | #ifndef KERNEL | |
150 | ||
151 | #include <sys/cdefs.h> | |
152 | ||
153 | __BEGIN_DECLS | |
154 | #ifdef _P1003_1B_VISIBLE | |
155 | int mlockall __P((int)); | |
156 | int munlockall __P((void)); | |
157 | #endif /* _P1003_1B_VISIBLE */ | |
158 | int mlock __P((const void *, size_t)); | |
159 | #ifndef _MMAP_DECLARED | |
160 | #define _MMAP_DECLARED | |
161 | void * mmap __P((void *, size_t, int, int, int, off_t)); | |
162 | #endif | |
163 | int mprotect __P((const void *, size_t, int)); | |
164 | int msync __P((void *, size_t, int)); | |
165 | int munlock __P((const void *, size_t)); | |
166 | int munmap __P((void *, size_t)); | |
167 | int shm_open __P((const char *, int, ...)); | |
168 | int shm_unlink __P((const char *)); | |
9bccf70c | 169 | int posix_madvise __P((void *, size_t, int)); |
1c79356b | 170 | #ifndef _POSIX_SOURCE |
9bccf70c A |
171 | #ifdef __APPLE_API_PRIVATE |
172 | int load_shared_file __P((char *, caddr_t, u_long, | |
173 | caddr_t *, int, sf_mapping_t *, int *)); | |
1c79356b | 174 | int reset_shared_file __P((caddr_t *, int, sf_mapping_t *)); |
9bccf70c A |
175 | int new_system_shared_regions __P((void)); |
176 | #endif /* __APPLE_API_PRIVATE */ | |
1c79356b A |
177 | int madvise __P((void *, size_t, int)); |
178 | int mincore __P((const void *, size_t, char *)); | |
179 | int minherit __P((void *, size_t, int)); | |
180 | #endif | |
181 | __END_DECLS | |
182 | ||
183 | #endif /* !KERNEL */ | |
184 | #endif /* !_SYS_MMAN_H_ */ |