mman.h revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1989 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _sys_mman_h
#define _sys_mman_h
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Protections are chosen from these bits, or-ed together.
* Note - not all implementations literally provide all possible
* combinations. PROT_WRITE is often implemented as (PROT_READ |
* PROT_WRITE) and (PROT_EXECUTE as PROT_READ | PROT_EXECUTE).
* However, no implementation will permit a write to succeed
* where PROT_WRITE has not been set. Also, no implementation will
* allow any access to succeed where prot is specified as PROT_NONE.
*/
#define PROT_READ 0x1 /* pages can be read */
#define PROT_WRITE 0x2 /* pages can be written */
#define PROT_EXEC 0x4 /* pages can be executed */
#define PROT_NONE 0x0 /* pages cannot be accessed */
/* sharing types: must choose either SHARED or PRIVATE */
#define MAP_SHARED 1 /* share changes */
#define MAP_PRIVATE 2 /* changes are private */
#define MAP_TYPE 0xf /* mask for share type */
/* other flags to mmap (or-ed in to MAP_SHARED or MAP_PRIVATE) */
#define MAP_FIXED 0x10 /* user assigns address */
/* these flags not yet implemented */
#define MAP_RENAME 0x20 /* rename private pages to file */
#define MAP_NORESERVE 0x40 /* don't reserve needed swap area */
/*
* For the sake of backward object compatibility, we use the _MAP_NEW flag.
* This flag will be automatically or'ed in by the C library for all
* new mmap calls. Previous binaries with old mmap calls with continue
* to get 0 or -1 for return values. New mmap calls will get the mapped
* address as the return value if successful and -1 on errors. By default,
* new mmap calls automatically have the kernel assign the map address
* unless the MAP_FIXED flag is given.
*/
#define _MAP_NEW 0x80000000 /* user's should not need to use this */
#if !defined(LOCORE) && !defined(KERNEL)
#include <sys/types.h>
/*
* Except for old binaries mmap() will return the resultant
* address of mapping on success and (caddr_t)-1 on error.
*/
extern caddr_t mmap();
#endif /* !LOCORE && !KERNEL */
/* advice to madvise */
#define MADV_NORMAL 0 /* no further special treatment */
#define MADV_RANDOM 1 /* expect random page references */
#define MADV_SEQUENTIAL 2 /* expect sequential page references */
#define MADV_WILLNEED 3 /* will need these pages */
#define MADV_DONTNEED 4 /* don't need these pages */
/* flags to msync */
#define MS_ASYNC 0x1 /* return immediately */
#define MS_INVALIDATE 0x2 /* invalidate caches */
/* functions to mctl */
#define MC_SYNC 1 /* sync with backing store */
#define MC_LOCK 2 /* lock pages in memory */
#define MC_UNLOCK 3 /* unlock pages from memory */
#define MC_ADVISE 4 /* give advice to management */
#define MC_LOCKAS 5 /* lock address space in memory */
#define MC_UNLOCKAS 6 /* unlock address space from memory */
/* flags to mlockall */
#define MCL_CURRENT 0x1 /* lock current mappings */
#define MCL_FUTURE 0x2 /* lock future mappings */
#endif /* !_sys_mman_h */