10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 230Sstevel@tonic-gate * Copyright 1989 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 27*722Smuffin #ifndef _sys_mman_h 28*722Smuffin #define _sys_mman_h 290Sstevel@tonic-gate 30*722Smuffin #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate /* 330Sstevel@tonic-gate * Protections are chosen from these bits, or-ed together. 340Sstevel@tonic-gate * Note - not all implementations literally provide all possible 350Sstevel@tonic-gate * combinations. PROT_WRITE is often implemented as (PROT_READ | 360Sstevel@tonic-gate * PROT_WRITE) and (PROT_EXECUTE as PROT_READ | PROT_EXECUTE). 370Sstevel@tonic-gate * However, no implementation will permit a write to succeed 380Sstevel@tonic-gate * where PROT_WRITE has not been set. Also, no implementation will 390Sstevel@tonic-gate * allow any access to succeed where prot is specified as PROT_NONE. 400Sstevel@tonic-gate */ 410Sstevel@tonic-gate #define PROT_READ 0x1 /* pages can be read */ 420Sstevel@tonic-gate #define PROT_WRITE 0x2 /* pages can be written */ 430Sstevel@tonic-gate #define PROT_EXEC 0x4 /* pages can be executed */ 440Sstevel@tonic-gate 450Sstevel@tonic-gate #define PROT_NONE 0x0 /* pages cannot be accessed */ 460Sstevel@tonic-gate 470Sstevel@tonic-gate /* sharing types: must choose either SHARED or PRIVATE */ 480Sstevel@tonic-gate #define MAP_SHARED 1 /* share changes */ 490Sstevel@tonic-gate #define MAP_PRIVATE 2 /* changes are private */ 500Sstevel@tonic-gate #define MAP_TYPE 0xf /* mask for share type */ 510Sstevel@tonic-gate 520Sstevel@tonic-gate /* other flags to mmap (or-ed in to MAP_SHARED or MAP_PRIVATE) */ 530Sstevel@tonic-gate #define MAP_FIXED 0x10 /* user assigns address */ 540Sstevel@tonic-gate 550Sstevel@tonic-gate /* these flags not yet implemented */ 560Sstevel@tonic-gate #define MAP_RENAME 0x20 /* rename private pages to file */ 570Sstevel@tonic-gate #define MAP_NORESERVE 0x40 /* don't reserve needed swap area */ 580Sstevel@tonic-gate 590Sstevel@tonic-gate /* 600Sstevel@tonic-gate * For the sake of backward object compatibility, we use the _MAP_NEW flag. 610Sstevel@tonic-gate * This flag will be automatically or'ed in by the C library for all 620Sstevel@tonic-gate * new mmap calls. Previous binaries with old mmap calls with continue 630Sstevel@tonic-gate * to get 0 or -1 for return values. New mmap calls will get the mapped 640Sstevel@tonic-gate * address as the return value if successful and -1 on errors. By default, 650Sstevel@tonic-gate * new mmap calls automatically have the kernel assign the map address 660Sstevel@tonic-gate * unless the MAP_FIXED flag is given. 670Sstevel@tonic-gate */ 680Sstevel@tonic-gate #define _MAP_NEW 0x80000000 /* user's should not need to use this */ 690Sstevel@tonic-gate 700Sstevel@tonic-gate #if !defined(LOCORE) && !defined(KERNEL) 710Sstevel@tonic-gate #include <sys/types.h> 720Sstevel@tonic-gate 730Sstevel@tonic-gate /* 740Sstevel@tonic-gate * Except for old binaries mmap() will return the resultant 750Sstevel@tonic-gate * address of mapping on success and (caddr_t)-1 on error. 760Sstevel@tonic-gate */ 770Sstevel@tonic-gate extern caddr_t mmap(); 78*722Smuffin #endif /* !LOCORE && !KERNEL */ 790Sstevel@tonic-gate 800Sstevel@tonic-gate /* advice to madvise */ 810Sstevel@tonic-gate #define MADV_NORMAL 0 /* no further special treatment */ 820Sstevel@tonic-gate #define MADV_RANDOM 1 /* expect random page references */ 830Sstevel@tonic-gate #define MADV_SEQUENTIAL 2 /* expect sequential page references */ 840Sstevel@tonic-gate #define MADV_WILLNEED 3 /* will need these pages */ 850Sstevel@tonic-gate #define MADV_DONTNEED 4 /* don't need these pages */ 860Sstevel@tonic-gate 870Sstevel@tonic-gate /* flags to msync */ 880Sstevel@tonic-gate #define MS_ASYNC 0x1 /* return immediately */ 890Sstevel@tonic-gate #define MS_INVALIDATE 0x2 /* invalidate caches */ 900Sstevel@tonic-gate 910Sstevel@tonic-gate /* functions to mctl */ 920Sstevel@tonic-gate #define MC_SYNC 1 /* sync with backing store */ 930Sstevel@tonic-gate #define MC_LOCK 2 /* lock pages in memory */ 940Sstevel@tonic-gate #define MC_UNLOCK 3 /* unlock pages from memory */ 950Sstevel@tonic-gate #define MC_ADVISE 4 /* give advice to management */ 960Sstevel@tonic-gate #define MC_LOCKAS 5 /* lock address space in memory */ 970Sstevel@tonic-gate #define MC_UNLOCKAS 6 /* unlock address space from memory */ 980Sstevel@tonic-gate 990Sstevel@tonic-gate /* flags to mlockall */ 1000Sstevel@tonic-gate #define MCL_CURRENT 0x1 /* lock current mappings */ 1010Sstevel@tonic-gate #define MCL_FUTURE 0x2 /* lock future mappings */ 1020Sstevel@tonic-gate 103*722Smuffin #endif /* !_sys_mman_h */ 104