1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 1989 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 #ifndef _sys_mman_h 30 #define _sys_mman_h 31 32 /* 33 * Protections are chosen from these bits, or-ed together. 34 * Note - not all implementations literally provide all possible 35 * combinations. PROT_WRITE is often implemented as (PROT_READ | 36 * PROT_WRITE) and (PROT_EXECUTE as PROT_READ | PROT_EXECUTE). 37 * However, no implementation will permit a write to succeed 38 * where PROT_WRITE has not been set. Also, no implementation will 39 * allow any access to succeed where prot is specified as PROT_NONE. 40 */ 41 #define PROT_READ 0x1 /* pages can be read */ 42 #define PROT_WRITE 0x2 /* pages can be written */ 43 #define PROT_EXEC 0x4 /* pages can be executed */ 44 45 #ifdef KERNEL 46 #define PROT_USER 0x8 /* pages are user accessable */ 47 #define PROT_ALL (PROT_READ | PROT_WRITE | PROT_EXEC | PROT_USER) 48 #endif KERNEL 49 50 #define PROT_NONE 0x0 /* pages cannot be accessed */ 51 52 /* sharing types: must choose either SHARED or PRIVATE */ 53 #define MAP_SHARED 1 /* share changes */ 54 #define MAP_PRIVATE 2 /* changes are private */ 55 #define MAP_TYPE 0xf /* mask for share type */ 56 57 /* other flags to mmap (or-ed in to MAP_SHARED or MAP_PRIVATE) */ 58 #define MAP_FIXED 0x10 /* user assigns address */ 59 60 /* these flags not yet implemented */ 61 #define MAP_RENAME 0x20 /* rename private pages to file */ 62 #define MAP_NORESERVE 0x40 /* don't reserve needed swap area */ 63 64 #ifdef notdef 65 /* 66 * Not clear that this flag will ever be implemented 67 */ 68 #define MAP_INHERIT 0x80 /* inherit this mapping accross exec */ 69 #endif notdef 70 71 /* 72 * For the sake of backward object compatibility, we use the _MAP_NEW flag. 73 * This flag will be automatically or'ed in by the C library for all 74 * new mmap calls. Previous binaries with old mmap calls with continue 75 * to get 0 or -1 for return values. New mmap calls will get the mapped 76 * address as the return value if successful and -1 on errors. By default, 77 * new mmap calls automatically have the kernel assign the map address 78 * unless the MAP_FIXED flag is given. 79 */ 80 #define _MAP_NEW 0x80000000 /* user's should not need to use this */ 81 82 #if !defined(LOCORE) && !defined(KERNEL) 83 #include <sys/types.h> 84 85 /* 86 * Except for old binaries mmap() will return the resultant 87 * address of mapping on success and (caddr_t)-1 on error. 88 */ 89 extern caddr_t mmap(); 90 #endif !LOCORE && !KERNEL 91 92 /* advice to madvise */ 93 #define MADV_NORMAL 0 /* no further special treatment */ 94 #define MADV_RANDOM 1 /* expect random page references */ 95 #define MADV_SEQUENTIAL 2 /* expect sequential page references */ 96 #define MADV_WILLNEED 3 /* will need these pages */ 97 #define MADV_DONTNEED 4 /* don't need these pages */ 98 99 /* flags to msync */ 100 #define MS_ASYNC 0x1 /* return immediately */ 101 #define MS_INVALIDATE 0x2 /* invalidate caches */ 102 103 /* functions to mctl */ 104 #define MC_SYNC 1 /* sync with backing store */ 105 #define MC_LOCK 2 /* lock pages in memory */ 106 #define MC_UNLOCK 3 /* unlock pages from memory */ 107 #define MC_ADVISE 4 /* give advice to management */ 108 #define MC_LOCKAS 5 /* lock address space in memory */ 109 #define MC_UNLOCKAS 6 /* unlock address space from memory */ 110 111 /* flags to mlockall */ 112 #define MCL_CURRENT 0x1 /* lock current mappings */ 113 #define MCL_FUTURE 0x2 /* lock future mappings */ 114 115 #endif /*!_sys_mman_h*/ 116