1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 28*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate /* 31*7c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 32*7c478bd9Sstevel@tonic-gate * The Regents of the University of California 33*7c478bd9Sstevel@tonic-gate * All Rights Reserved 34*7c478bd9Sstevel@tonic-gate * 35*7c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 36*7c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 37*7c478bd9Sstevel@tonic-gate * contributors. 38*7c478bd9Sstevel@tonic-gate */ 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #ifndef _SYS_MMAN_H 41*7c478bd9Sstevel@tonic-gate #define _SYS_MMAN_H 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 48*7c478bd9Sstevel@tonic-gate extern "C" { 49*7c478bd9Sstevel@tonic-gate #endif 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate /* 52*7c478bd9Sstevel@tonic-gate * Protections are chosen from these bits, or-ed together. 53*7c478bd9Sstevel@tonic-gate * Note - not all implementations literally provide all possible 54*7c478bd9Sstevel@tonic-gate * combinations. PROT_WRITE is often implemented as (PROT_READ | 55*7c478bd9Sstevel@tonic-gate * PROT_WRITE) and (PROT_EXECUTE as PROT_READ | PROT_EXECUTE). 56*7c478bd9Sstevel@tonic-gate * However, no implementation will permit a write to succeed 57*7c478bd9Sstevel@tonic-gate * where PROT_WRITE has not been set. Also, no implementation will 58*7c478bd9Sstevel@tonic-gate * allow any access to succeed where prot is specified as PROT_NONE. 59*7c478bd9Sstevel@tonic-gate */ 60*7c478bd9Sstevel@tonic-gate #define PROT_READ 0x1 /* pages can be read */ 61*7c478bd9Sstevel@tonic-gate #define PROT_WRITE 0x2 /* pages can be written */ 62*7c478bd9Sstevel@tonic-gate #define PROT_EXEC 0x4 /* pages can be executed */ 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 65*7c478bd9Sstevel@tonic-gate #define PROT_USER 0x8 /* pages are user accessable */ 66*7c478bd9Sstevel@tonic-gate #define PROT_ZFOD (PROT_READ | PROT_WRITE | PROT_EXEC | PROT_USER) 67*7c478bd9Sstevel@tonic-gate #define PROT_ALL (PROT_READ | PROT_WRITE | PROT_EXEC | PROT_USER) 68*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate #define PROT_NONE 0x0 /* pages cannot be accessed */ 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate /* sharing types: must choose either SHARED or PRIVATE */ 73*7c478bd9Sstevel@tonic-gate #define MAP_SHARED 1 /* share changes */ 74*7c478bd9Sstevel@tonic-gate #define MAP_PRIVATE 2 /* changes are private */ 75*7c478bd9Sstevel@tonic-gate #define MAP_TYPE 0xf /* mask for share type */ 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate /* other flags to mmap (or-ed in to MAP_SHARED or MAP_PRIVATE) */ 78*7c478bd9Sstevel@tonic-gate #define MAP_FIXED 0x10 /* user assigns address */ 79*7c478bd9Sstevel@tonic-gate #define MAP_NORESERVE 0x40 /* don't reserve needed swap area */ 80*7c478bd9Sstevel@tonic-gate #define MAP_ANON 0x100 /* map anonymous pages directly */ 81*7c478bd9Sstevel@tonic-gate #define MAP_ANONYMOUS MAP_ANON /* (source compatibility) */ 82*7c478bd9Sstevel@tonic-gate #define MAP_ALIGN 0x200 /* addr specifies alignment */ 83*7c478bd9Sstevel@tonic-gate #define MAP_TEXT 0x400 /* map code segment */ 84*7c478bd9Sstevel@tonic-gate #define MAP_INITDATA 0x800 /* map data segment */ 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate /* these flags not yet implemented */ 87*7c478bd9Sstevel@tonic-gate #define MAP_RENAME 0x20 /* rename private pages to file */ 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate #if (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) 90*7c478bd9Sstevel@tonic-gate /* these flags are used by memcntl */ 91*7c478bd9Sstevel@tonic-gate #define PROC_TEXT (PROT_EXEC | PROT_READ) 92*7c478bd9Sstevel@tonic-gate #define PROC_DATA (PROT_READ | PROT_WRITE | PROT_EXEC) 93*7c478bd9Sstevel@tonic-gate #define SHARED 0x10 94*7c478bd9Sstevel@tonic-gate #define PRIVATE 0x20 95*7c478bd9Sstevel@tonic-gate #define VALID_ATTR (PROT_READ|PROT_WRITE|PROT_EXEC|SHARED|PRIVATE) 96*7c478bd9Sstevel@tonic-gate #endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) */ 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate #if (_POSIX_C_SOURCE <= 2) || defined(_XPG4_2) 99*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 100*7c478bd9Sstevel@tonic-gate #define PROT_EXCL 0x20 101*7c478bd9Sstevel@tonic-gate #define _MAP_LOW32 0x80 /* force mapping in lower 4G of address space */ 102*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 103*7c478bd9Sstevel@tonic-gate 104*7c478bd9Sstevel@tonic-gate /* 105*7c478bd9Sstevel@tonic-gate * For the sake of backward object compatibility, we use the _MAP_NEW flag. 106*7c478bd9Sstevel@tonic-gate * This flag will be automatically or'ed in by the C library for all 107*7c478bd9Sstevel@tonic-gate * new mmap calls. Previous binaries with old mmap calls will continue 108*7c478bd9Sstevel@tonic-gate * to get 0 or -1 for return values. New mmap calls will get the mapped 109*7c478bd9Sstevel@tonic-gate * address as the return value if successful and -1 on errors. By default, 110*7c478bd9Sstevel@tonic-gate * new mmap calls automatically have the kernel assign the map address 111*7c478bd9Sstevel@tonic-gate * unless the MAP_FIXED flag is given. 112*7c478bd9Sstevel@tonic-gate */ 113*7c478bd9Sstevel@tonic-gate #define _MAP_NEW 0x80000000 /* users should not need to use this */ 114*7c478bd9Sstevel@tonic-gate #endif /* (_POSIX_C_SOURCE <= 2) */ 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gate #if !defined(_ASM) && !defined(_KERNEL) 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate /* 121*7c478bd9Sstevel@tonic-gate * large file compilation environment setup 122*7c478bd9Sstevel@tonic-gate * 123*7c478bd9Sstevel@tonic-gate * In the LP64 compilation environment, map large file interfaces 124*7c478bd9Sstevel@tonic-gate * back to native versions where possible. 125*7c478bd9Sstevel@tonic-gate */ 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 128*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 129*7c478bd9Sstevel@tonic-gate #pragma redefine_extname mmap mmap64 130*7c478bd9Sstevel@tonic-gate #else 131*7c478bd9Sstevel@tonic-gate #define mmap mmap64 132*7c478bd9Sstevel@tonic-gate #endif 133*7c478bd9Sstevel@tonic-gate #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ 134*7c478bd9Sstevel@tonic-gate 135*7c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 136*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 137*7c478bd9Sstevel@tonic-gate #pragma redefine_extname mmap64 mmap 138*7c478bd9Sstevel@tonic-gate #else 139*7c478bd9Sstevel@tonic-gate #define mmap64 mmap 140*7c478bd9Sstevel@tonic-gate #endif 141*7c478bd9Sstevel@tonic-gate #endif /* _LP64 && _LARGEFILE64_SOURCE */ 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate /* 144*7c478bd9Sstevel@tonic-gate * Except for old binaries mmap() will return the resultant 145*7c478bd9Sstevel@tonic-gate * address of mapping on success and (caddr_t)-1 on error. 146*7c478bd9Sstevel@tonic-gate */ 147*7c478bd9Sstevel@tonic-gate #ifdef __STDC__ 148*7c478bd9Sstevel@tonic-gate #if (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) 149*7c478bd9Sstevel@tonic-gate extern void *mmap(void *, size_t, int, int, int, off_t); 150*7c478bd9Sstevel@tonic-gate extern int munmap(void *, size_t); 151*7c478bd9Sstevel@tonic-gate extern int mprotect(void *, size_t, int); 152*7c478bd9Sstevel@tonic-gate extern int msync(void *, size_t, int); 153*7c478bd9Sstevel@tonic-gate #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__) 154*7c478bd9Sstevel@tonic-gate extern int mlock(const void *, size_t); 155*7c478bd9Sstevel@tonic-gate extern int munlock(const void *, size_t); 156*7c478bd9Sstevel@tonic-gate extern int shm_open(const char *, int, mode_t); 157*7c478bd9Sstevel@tonic-gate extern int shm_unlink(const char *); 158*7c478bd9Sstevel@tonic-gate #endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2))... */ 159*7c478bd9Sstevel@tonic-gate /* transitional large file interface version */ 160*7c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 161*7c478bd9Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 162*7c478bd9Sstevel@tonic-gate extern void *mmap64(void *, size_t, int, int, int, off64_t); 163*7c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE... */ 164*7c478bd9Sstevel@tonic-gate #else /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */ 165*7c478bd9Sstevel@tonic-gate extern caddr_t mmap(caddr_t, size_t, int, int, int, off_t); 166*7c478bd9Sstevel@tonic-gate extern int munmap(caddr_t, size_t); 167*7c478bd9Sstevel@tonic-gate extern int mprotect(caddr_t, size_t, int); 168*7c478bd9Sstevel@tonic-gate extern int msync(caddr_t, size_t, int); 169*7c478bd9Sstevel@tonic-gate extern int mlock(caddr_t, size_t); 170*7c478bd9Sstevel@tonic-gate extern int munlock(caddr_t, size_t); 171*7c478bd9Sstevel@tonic-gate extern int mincore(caddr_t, size_t, char *); 172*7c478bd9Sstevel@tonic-gate extern int memcntl(caddr_t, size_t, int, caddr_t, int, int); 173*7c478bd9Sstevel@tonic-gate extern int madvise(caddr_t, size_t, int); 174*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 175*7c478bd9Sstevel@tonic-gate extern int getpagesizes(size_t *, int); 176*7c478bd9Sstevel@tonic-gate /* guard visibility of uint64_t */ 177*7c478bd9Sstevel@tonic-gate #if defined(_INT64_TYPE) 178*7c478bd9Sstevel@tonic-gate extern int meminfo(const uint64_t *, int, const uint_t *, int, uint64_t *, 179*7c478bd9Sstevel@tonic-gate uint_t *); 180*7c478bd9Sstevel@tonic-gate #endif /* defined(_INT64_TYPE) */ 181*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 182*7c478bd9Sstevel@tonic-gate /* transitional large file interface version */ 183*7c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE64_SOURCE 184*7c478bd9Sstevel@tonic-gate extern caddr_t mmap64(caddr_t, size_t, int, int, int, off64_t); 185*7c478bd9Sstevel@tonic-gate #endif 186*7c478bd9Sstevel@tonic-gate #endif /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */ 187*7c478bd9Sstevel@tonic-gate 188*7c478bd9Sstevel@tonic-gate #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__) 189*7c478bd9Sstevel@tonic-gate extern int mlockall(int); 190*7c478bd9Sstevel@tonic-gate extern int munlockall(void); 191*7c478bd9Sstevel@tonic-gate #endif 192*7c478bd9Sstevel@tonic-gate 193*7c478bd9Sstevel@tonic-gate /* mmap failure value */ 194*7c478bd9Sstevel@tonic-gate #define MAP_FAILED ((void *) -1) 195*7c478bd9Sstevel@tonic-gate 196*7c478bd9Sstevel@tonic-gate #else /* __STDC__ */ 197*7c478bd9Sstevel@tonic-gate extern caddr_t mmap(); 198*7c478bd9Sstevel@tonic-gate extern int munmap(); 199*7c478bd9Sstevel@tonic-gate extern int mprotect(); 200*7c478bd9Sstevel@tonic-gate extern int mincore(); 201*7c478bd9Sstevel@tonic-gate extern int memcntl(); 202*7c478bd9Sstevel@tonic-gate extern int msync(); 203*7c478bd9Sstevel@tonic-gate extern int madvise(); 204*7c478bd9Sstevel@tonic-gate extern int getpagesizes(); 205*7c478bd9Sstevel@tonic-gate extern int mlock(); 206*7c478bd9Sstevel@tonic-gate extern int mlockall(); 207*7c478bd9Sstevel@tonic-gate extern int munlock(); 208*7c478bd9Sstevel@tonic-gate extern int munlockall(); 209*7c478bd9Sstevel@tonic-gate extern int meminfo(); 210*7c478bd9Sstevel@tonic-gate /* transitional large file interface version */ 211*7c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 212*7c478bd9Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 213*7c478bd9Sstevel@tonic-gate extern caddr_t mmap64(); 214*7c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE... */ 215*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 216*7c478bd9Sstevel@tonic-gate 217*7c478bd9Sstevel@tonic-gate 218*7c478bd9Sstevel@tonic-gate #endif /* !_ASM && !_KERNEL */ 219*7c478bd9Sstevel@tonic-gate 220*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 221*7c478bd9Sstevel@tonic-gate #if !defined(_ASM) 222*7c478bd9Sstevel@tonic-gate /* 223*7c478bd9Sstevel@tonic-gate * structure for memcntl hat advise operations. 224*7c478bd9Sstevel@tonic-gate */ 225*7c478bd9Sstevel@tonic-gate struct memcntl_mha { 226*7c478bd9Sstevel@tonic-gate uint_t mha_cmd; /* command(s) */ 227*7c478bd9Sstevel@tonic-gate uint_t mha_flags; 228*7c478bd9Sstevel@tonic-gate size_t mha_pagesize; 229*7c478bd9Sstevel@tonic-gate }; 230*7c478bd9Sstevel@tonic-gate 231*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 232*7c478bd9Sstevel@tonic-gate struct memcntl_mha32 { 233*7c478bd9Sstevel@tonic-gate uint_t mha_cmd; /* command(s) */ 234*7c478bd9Sstevel@tonic-gate uint_t mha_flags; 235*7c478bd9Sstevel@tonic-gate size32_t mha_pagesize; 236*7c478bd9Sstevel@tonic-gate }; 237*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 238*7c478bd9Sstevel@tonic-gate #endif /* !defined(_ASM) */ 239*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 240*7c478bd9Sstevel@tonic-gate 241*7c478bd9Sstevel@tonic-gate #if (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) || defined(__EXTENSIONS__) 242*7c478bd9Sstevel@tonic-gate /* advice to madvise */ 243*7c478bd9Sstevel@tonic-gate #define MADV_NORMAL 0 /* no further special treatment */ 244*7c478bd9Sstevel@tonic-gate #define MADV_RANDOM 1 /* expect random page references */ 245*7c478bd9Sstevel@tonic-gate #define MADV_SEQUENTIAL 2 /* expect sequential page references */ 246*7c478bd9Sstevel@tonic-gate #define MADV_WILLNEED 3 /* will need these pages */ 247*7c478bd9Sstevel@tonic-gate #define MADV_DONTNEED 4 /* don't need these pages */ 248*7c478bd9Sstevel@tonic-gate #define MADV_FREE 5 /* contents can be freed */ 249*7c478bd9Sstevel@tonic-gate #define MADV_ACCESS_DEFAULT 6 /* default access */ 250*7c478bd9Sstevel@tonic-gate #define MADV_ACCESS_LWP 7 /* next LWP to access heavily */ 251*7c478bd9Sstevel@tonic-gate #define MADV_ACCESS_MANY 8 /* many processes to access heavily */ 252*7c478bd9Sstevel@tonic-gate #endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) ... */ 253*7c478bd9Sstevel@tonic-gate 254*7c478bd9Sstevel@tonic-gate /* flags to msync */ 255*7c478bd9Sstevel@tonic-gate #define MS_OLDSYNC 0x0 /* old value of MS_SYNC */ 256*7c478bd9Sstevel@tonic-gate /* modified for UNIX98 compliance */ 257*7c478bd9Sstevel@tonic-gate #define MS_SYNC 0x4 /* wait for msync */ 258*7c478bd9Sstevel@tonic-gate #define MS_ASYNC 0x1 /* return immediately */ 259*7c478bd9Sstevel@tonic-gate #define MS_INVALIDATE 0x2 /* invalidate caches */ 260*7c478bd9Sstevel@tonic-gate 261*7c478bd9Sstevel@tonic-gate #if (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) || defined(__EXTENSIONS__) 262*7c478bd9Sstevel@tonic-gate /* functions to mctl */ 263*7c478bd9Sstevel@tonic-gate #define MC_SYNC 1 /* sync with backing store */ 264*7c478bd9Sstevel@tonic-gate #define MC_LOCK 2 /* lock pages in memory */ 265*7c478bd9Sstevel@tonic-gate #define MC_UNLOCK 3 /* unlock pages from memory */ 266*7c478bd9Sstevel@tonic-gate #define MC_ADVISE 4 /* give advice to management */ 267*7c478bd9Sstevel@tonic-gate #define MC_LOCKAS 5 /* lock address space in memory */ 268*7c478bd9Sstevel@tonic-gate #define MC_UNLOCKAS 6 /* unlock address space from memory */ 269*7c478bd9Sstevel@tonic-gate #define MC_HAT_ADVISE 7 /* advise hat map size */ 270*7c478bd9Sstevel@tonic-gate 271*7c478bd9Sstevel@tonic-gate /* sub-commands for MC_HAT_ADVISE */ 272*7c478bd9Sstevel@tonic-gate #define MHA_MAPSIZE_VA 0x1 /* set preferred page size */ 273*7c478bd9Sstevel@tonic-gate #define MHA_MAPSIZE_BSSBRK 0x2 /* set preferred page size */ 274*7c478bd9Sstevel@tonic-gate /* for last bss adjacent to */ 275*7c478bd9Sstevel@tonic-gate /* brk area and brk area itself */ 276*7c478bd9Sstevel@tonic-gate #define MHA_MAPSIZE_STACK 0x4 /* set preferred page size */ 277*7c478bd9Sstevel@tonic-gate /* processes main stack */ 278*7c478bd9Sstevel@tonic-gate 279*7c478bd9Sstevel@tonic-gate #endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) ... */ 280*7c478bd9Sstevel@tonic-gate 281*7c478bd9Sstevel@tonic-gate #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__) 282*7c478bd9Sstevel@tonic-gate /* flags to mlockall */ 283*7c478bd9Sstevel@tonic-gate #define MCL_CURRENT 0x1 /* lock current mappings */ 284*7c478bd9Sstevel@tonic-gate #define MCL_FUTURE 0x2 /* lock future mappings */ 285*7c478bd9Sstevel@tonic-gate #endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE)) || defined(__EXTENSIONS__) */ 286*7c478bd9Sstevel@tonic-gate 287*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate /* definitions for meminfosys syscall */ 290*7c478bd9Sstevel@tonic-gate #define MISYS_MEMINFO 0x0 291*7c478bd9Sstevel@tonic-gate 292*7c478bd9Sstevel@tonic-gate #if !defined(_ASM) && defined(__STDC__) 293*7c478bd9Sstevel@tonic-gate 294*7c478bd9Sstevel@tonic-gate #if defined(_INT64_TYPE) 295*7c478bd9Sstevel@tonic-gate /* private structure for meminfo */ 296*7c478bd9Sstevel@tonic-gate typedef struct meminfo { 297*7c478bd9Sstevel@tonic-gate const uint64_t *mi_inaddr; /* array of input addresses */ 298*7c478bd9Sstevel@tonic-gate const uint_t *mi_info_req; /* array of types of info requested */ 299*7c478bd9Sstevel@tonic-gate uint64_t *mi_outdata; /* array of results are placed */ 300*7c478bd9Sstevel@tonic-gate uint_t *mi_validity; /* array of bitwise result codes */ 301*7c478bd9Sstevel@tonic-gate int mi_info_count; /* number of pieces of info requested */ 302*7c478bd9Sstevel@tonic-gate } meminfo_t; 303*7c478bd9Sstevel@tonic-gate #endif /* defined(_INT64_TYPE) */ 304*7c478bd9Sstevel@tonic-gate 305*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 306*7c478bd9Sstevel@tonic-gate typedef struct meminfo32 { 307*7c478bd9Sstevel@tonic-gate caddr32_t mi_inaddr; /* array of input addresses */ 308*7c478bd9Sstevel@tonic-gate caddr32_t mi_info_req; /* array of types of information requested */ 309*7c478bd9Sstevel@tonic-gate caddr32_t mi_outdata; /* array of results are placed */ 310*7c478bd9Sstevel@tonic-gate caddr32_t mi_validity; /* array of bitwise result codes */ 311*7c478bd9Sstevel@tonic-gate int32_t mi_info_count; /* number of pieces of information requested */ 312*7c478bd9Sstevel@tonic-gate } meminfo32_t; 313*7c478bd9Sstevel@tonic-gate #endif /* defined(_SYSCALL32) */ 314*7c478bd9Sstevel@tonic-gate 315*7c478bd9Sstevel@tonic-gate #endif /* !defined(_ASM) && defined(__STDC__) */ 316*7c478bd9Sstevel@tonic-gate 317*7c478bd9Sstevel@tonic-gate /* 318*7c478bd9Sstevel@tonic-gate * info_req request type definitions for meminfo 319*7c478bd9Sstevel@tonic-gate * request types starting with MEMINFO_V are used for Virtual addresses 320*7c478bd9Sstevel@tonic-gate * and should not be mixed with MEMINFO_PLGRP which is targeted for Physical 321*7c478bd9Sstevel@tonic-gate * addresses 322*7c478bd9Sstevel@tonic-gate */ 323*7c478bd9Sstevel@tonic-gate #define MEMINFO_SHIFT 16 324*7c478bd9Sstevel@tonic-gate #define MEMINFO_MASK (0xFF << MEMINFO_SHIFT) 325*7c478bd9Sstevel@tonic-gate #define MEMINFO_VPHYSICAL (0x01 << MEMINFO_SHIFT) /* get physical addr */ 326*7c478bd9Sstevel@tonic-gate #define MEMINFO_VLGRP (0x02 << MEMINFO_SHIFT) /* get lgroup */ 327*7c478bd9Sstevel@tonic-gate #define MEMINFO_VPAGESIZE (0x03 << MEMINFO_SHIFT) /* size of phys page */ 328*7c478bd9Sstevel@tonic-gate #define MEMINFO_VREPLCNT (0x04 << MEMINFO_SHIFT) /* no. of replica */ 329*7c478bd9Sstevel@tonic-gate #define MEMINFO_VREPL (0x05 << MEMINFO_SHIFT) /* physical replica */ 330*7c478bd9Sstevel@tonic-gate #define MEMINFO_VREPL_LGRP (0x06 << MEMINFO_SHIFT) /* lgrp of replica */ 331*7c478bd9Sstevel@tonic-gate #define MEMINFO_PLGRP (0x07 << MEMINFO_SHIFT) /* lgroup for paddr */ 332*7c478bd9Sstevel@tonic-gate 333*7c478bd9Sstevel@tonic-gate /* maximum number of addresses meminfo() can process at a time */ 334*7c478bd9Sstevel@tonic-gate #define MAX_MEMINFO_CNT 256 335*7c478bd9Sstevel@tonic-gate 336*7c478bd9Sstevel@tonic-gate /* maximum number of request types */ 337*7c478bd9Sstevel@tonic-gate #define MAX_MEMINFO_REQ 31 338*7c478bd9Sstevel@tonic-gate 339*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 340*7c478bd9Sstevel@tonic-gate 341*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 342*7c478bd9Sstevel@tonic-gate } 343*7c478bd9Sstevel@tonic-gate #endif 344*7c478bd9Sstevel@tonic-gate 345*7c478bd9Sstevel@tonic-gate #endif /* _SYS_MMAN_H */ 346