mman.h revision bfe60e20c2f727eab7a71b13a2183a856ae0c22f
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#ifndef _SYS_MMAN_H
#define _SYS_MMAN_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/feature_tests.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* 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.
*/
#ifdef _KERNEL
#endif /* _KERNEL */
/* sharing types: must choose either SHARED or PRIVATE */
/* other flags to mmap (or-ed in to MAP_SHARED or MAP_PRIVATE) */
/* these flags not yet implemented */
/* these flags are used by memcntl */
#define SHARED 0x10
#define PRIVATE 0x20
#endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) */
#ifdef _KERNEL
#define PROT_EXCL 0x20
#endif /* _KERNEL */
/*
* 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 will 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.
*/
#endif /* (_POSIX_C_SOURCE <= 2) */
/*
* large file compilation environment setup
*
* In the LP64 compilation environment, map large file interfaces
* back to native versions where possible.
*/
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#endif
#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
#if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#endif
#endif /* _LP64 && _LARGEFILE64_SOURCE */
/*
* Except for old binaries mmap() will return the resultant
* address of mapping on success and (caddr_t)-1 on error.
*/
#ifdef __STDC__
#endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2))... */
/* transitional large file interface version */
!defined(__PRAGMA_REDEFINE_EXTNAME))
#endif /* _LARGEFILE64_SOURCE... */
#else /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
extern int getpagesizes(size_t *, int);
/* guard visibility of uint64_t */
#if defined(_INT64_TYPE)
uint_t *);
#endif /* defined(_INT64_TYPE) */
#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
/* transitional large file interface version */
#ifdef _LARGEFILE64_SOURCE
#endif
#endif /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */
extern int mlockall(int);
extern int munlockall(void);
extern int shm_unlink(const char *);
#endif
/* mmap failure value */
#define MAP_FAILED ((void *) -1)
#else /* __STDC__ */
extern int munmap();
extern int mprotect();
extern int mincore();
extern int memcntl();
extern int msync();
extern int madvise();
extern int getpagesizes();
extern int mlock();
extern int mlockall();
extern int munlock();
extern int munlockall();
extern int meminfo();
extern int shm_open();
extern int shm_unlink();
/* transitional large file interface version */
!defined(__PRAGMA_REDEFINE_EXTNAME))
#endif /* _LARGEFILE64_SOURCE... */
#endif /* __STDC__ */
#endif /* !_ASM && !_KERNEL */
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
#if !defined(_ASM)
/*
* structure for memcntl hat advise operations.
*/
struct memcntl_mha {
};
#if defined(_SYSCALL32)
struct memcntl_mha32 {
};
#endif /* _SYSCALL32 */
#endif /* !defined(_ASM) */
#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
/* advice to madvise */
#define MADV_NORMAL 0 /* no further special treatment */
#endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) ... */
/* flags to msync */
/* modified for UNIX98 compliance */
/* functions to mctl */
/* sub-commands for MC_HAT_ADVISE */
/* for last bss adjacent to */
/* brk area and brk area itself */
/* processes main stack */
#endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) ... */
/* flags to mlockall */
#endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE)) || defined(__EXTENSIONS__) */
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
/* definitions for meminfosys syscall */
#define MISYS_MEMINFO 0x0
#if defined(_INT64_TYPE)
/* private structure for meminfo */
typedef struct meminfo {
int mi_info_count; /* number of pieces of info requested */
} meminfo_t;
#endif /* defined(_INT64_TYPE) */
#if defined(_SYSCALL32)
typedef struct meminfo32 {
} meminfo32_t;
#endif /* defined(_SYSCALL32) */
#endif /* !defined(_ASM) && defined(__STDC__) */
/*
* info_req request type definitions for meminfo
* request types starting with MEMINFO_V are used for Virtual addresses
* and should not be mixed with MEMINFO_PLGRP which is targeted for Physical
* addresses
*/
#define MEMINFO_SHIFT 16
/* maximum number of addresses meminfo() can process at a time */
#define MAX_MEMINFO_CNT 256
/* maximum number of request types */
#define MAX_MEMINFO_REQ 31
#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MMAN_H */