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