17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 1989 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _sys_mman_h 287c478bd9Sstevel@tonic-gate #define _sys_mman_h 297c478bd9Sstevel@tonic-gate 30*5d54f3d8Smuffin #pragma ident "%Z%%M% %I% %E% SMI" 31*5d54f3d8Smuffin 327c478bd9Sstevel@tonic-gate /* 337c478bd9Sstevel@tonic-gate * Protections are chosen from these bits, or-ed together. 347c478bd9Sstevel@tonic-gate * Note - not all implementations literally provide all possible 357c478bd9Sstevel@tonic-gate * combinations. PROT_WRITE is often implemented as (PROT_READ | 367c478bd9Sstevel@tonic-gate * PROT_WRITE) and (PROT_EXECUTE as PROT_READ | PROT_EXECUTE). 377c478bd9Sstevel@tonic-gate * However, no implementation will permit a write to succeed 387c478bd9Sstevel@tonic-gate * where PROT_WRITE has not been set. Also, no implementation will 397c478bd9Sstevel@tonic-gate * allow any access to succeed where prot is specified as PROT_NONE. 407c478bd9Sstevel@tonic-gate */ 417c478bd9Sstevel@tonic-gate #define PROT_READ 0x1 /* pages can be read */ 427c478bd9Sstevel@tonic-gate #define PROT_WRITE 0x2 /* pages can be written */ 437c478bd9Sstevel@tonic-gate #define PROT_EXEC 0x4 /* pages can be executed */ 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #define PROT_NONE 0x0 /* pages cannot be accessed */ 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate /* sharing types: must choose either SHARED or PRIVATE */ 487c478bd9Sstevel@tonic-gate #define MAP_SHARED 1 /* share changes */ 497c478bd9Sstevel@tonic-gate #define MAP_PRIVATE 2 /* changes are private */ 507c478bd9Sstevel@tonic-gate #define MAP_TYPE 0xf /* mask for share type */ 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate /* other flags to mmap (or-ed in to MAP_SHARED or MAP_PRIVATE) */ 537c478bd9Sstevel@tonic-gate #define MAP_FIXED 0x10 /* user assigns address */ 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* these flags not yet implemented */ 567c478bd9Sstevel@tonic-gate #define MAP_RENAME 0x20 /* rename private pages to file */ 577c478bd9Sstevel@tonic-gate #define MAP_NORESERVE 0x40 /* don't reserve needed swap area */ 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate /* 607c478bd9Sstevel@tonic-gate * For the sake of backward object compatibility, we use the _MAP_NEW flag. 617c478bd9Sstevel@tonic-gate * This flag will be automatically or'ed in by the C library for all 627c478bd9Sstevel@tonic-gate * new mmap calls. Previous binaries with old mmap calls with continue 637c478bd9Sstevel@tonic-gate * to get 0 or -1 for return values. New mmap calls will get the mapped 647c478bd9Sstevel@tonic-gate * address as the return value if successful and -1 on errors. By default, 657c478bd9Sstevel@tonic-gate * new mmap calls automatically have the kernel assign the map address 667c478bd9Sstevel@tonic-gate * unless the MAP_FIXED flag is given. 677c478bd9Sstevel@tonic-gate */ 687c478bd9Sstevel@tonic-gate #define _MAP_NEW 0x80000000 /* user's should not need to use this */ 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate #if !defined(LOCORE) && !defined(KERNEL) 717c478bd9Sstevel@tonic-gate #include <sys/types.h> 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate /* 747c478bd9Sstevel@tonic-gate * Except for old binaries mmap() will return the resultant 757c478bd9Sstevel@tonic-gate * address of mapping on success and (caddr_t)-1 on error. 767c478bd9Sstevel@tonic-gate */ 777c478bd9Sstevel@tonic-gate extern caddr_t mmap(); 78*5d54f3d8Smuffin #endif /* !LOCORE && !KERNEL */ 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate /* advice to madvise */ 817c478bd9Sstevel@tonic-gate #define MADV_NORMAL 0 /* no further special treatment */ 827c478bd9Sstevel@tonic-gate #define MADV_RANDOM 1 /* expect random page references */ 837c478bd9Sstevel@tonic-gate #define MADV_SEQUENTIAL 2 /* expect sequential page references */ 847c478bd9Sstevel@tonic-gate #define MADV_WILLNEED 3 /* will need these pages */ 857c478bd9Sstevel@tonic-gate #define MADV_DONTNEED 4 /* don't need these pages */ 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate /* flags to msync */ 887c478bd9Sstevel@tonic-gate #define MS_ASYNC 0x1 /* return immediately */ 897c478bd9Sstevel@tonic-gate #define MS_INVALIDATE 0x2 /* invalidate caches */ 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* functions to mctl */ 927c478bd9Sstevel@tonic-gate #define MC_SYNC 1 /* sync with backing store */ 937c478bd9Sstevel@tonic-gate #define MC_LOCK 2 /* lock pages in memory */ 947c478bd9Sstevel@tonic-gate #define MC_UNLOCK 3 /* unlock pages from memory */ 957c478bd9Sstevel@tonic-gate #define MC_ADVISE 4 /* give advice to management */ 967c478bd9Sstevel@tonic-gate #define MC_LOCKAS 5 /* lock address space in memory */ 977c478bd9Sstevel@tonic-gate #define MC_UNLOCKAS 6 /* unlock address space from memory */ 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate /* flags to mlockall */ 1007c478bd9Sstevel@tonic-gate #define MCL_CURRENT 0x1 /* lock current mappings */ 1017c478bd9Sstevel@tonic-gate #define MCL_FUTURE 0x2 /* lock future mappings */ 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #endif /* !_sys_mman_h */ 104