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