xref: /xnu-12377.81.4/bsd/sys/mman.h (revision 043036a2b3718f7f0be807e2870f8f47d3fa0796)
1*043036a2SApple OSS Distributions /*
2*043036a2SApple OSS Distributions  * Copyright (c) 2000-2020 Apple Computer, Inc. All rights reserved.
3*043036a2SApple OSS Distributions  *
4*043036a2SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*043036a2SApple OSS Distributions  *
6*043036a2SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*043036a2SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*043036a2SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*043036a2SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*043036a2SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*043036a2SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*043036a2SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*043036a2SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*043036a2SApple OSS Distributions  *
15*043036a2SApple OSS Distributions  * Please obtain a copy of the License at
16*043036a2SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*043036a2SApple OSS Distributions  *
18*043036a2SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*043036a2SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*043036a2SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*043036a2SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*043036a2SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*043036a2SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*043036a2SApple OSS Distributions  * limitations under the License.
25*043036a2SApple OSS Distributions  *
26*043036a2SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*043036a2SApple OSS Distributions  */
28*043036a2SApple OSS Distributions /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29*043036a2SApple OSS Distributions /*-
30*043036a2SApple OSS Distributions  * Copyright (c) 1982, 1986, 1993
31*043036a2SApple OSS Distributions  *	The Regents of the University of California.  All rights reserved.
32*043036a2SApple OSS Distributions  *
33*043036a2SApple OSS Distributions  * Redistribution and use in source and binary forms, with or without
34*043036a2SApple OSS Distributions  * modification, are permitted provided that the following conditions
35*043036a2SApple OSS Distributions  * are met:
36*043036a2SApple OSS Distributions  * 1. Redistributions of source code must retain the above copyright
37*043036a2SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer.
38*043036a2SApple OSS Distributions  * 2. Redistributions in binary form must reproduce the above copyright
39*043036a2SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer in the
40*043036a2SApple OSS Distributions  *    documentation and/or other materials provided with the distribution.
41*043036a2SApple OSS Distributions  * 3. All advertising materials mentioning features or use of this software
42*043036a2SApple OSS Distributions  *    must display the following acknowledgement:
43*043036a2SApple OSS Distributions  *	This product includes software developed by the University of
44*043036a2SApple OSS Distributions  *	California, Berkeley and its contributors.
45*043036a2SApple OSS Distributions  * 4. Neither the name of the University nor the names of its contributors
46*043036a2SApple OSS Distributions  *    may be used to endorse or promote products derived from this software
47*043036a2SApple OSS Distributions  *    without specific prior written permission.
48*043036a2SApple OSS Distributions  *
49*043036a2SApple OSS Distributions  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50*043036a2SApple OSS Distributions  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51*043036a2SApple OSS Distributions  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52*043036a2SApple OSS Distributions  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53*043036a2SApple OSS Distributions  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54*043036a2SApple OSS Distributions  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55*043036a2SApple OSS Distributions  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56*043036a2SApple OSS Distributions  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57*043036a2SApple OSS Distributions  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58*043036a2SApple OSS Distributions  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59*043036a2SApple OSS Distributions  * SUCH DAMAGE.
60*043036a2SApple OSS Distributions  *
61*043036a2SApple OSS Distributions  *	@(#)mman.h	8.1 (Berkeley) 6/2/93
62*043036a2SApple OSS Distributions  */
63*043036a2SApple OSS Distributions 
64*043036a2SApple OSS Distributions /*
65*043036a2SApple OSS Distributions  * Currently unsupported:
66*043036a2SApple OSS Distributions  *
67*043036a2SApple OSS Distributions  * [TYM]	POSIX_TYPED_MEM_ALLOCATE
68*043036a2SApple OSS Distributions  * [TYM]	POSIX_TYPED_MEM_ALLOCATE_CONTIG
69*043036a2SApple OSS Distributions  * [TYM]	POSIX_TYPED_MEM_MAP_ALLOCATABLE
70*043036a2SApple OSS Distributions  * [TYM]	struct posix_typed_mem_info
71*043036a2SApple OSS Distributions  * [TYM]	posix_mem_offset()
72*043036a2SApple OSS Distributions  * [TYM]	posix_typed_mem_get_info()
73*043036a2SApple OSS Distributions  * [TYM]	posix_typed_mem_open()
74*043036a2SApple OSS Distributions  */
75*043036a2SApple OSS Distributions 
76*043036a2SApple OSS Distributions #ifndef _SYS_MMAN_H_
77*043036a2SApple OSS Distributions #define _SYS_MMAN_H_
78*043036a2SApple OSS Distributions 
79*043036a2SApple OSS Distributions #include <sys/appleapiopts.h>
80*043036a2SApple OSS Distributions #include <sys/cdefs.h>
81*043036a2SApple OSS Distributions 
82*043036a2SApple OSS Distributions #include <sys/_types.h>
83*043036a2SApple OSS Distributions 
84*043036a2SApple OSS Distributions /*
85*043036a2SApple OSS Distributions  * [various] The mode_t, off_t, and size_t types shall be defined as
86*043036a2SApple OSS Distributions  * described in <sys/types.h>
87*043036a2SApple OSS Distributions  */
88*043036a2SApple OSS Distributions #include <sys/_types/_mode_t.h>
89*043036a2SApple OSS Distributions #include <sys/_types/_off_t.h>
90*043036a2SApple OSS Distributions #include <sys/_types/_size_t.h>
91*043036a2SApple OSS Distributions 
92*043036a2SApple OSS Distributions #ifndef KERNEL
93*043036a2SApple OSS Distributions #if __DARWIN_C_LEVEL >= 200809L
94*043036a2SApple OSS Distributions #include <Availability.h>
95*043036a2SApple OSS Distributions #endif /* __DARWIN_C_LEVEL */
96*043036a2SApple OSS Distributions #endif /* KERNEL */
97*043036a2SApple OSS Distributions 
98*043036a2SApple OSS Distributions /*
99*043036a2SApple OSS Distributions  * Protections are chosen from these bits, or-ed together
100*043036a2SApple OSS Distributions  */
101*043036a2SApple OSS Distributions #define PROT_NONE       0x00    /* [MC2] no permissions */
102*043036a2SApple OSS Distributions #define PROT_READ       0x01    /* [MC2] pages can be read */
103*043036a2SApple OSS Distributions #define PROT_WRITE      0x02    /* [MC2] pages can be written */
104*043036a2SApple OSS Distributions #define PROT_EXEC       0x04    /* [MC2] pages can be executed */
105*043036a2SApple OSS Distributions 
106*043036a2SApple OSS Distributions /*
107*043036a2SApple OSS Distributions  * Flags contain sharing type and options.
108*043036a2SApple OSS Distributions  * Sharing types; choose one.
109*043036a2SApple OSS Distributions  */
110*043036a2SApple OSS Distributions #define MAP_SHARED      0x0001          /* [MF|SHM] share changes */
111*043036a2SApple OSS Distributions #define MAP_PRIVATE     0x0002          /* [MF|SHM] changes are private */
112*043036a2SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
113*043036a2SApple OSS Distributions #define MAP_COPY        MAP_PRIVATE     /* Obsolete */
114*043036a2SApple OSS Distributions #endif  /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
115*043036a2SApple OSS Distributions 
116*043036a2SApple OSS Distributions /*
117*043036a2SApple OSS Distributions  * Other flags
118*043036a2SApple OSS Distributions  */
119*043036a2SApple OSS Distributions #define MAP_FIXED        0x0010 /* [MF|SHM] interpret addr exactly */
120*043036a2SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
121*043036a2SApple OSS Distributions #define MAP_RENAME       0x0020 /* Sun: rename private pages to file */
122*043036a2SApple OSS Distributions #define MAP_NORESERVE    0x0040 /* Sun: don't reserve needed swap area */
123*043036a2SApple OSS Distributions #define MAP_RESERVED0080 0x0080 /* previously unimplemented MAP_INHERIT */
124*043036a2SApple OSS Distributions #define MAP_NOEXTEND     0x0100 /* for MAP_FILE, don't change file size */
125*043036a2SApple OSS Distributions #define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
126*043036a2SApple OSS Distributions #define MAP_NOCACHE      0x0400 /* don't cache pages for this mapping */
127*043036a2SApple OSS Distributions #define MAP_JIT          0x0800 /* Allocate a region that will be used for JIT purposes */
128*043036a2SApple OSS Distributions 
129*043036a2SApple OSS Distributions /*
130*043036a2SApple OSS Distributions  * Mapping type
131*043036a2SApple OSS Distributions  */
132*043036a2SApple OSS Distributions #define MAP_FILE        0x0000  /* map from file (default) */
133*043036a2SApple OSS Distributions #define MAP_ANON        0x1000  /* allocated from memory, swap space */
134*043036a2SApple OSS Distributions #define MAP_ANONYMOUS   MAP_ANON
135*043036a2SApple OSS Distributions 
136*043036a2SApple OSS Distributions /*
137*043036a2SApple OSS Distributions  * The MAP_RESILIENT_* flags can be used when the caller wants to map some
138*043036a2SApple OSS Distributions  * possibly unreliable memory and be able to access it safely, possibly
139*043036a2SApple OSS Distributions  * getting the wrong contents rather than raising any exception.
140*043036a2SApple OSS Distributions  * For safety reasons, such mappings have to be read-only (PROT_READ access
141*043036a2SApple OSS Distributions  * only).
142*043036a2SApple OSS Distributions  *
143*043036a2SApple OSS Distributions  * MAP_RESILIENT_CODESIGN:
144*043036a2SApple OSS Distributions  *      accessing this mapping will not generate code-signing violations,
145*043036a2SApple OSS Distributions  *	even if the contents are tainted.
146*043036a2SApple OSS Distributions  * MAP_RESILIENT_MEDIA:
147*043036a2SApple OSS Distributions  *	accessing this mapping will not generate an exception if the contents
148*043036a2SApple OSS Distributions  *	are not available (unreachable removable or remote media, access beyond
149*043036a2SApple OSS Distributions  *	end-of-file, ...).  Missing contents will be replaced with zeroes.
150*043036a2SApple OSS Distributions  */
151*043036a2SApple OSS Distributions #define MAP_RESILIENT_CODESIGN  0x2000 /* no code-signing failures */
152*043036a2SApple OSS Distributions #define MAP_RESILIENT_MEDIA     0x4000 /* no backing-store failures */
153*043036a2SApple OSS Distributions 
154*043036a2SApple OSS Distributions #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
155*043036a2SApple OSS Distributions #define MAP_32BIT       0x8000          /* Return virtual addresses <4G only */
156*043036a2SApple OSS Distributions #endif /* defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 */
157*043036a2SApple OSS Distributions 
158*043036a2SApple OSS Distributions 
159*043036a2SApple OSS Distributions /*
160*043036a2SApple OSS Distributions  * Flags used to support translated processes.
161*043036a2SApple OSS Distributions  */
162*043036a2SApple OSS Distributions #define MAP_TRANSLATED_ALLOW_EXECUTE 0x20000 /* allow execute in translated processes */
163*043036a2SApple OSS Distributions 
164*043036a2SApple OSS Distributions #define MAP_UNIX03       0x40000 /* UNIX03 compliance */
165*043036a2SApple OSS Distributions 
166*043036a2SApple OSS Distributions #define MAP_TPRO         0x80000 /* Allocate a region that will be protected by TPRO */
167*043036a2SApple OSS Distributions 
168*043036a2SApple OSS Distributions #endif  /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
169*043036a2SApple OSS Distributions 
170*043036a2SApple OSS Distributions /*
171*043036a2SApple OSS Distributions  * Process memory locking
172*043036a2SApple OSS Distributions  */
173*043036a2SApple OSS Distributions #define MCL_CURRENT     0x0001  /* [ML] Lock only current memory */
174*043036a2SApple OSS Distributions #define MCL_FUTURE      0x0002  /* [ML] Lock all future memory as well */
175*043036a2SApple OSS Distributions 
176*043036a2SApple OSS Distributions /*
177*043036a2SApple OSS Distributions  * Error return from mmap()
178*043036a2SApple OSS Distributions  */
179*043036a2SApple OSS Distributions #define MAP_FAILED      ((void *)-1)    /* [MF|SHM] mmap failed */
180*043036a2SApple OSS Distributions 
181*043036a2SApple OSS Distributions /*
182*043036a2SApple OSS Distributions  * msync() flags
183*043036a2SApple OSS Distributions  *
184*043036a2SApple OSS Distributions  * When making a new MS_*, update tests vm_parameter_validation_[user|kern]
185*043036a2SApple OSS Distributions  * and their expected results; they deliberately call VM functions with invalid
186*043036a2SApple OSS Distributions  * msync values and you may be turning one of those invalid msyncs valid.
187*043036a2SApple OSS Distributions  */
188*043036a2SApple OSS Distributions #define MS_ASYNC        0x0001  /* [MF|SIO] return immediately */
189*043036a2SApple OSS Distributions #define MS_INVALIDATE   0x0002  /* [MF|SIO] invalidate all cached data */
190*043036a2SApple OSS Distributions #define MS_SYNC         0x0010  /* [MF|SIO] msync synchronously */
191*043036a2SApple OSS Distributions 
192*043036a2SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
193*043036a2SApple OSS Distributions #define MS_KILLPAGES    0x0004  /* invalidate pages, leave mapped */
194*043036a2SApple OSS Distributions #define MS_DEACTIVATE   0x0008  /* deactivate pages, leave mapped */
195*043036a2SApple OSS Distributions 
196*043036a2SApple OSS Distributions #endif  /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
197*043036a2SApple OSS Distributions 
198*043036a2SApple OSS Distributions 
199*043036a2SApple OSS Distributions /*
200*043036a2SApple OSS Distributions  * Advice to madvise
201*043036a2SApple OSS Distributions  *
202*043036a2SApple OSS Distributions  * When making a new MADV_*, update tests vm_parameter_validation_[user|kern]
203*043036a2SApple OSS Distributions  * and their expected results; they deliberately call VM functions with invalid
204*043036a2SApple OSS Distributions  * madvise values and you may be turning one of those invalid madvises valid.
205*043036a2SApple OSS Distributions  */
206*043036a2SApple OSS Distributions #define POSIX_MADV_NORMAL       0       /* [MC1] no further special treatment */
207*043036a2SApple OSS Distributions #define POSIX_MADV_RANDOM       1       /* [MC1] expect random page refs */
208*043036a2SApple OSS Distributions #define POSIX_MADV_SEQUENTIAL   2       /* [MC1] expect sequential page refs */
209*043036a2SApple OSS Distributions #define POSIX_MADV_WILLNEED     3       /* [MC1] will need these pages */
210*043036a2SApple OSS Distributions #define POSIX_MADV_DONTNEED     4       /* [MC1] dont need these pages */
211*043036a2SApple OSS Distributions 
212*043036a2SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
213*043036a2SApple OSS Distributions #define MADV_NORMAL             POSIX_MADV_NORMAL
214*043036a2SApple OSS Distributions #define MADV_RANDOM             POSIX_MADV_RANDOM
215*043036a2SApple OSS Distributions #define MADV_SEQUENTIAL         POSIX_MADV_SEQUENTIAL
216*043036a2SApple OSS Distributions #define MADV_WILLNEED           POSIX_MADV_WILLNEED
217*043036a2SApple OSS Distributions #define MADV_DONTNEED           POSIX_MADV_DONTNEED
218*043036a2SApple OSS Distributions #define MADV_FREE               5       /* pages unneeded, discard contents */
219*043036a2SApple OSS Distributions #define MADV_ZERO_WIRED_PAGES   6       /* zero the wired pages that have not been unwired before the entry is deleted */
220*043036a2SApple OSS Distributions #define MADV_FREE_REUSABLE      7       /* pages can be reused (by anyone) */
221*043036a2SApple OSS Distributions #define MADV_FREE_REUSE         8       /* caller wants to reuse those pages */
222*043036a2SApple OSS Distributions #define MADV_CAN_REUSE          9
223*043036a2SApple OSS Distributions #define MADV_PAGEOUT            10      /* page out now (internal only) */
224*043036a2SApple OSS Distributions #define MADV_ZERO               11      /* zero pages without faulting in additional pages */
225*043036a2SApple OSS Distributions 
226*043036a2SApple OSS Distributions /*
227*043036a2SApple OSS Distributions  * Return bits from mincore
228*043036a2SApple OSS Distributions  */
229*043036a2SApple OSS Distributions #define MINCORE_INCORE           0x1     /* Page is incore */
230*043036a2SApple OSS Distributions #define MINCORE_REFERENCED       0x2     /* Page has been referenced by us */
231*043036a2SApple OSS Distributions #define MINCORE_MODIFIED         0x4     /* Page has been modified by us */
232*043036a2SApple OSS Distributions #define MINCORE_REFERENCED_OTHER 0x8     /* Page has been referenced */
233*043036a2SApple OSS Distributions #define MINCORE_MODIFIED_OTHER  0x10     /* Page has been modified */
234*043036a2SApple OSS Distributions #define MINCORE_PAGED_OUT       0x20     /* Page has been paged out */
235*043036a2SApple OSS Distributions #define MINCORE_COPIED          0x40     /* Page has been copied */
236*043036a2SApple OSS Distributions #define MINCORE_ANONYMOUS       0x80     /* Page belongs to an anonymous object */
237*043036a2SApple OSS Distributions #endif  /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
238*043036a2SApple OSS Distributions 
239*043036a2SApple OSS Distributions #ifdef PRIVATE
240*043036a2SApple OSS Distributions 
241*043036a2SApple OSS Distributions /*
242*043036a2SApple OSS Distributions  * Crypt ID for decryption flow
243*043036a2SApple OSS Distributions  */
244*043036a2SApple OSS Distributions #define CRYPTID_NO_ENCRYPTION     0         /* File is unencrypted */
245*043036a2SApple OSS Distributions #define CRYPTID_APP_ENCRYPTION    1         /* App binary is encrypted */
246*043036a2SApple OSS Distributions #define CRYPTID_MODEL_ENCRYPTION  2         /* ML Model is encrypted */
247*043036a2SApple OSS Distributions 
248*043036a2SApple OSS Distributions /*
249*043036a2SApple OSS Distributions  * Model encryption header
250*043036a2SApple OSS Distributions  */
251*043036a2SApple OSS Distributions typedef struct {
252*043036a2SApple OSS Distributions 	__uint64_t version;
253*043036a2SApple OSS Distributions 	__uint64_t originalSize;
254*043036a2SApple OSS Distributions 	__uint64_t reserved[4];
255*043036a2SApple OSS Distributions } model_encryption_header_t;
256*043036a2SApple OSS Distributions 
257*043036a2SApple OSS Distributions #endif /* #ifdef PRIVATE */
258*043036a2SApple OSS Distributions 
259*043036a2SApple OSS Distributions 
260*043036a2SApple OSS Distributions #ifndef KERNEL
261*043036a2SApple OSS Distributions 
262*043036a2SApple OSS Distributions __BEGIN_DECLS
263*043036a2SApple OSS Distributions /* [ML] */
264*043036a2SApple OSS Distributions int     mlockall(int);
265*043036a2SApple OSS Distributions int     munlockall(void);
266*043036a2SApple OSS Distributions /* [MR] */
267*043036a2SApple OSS Distributions int     mlock(const void *, size_t);
268*043036a2SApple OSS Distributions #ifndef _MMAP
269*043036a2SApple OSS Distributions #define _MMAP
270*043036a2SApple OSS Distributions /* [MC3]*/
271*043036a2SApple OSS Distributions void *  mmap(void *, size_t, int, int, int, off_t) __DARWIN_ALIAS(mmap);
272*043036a2SApple OSS Distributions #endif
273*043036a2SApple OSS Distributions /* [MPR] */
274*043036a2SApple OSS Distributions int     mprotect(void *, size_t, int) __DARWIN_ALIAS(mprotect);
275*043036a2SApple OSS Distributions /* [MF|SIO] */
276*043036a2SApple OSS Distributions int     msync(void *, size_t, int) __DARWIN_ALIAS_C(msync);
277*043036a2SApple OSS Distributions /* [MR] */
278*043036a2SApple OSS Distributions int     munlock(const void *, size_t);
279*043036a2SApple OSS Distributions /* [MC3]*/
280*043036a2SApple OSS Distributions int     munmap(void *, size_t) __DARWIN_ALIAS(munmap);
281*043036a2SApple OSS Distributions /* [SHM] */
282*043036a2SApple OSS Distributions int     shm_open(const char *, int, ...);
283*043036a2SApple OSS Distributions int     shm_unlink(const char *);
284*043036a2SApple OSS Distributions /* [ADV] */
285*043036a2SApple OSS Distributions int     posix_madvise(void *, size_t, int);
286*043036a2SApple OSS Distributions 
287*043036a2SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
288*043036a2SApple OSS Distributions int     madvise(void *, size_t, int);
289*043036a2SApple OSS Distributions int     mincore(const void *, size_t, char *);
290*043036a2SApple OSS Distributions int     minherit(void *, size_t, int);
291*043036a2SApple OSS Distributions #endif
292*043036a2SApple OSS Distributions 
293*043036a2SApple OSS Distributions #ifdef PRIVATE
294*043036a2SApple OSS Distributions int mremap_encrypted(void *, size_t, __uint32_t, __uint32_t, __uint32_t);
295*043036a2SApple OSS Distributions #endif
296*043036a2SApple OSS Distributions 
297*043036a2SApple OSS Distributions __END_DECLS
298*043036a2SApple OSS Distributions 
299*043036a2SApple OSS Distributions #else   /* KERNEL */
300*043036a2SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE
301*043036a2SApple OSS Distributions void pshm_cache_init(void);     /* for bsd_init() */
302*043036a2SApple OSS Distributions 
303*043036a2SApple OSS Distributions /*
304*043036a2SApple OSS Distributions  * XXX routine exported by posix_shm.c, but never used there, only used in
305*043036a2SApple OSS Distributions  * XXX kern_mman.c in the implementation of mmap().
306*043036a2SApple OSS Distributions  */
307*043036a2SApple OSS Distributions struct mmap_args;
308*043036a2SApple OSS Distributions struct fileproc;
309*043036a2SApple OSS Distributions int pshm_mmap(
310*043036a2SApple OSS Distributions 	struct proc       *p,
311*043036a2SApple OSS Distributions 	vm_map_offset_t    user_addr,
312*043036a2SApple OSS Distributions 	vm_map_size_t      user_size,
313*043036a2SApple OSS Distributions 	int                prot,
314*043036a2SApple OSS Distributions 	int                flags,
315*043036a2SApple OSS Distributions 	struct fileproc   *fp,
316*043036a2SApple OSS Distributions 	off_t              file_pos,
317*043036a2SApple OSS Distributions 	off_t              pageoff,
318*043036a2SApple OSS Distributions 	user_addr_t       *retval);
319*043036a2SApple OSS Distributions 
320*043036a2SApple OSS Distributions 
321*043036a2SApple OSS Distributions /* Really need to overhaul struct fileops to avoid this... */
322*043036a2SApple OSS Distributions struct pshmnode;
323*043036a2SApple OSS Distributions struct stat;
324*043036a2SApple OSS Distributions int pshm_stat(struct pshmnode *pnode, void *ub, int isstat64);
325*043036a2SApple OSS Distributions struct fileproc;
326*043036a2SApple OSS Distributions int pshm_truncate(struct proc *p, struct fileproc *fp, int fd, off_t length, int32_t *retval);
327*043036a2SApple OSS Distributions 
328*043036a2SApple OSS Distributions #endif /* XNU_KERNEL_PRIVATE */
329*043036a2SApple OSS Distributions #endif /* KERNEL */
330*043036a2SApple OSS Distributions #endif /* !_SYS_MMAN_H_ */
331