xref: /onnv-gate/usr/src/uts/common/sys/mman.h (revision 7088:87e6b40103da)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
53383Sdamico  * Common Development and Distribution License (the "License").
63383Sdamico  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21*7088Sraf 
220Sstevel@tonic-gate /*
23*7088Sraf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
280Sstevel@tonic-gate /*	  All Rights Reserved	*/
290Sstevel@tonic-gate 
300Sstevel@tonic-gate /*
310Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
320Sstevel@tonic-gate  * The Regents of the University of California
330Sstevel@tonic-gate  * All Rights Reserved
340Sstevel@tonic-gate  *
350Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
360Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
370Sstevel@tonic-gate  * contributors.
380Sstevel@tonic-gate  */
390Sstevel@tonic-gate 
400Sstevel@tonic-gate #ifndef	_SYS_MMAN_H
410Sstevel@tonic-gate #define	_SYS_MMAN_H
420Sstevel@tonic-gate 
430Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
440Sstevel@tonic-gate 
450Sstevel@tonic-gate #include <sys/feature_tests.h>
460Sstevel@tonic-gate 
470Sstevel@tonic-gate #ifdef	__cplusplus
480Sstevel@tonic-gate extern "C" {
490Sstevel@tonic-gate #endif
500Sstevel@tonic-gate 
510Sstevel@tonic-gate /*
520Sstevel@tonic-gate  * Protections are chosen from these bits, or-ed together.
530Sstevel@tonic-gate  * Note - not all implementations literally provide all possible
540Sstevel@tonic-gate  * combinations.  PROT_WRITE is often implemented as (PROT_READ |
550Sstevel@tonic-gate  * PROT_WRITE) and (PROT_EXECUTE as PROT_READ | PROT_EXECUTE).
560Sstevel@tonic-gate  * However, no implementation will permit a write to succeed
570Sstevel@tonic-gate  * where PROT_WRITE has not been set.  Also, no implementation will
580Sstevel@tonic-gate  * allow any access to succeed where prot is specified as PROT_NONE.
590Sstevel@tonic-gate  */
600Sstevel@tonic-gate #define	PROT_READ	0x1		/* pages can be read */
610Sstevel@tonic-gate #define	PROT_WRITE	0x2		/* pages can be written */
620Sstevel@tonic-gate #define	PROT_EXEC	0x4		/* pages can be executed */
630Sstevel@tonic-gate 
640Sstevel@tonic-gate #ifdef	_KERNEL
650Sstevel@tonic-gate #define	PROT_USER	0x8		/* pages are user accessable */
660Sstevel@tonic-gate #define	PROT_ZFOD	(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_USER)
670Sstevel@tonic-gate #define	PROT_ALL	(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_USER)
680Sstevel@tonic-gate #endif	/* _KERNEL */
690Sstevel@tonic-gate 
700Sstevel@tonic-gate #define	PROT_NONE	0x0		/* pages cannot be accessed */
710Sstevel@tonic-gate 
720Sstevel@tonic-gate /* sharing types:  must choose either SHARED or PRIVATE */
730Sstevel@tonic-gate #define	MAP_SHARED	1		/* share changes */
740Sstevel@tonic-gate #define	MAP_PRIVATE	2		/* changes are private */
750Sstevel@tonic-gate #define	MAP_TYPE	0xf		/* mask for share type */
760Sstevel@tonic-gate 
770Sstevel@tonic-gate /* other flags to mmap (or-ed in to MAP_SHARED or MAP_PRIVATE) */
780Sstevel@tonic-gate #define	MAP_FIXED	0x10		/* user assigns address */
790Sstevel@tonic-gate #define	MAP_NORESERVE	0x40		/* don't reserve needed swap area */
800Sstevel@tonic-gate #define	MAP_ANON	0x100		/* map anonymous pages directly */
810Sstevel@tonic-gate #define	MAP_ANONYMOUS	MAP_ANON	/* (source compatibility) */
820Sstevel@tonic-gate #define	MAP_ALIGN	0x200		/* addr specifies alignment */
830Sstevel@tonic-gate #define	MAP_TEXT	0x400		/* map code segment */
840Sstevel@tonic-gate #define	MAP_INITDATA	0x800		/* map data segment */
850Sstevel@tonic-gate 
864426Saguzovsk #ifdef _KERNEL
874426Saguzovsk #define	_MAP_TEXTREPL	0x1000
884426Saguzovsk #endif /* _KERNEL */
894426Saguzovsk 
900Sstevel@tonic-gate /* these flags not yet implemented */
910Sstevel@tonic-gate #define	MAP_RENAME	0x20		/* rename private pages to file */
920Sstevel@tonic-gate 
930Sstevel@tonic-gate #if	(_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2)
940Sstevel@tonic-gate /* these flags are used by memcntl */
950Sstevel@tonic-gate #define	PROC_TEXT	(PROT_EXEC | PROT_READ)
960Sstevel@tonic-gate #define	PROC_DATA	(PROT_READ | PROT_WRITE | PROT_EXEC)
970Sstevel@tonic-gate #define	SHARED		0x10
980Sstevel@tonic-gate #define	PRIVATE		0x20
990Sstevel@tonic-gate #define	VALID_ATTR  (PROT_READ|PROT_WRITE|PROT_EXEC|SHARED|PRIVATE)
1000Sstevel@tonic-gate #endif	/* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) */
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate #if	(_POSIX_C_SOURCE <= 2) || defined(_XPG4_2)
1030Sstevel@tonic-gate #ifdef	_KERNEL
1040Sstevel@tonic-gate #define	PROT_EXCL	0x20
1050Sstevel@tonic-gate #define	_MAP_LOW32	0x80	/* force mapping in lower 4G of address space */
1060Sstevel@tonic-gate #endif	/* _KERNEL */
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate /*
1090Sstevel@tonic-gate  * For the sake of backward object compatibility, we use the _MAP_NEW flag.
1100Sstevel@tonic-gate  * This flag will be automatically or'ed in by the C library for all
1110Sstevel@tonic-gate  * new mmap calls.  Previous binaries with old mmap calls will continue
1120Sstevel@tonic-gate  * to get 0 or -1 for return values.  New mmap calls will get the mapped
1130Sstevel@tonic-gate  * address as the return value if successful and -1 on errors.  By default,
1140Sstevel@tonic-gate  * new mmap calls automatically have the kernel assign the map address
1150Sstevel@tonic-gate  * unless the MAP_FIXED flag is given.
1160Sstevel@tonic-gate  */
1170Sstevel@tonic-gate #define	_MAP_NEW	0x80000000	/* users should not need to use this */
1180Sstevel@tonic-gate #endif	/* (_POSIX_C_SOURCE <= 2) */
1190Sstevel@tonic-gate 
1200Sstevel@tonic-gate #if	!defined(_ASM) && !defined(_KERNEL)
1210Sstevel@tonic-gate 
1220Sstevel@tonic-gate #include <sys/types.h>
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate /*
1250Sstevel@tonic-gate  * large file compilation environment setup
1260Sstevel@tonic-gate  *
1270Sstevel@tonic-gate  * In the LP64 compilation environment, map large file interfaces
1280Sstevel@tonic-gate  * back to native versions where possible.
1290Sstevel@tonic-gate  */
1300Sstevel@tonic-gate 
1310Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
1320Sstevel@tonic-gate #ifdef	__PRAGMA_REDEFINE_EXTNAME
1330Sstevel@tonic-gate #pragma redefine_extname	mmap	mmap64
1340Sstevel@tonic-gate #else
1350Sstevel@tonic-gate #define	mmap			mmap64
1360Sstevel@tonic-gate #endif
1370Sstevel@tonic-gate #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
1380Sstevel@tonic-gate 
1390Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
1400Sstevel@tonic-gate #ifdef	__PRAGMA_REDEFINE_EXTNAME
1410Sstevel@tonic-gate #pragma	redefine_extname	mmap64	mmap
1420Sstevel@tonic-gate #else
1430Sstevel@tonic-gate #define	mmap64			mmap
1440Sstevel@tonic-gate #endif
1450Sstevel@tonic-gate #endif	/* _LP64 && _LARGEFILE64_SOURCE */
1460Sstevel@tonic-gate 
1475349Skchow #ifdef __PRAGMA_REDEFINE_EXTNAME
1485349Skchow #pragma redefine_extname	getpagesizes	getpagesizes2
1495349Skchow #else
1505349Skchow #define	getpagesizes	getpagesizes2
1515349Skchow #endif
1525349Skchow 
1530Sstevel@tonic-gate /*
1540Sstevel@tonic-gate  * Except for old binaries mmap() will return the resultant
1550Sstevel@tonic-gate  * address of mapping on success and (caddr_t)-1 on error.
1560Sstevel@tonic-gate  */
1570Sstevel@tonic-gate #ifdef	__STDC__
1580Sstevel@tonic-gate #if (_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
1590Sstevel@tonic-gate extern void *mmap(void *, size_t, int, int, int, off_t);
1600Sstevel@tonic-gate extern int munmap(void *, size_t);
1610Sstevel@tonic-gate extern int mprotect(void *, size_t, int);
1620Sstevel@tonic-gate extern int msync(void *, size_t, int);
1630Sstevel@tonic-gate #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__)
1640Sstevel@tonic-gate extern int mlock(const void *, size_t);
1650Sstevel@tonic-gate extern int munlock(const void *, size_t);
1660Sstevel@tonic-gate #endif	/* (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2))... */
1670Sstevel@tonic-gate /* transitional large file interface version */
1680Sstevel@tonic-gate #if	defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
1690Sstevel@tonic-gate 	    !defined(__PRAGMA_REDEFINE_EXTNAME))
1700Sstevel@tonic-gate extern void *mmap64(void *, size_t, int, int, int, off64_t);
1710Sstevel@tonic-gate #endif	/* _LARGEFILE64_SOURCE... */
1720Sstevel@tonic-gate #else	/* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */
1730Sstevel@tonic-gate extern caddr_t mmap(caddr_t, size_t, int, int, int, off_t);
1740Sstevel@tonic-gate extern int munmap(caddr_t, size_t);
1750Sstevel@tonic-gate extern int mprotect(caddr_t, size_t, int);
1760Sstevel@tonic-gate extern int msync(caddr_t, size_t, int);
1770Sstevel@tonic-gate extern int mlock(caddr_t, size_t);
1780Sstevel@tonic-gate extern int munlock(caddr_t, size_t);
1790Sstevel@tonic-gate extern int mincore(caddr_t, size_t, char *);
1800Sstevel@tonic-gate extern int memcntl(caddr_t, size_t, int, caddr_t, int, int);
1810Sstevel@tonic-gate extern int madvise(caddr_t, size_t, int);
1820Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
1830Sstevel@tonic-gate extern int getpagesizes(size_t *, int);
1845349Skchow extern int getpagesizes2(size_t *, int);
1850Sstevel@tonic-gate /* guard visibility of uint64_t */
1860Sstevel@tonic-gate #if defined(_INT64_TYPE)
1870Sstevel@tonic-gate extern int meminfo(const uint64_t *, int, const uint_t *, int, uint64_t *,
1880Sstevel@tonic-gate 	uint_t *);
1890Sstevel@tonic-gate #endif /* defined(_INT64_TYPE) */
1900Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
1910Sstevel@tonic-gate /* transitional large file interface version */
1920Sstevel@tonic-gate #ifdef	_LARGEFILE64_SOURCE
1930Sstevel@tonic-gate extern caddr_t mmap64(caddr_t, size_t, int, int, int, off64_t);
1940Sstevel@tonic-gate #endif
1950Sstevel@tonic-gate #endif	/* (_POSIX_C_SOURCE > 2)  || defined(_XPG4_2) */
1960Sstevel@tonic-gate 
1970Sstevel@tonic-gate #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__)
1980Sstevel@tonic-gate extern int mlockall(int);
1990Sstevel@tonic-gate extern int munlockall(void);
2003383Sdamico extern int shm_open(const char *, int, mode_t);
2013383Sdamico extern int shm_unlink(const char *);
2020Sstevel@tonic-gate #endif
2030Sstevel@tonic-gate 
204*7088Sraf #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
205*7088Sraf extern int posix_madvise(void *, size_t, int);
206*7088Sraf #endif
207*7088Sraf 
2080Sstevel@tonic-gate /* mmap failure value */
2090Sstevel@tonic-gate #define	MAP_FAILED	((void *) -1)
2100Sstevel@tonic-gate 
2110Sstevel@tonic-gate #else	/* __STDC__ */
2120Sstevel@tonic-gate extern caddr_t mmap();
2130Sstevel@tonic-gate extern int munmap();
2140Sstevel@tonic-gate extern int mprotect();
2150Sstevel@tonic-gate extern int mincore();
2160Sstevel@tonic-gate extern int memcntl();
2170Sstevel@tonic-gate extern int msync();
2180Sstevel@tonic-gate extern int madvise();
219*7088Sraf extern int posix_madvise();
2200Sstevel@tonic-gate extern int getpagesizes();
2215349Skchow extern int getpagesizes2();
2220Sstevel@tonic-gate extern int mlock();
2230Sstevel@tonic-gate extern int mlockall();
2240Sstevel@tonic-gate extern int munlock();
2250Sstevel@tonic-gate extern int munlockall();
2260Sstevel@tonic-gate extern int meminfo();
2273383Sdamico extern int shm_open();
2283383Sdamico extern int shm_unlink();
2293383Sdamico 
2300Sstevel@tonic-gate /* transitional large file interface version */
2310Sstevel@tonic-gate #if	defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
2320Sstevel@tonic-gate 	    !defined(__PRAGMA_REDEFINE_EXTNAME))
2330Sstevel@tonic-gate extern caddr_t mmap64();
2340Sstevel@tonic-gate #endif	/* _LARGEFILE64_SOURCE... */
2350Sstevel@tonic-gate #endif	/* __STDC__ */
2360Sstevel@tonic-gate 
2370Sstevel@tonic-gate 
2380Sstevel@tonic-gate #endif	/* !_ASM && !_KERNEL */
2390Sstevel@tonic-gate 
2400Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
2410Sstevel@tonic-gate #if !defined(_ASM)
2420Sstevel@tonic-gate /*
2430Sstevel@tonic-gate  * structure for memcntl hat advise operations.
2440Sstevel@tonic-gate  */
2450Sstevel@tonic-gate struct memcntl_mha {
2460Sstevel@tonic-gate 	uint_t 		mha_cmd;	/* command(s) */
2470Sstevel@tonic-gate 	uint_t		mha_flags;
2480Sstevel@tonic-gate 	size_t		mha_pagesize;
2490Sstevel@tonic-gate };
2500Sstevel@tonic-gate 
2510Sstevel@tonic-gate #if defined(_SYSCALL32)
2520Sstevel@tonic-gate struct memcntl_mha32 {
2530Sstevel@tonic-gate 	uint_t 		mha_cmd;	/* command(s) */
2540Sstevel@tonic-gate 	uint_t		mha_flags;
2550Sstevel@tonic-gate 	size32_t	mha_pagesize;
2560Sstevel@tonic-gate };
2570Sstevel@tonic-gate #endif	/* _SYSCALL32 */
2580Sstevel@tonic-gate #endif	/* !defined(_ASM) */
2590Sstevel@tonic-gate #endif	/* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
2600Sstevel@tonic-gate 
2610Sstevel@tonic-gate #if	(_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) || defined(__EXTENSIONS__)
2620Sstevel@tonic-gate /* advice to madvise */
2630Sstevel@tonic-gate #define	MADV_NORMAL		0	/* no further special treatment */
2640Sstevel@tonic-gate #define	MADV_RANDOM		1	/* expect random page references */
2650Sstevel@tonic-gate #define	MADV_SEQUENTIAL		2	/* expect sequential page references */
2660Sstevel@tonic-gate #define	MADV_WILLNEED		3	/* will need these pages */
2670Sstevel@tonic-gate #define	MADV_DONTNEED		4	/* don't need these pages */
2680Sstevel@tonic-gate #define	MADV_FREE		5	/* contents can be freed */
2690Sstevel@tonic-gate #define	MADV_ACCESS_DEFAULT	6	/* default access */
2700Sstevel@tonic-gate #define	MADV_ACCESS_LWP		7	/* next LWP to access heavily */
2710Sstevel@tonic-gate #define	MADV_ACCESS_MANY	8	/* many processes to access heavily */
2720Sstevel@tonic-gate #endif	/* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) ...  */
2730Sstevel@tonic-gate 
274*7088Sraf #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
275*7088Sraf /* advice to posix_madvise */
276*7088Sraf /* these values must be kept in sync with the MADV_* values, above */
277*7088Sraf #define	POSIX_MADV_NORMAL	0	/* MADV_NORMAL */
278*7088Sraf #define	POSIX_MADV_RANDOM	1	/* MADV_RANDOM */
279*7088Sraf #define	POSIX_MADV_SEQUENTIAL	2	/* MADV_SEQUENTIAL */
280*7088Sraf #define	POSIX_MADV_WILLNEED	3	/* MADV_WILLNEED */
281*7088Sraf #define	POSIX_MADV_DONTNEED	4	/* MADV_DONTNEED */
282*7088Sraf #endif
283*7088Sraf 
2840Sstevel@tonic-gate /* flags to msync */
2850Sstevel@tonic-gate #define	MS_OLDSYNC	0x0		/* old value of MS_SYNC */
2860Sstevel@tonic-gate 					/* modified for UNIX98 compliance */
2870Sstevel@tonic-gate #define	MS_SYNC		0x4		/* wait for msync */
2880Sstevel@tonic-gate #define	MS_ASYNC	0x1		/* return immediately */
2890Sstevel@tonic-gate #define	MS_INVALIDATE	0x2		/* invalidate caches */
2900Sstevel@tonic-gate 
2910Sstevel@tonic-gate #if	(_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) || defined(__EXTENSIONS__)
2920Sstevel@tonic-gate /* functions to mctl */
2930Sstevel@tonic-gate #define	MC_SYNC		1		/* sync with backing store */
2940Sstevel@tonic-gate #define	MC_LOCK		2		/* lock pages in memory */
2950Sstevel@tonic-gate #define	MC_UNLOCK	3		/* unlock pages from memory */
2960Sstevel@tonic-gate #define	MC_ADVISE	4		/* give advice to management */
2970Sstevel@tonic-gate #define	MC_LOCKAS	5		/* lock address space in memory */
2980Sstevel@tonic-gate #define	MC_UNLOCKAS	6		/* unlock address space from memory */
2990Sstevel@tonic-gate #define	MC_HAT_ADVISE	7		/* advise hat map size */
3000Sstevel@tonic-gate 
3010Sstevel@tonic-gate /* sub-commands for MC_HAT_ADVISE */
3020Sstevel@tonic-gate #define	MHA_MAPSIZE_VA		0x1	/* set preferred page size */
3030Sstevel@tonic-gate #define	MHA_MAPSIZE_BSSBRK	0x2	/* set preferred page size */
3040Sstevel@tonic-gate 					/* for last bss adjacent to */
3050Sstevel@tonic-gate 					/* brk area and brk area itself */
3060Sstevel@tonic-gate #define	MHA_MAPSIZE_STACK	0x4	/* set preferred page size */
3070Sstevel@tonic-gate 					/* processes main stack */
3080Sstevel@tonic-gate 
3090Sstevel@tonic-gate #endif	/* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) ... */
3100Sstevel@tonic-gate 
3110Sstevel@tonic-gate #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__)
3120Sstevel@tonic-gate /* flags to mlockall */
3130Sstevel@tonic-gate #define	MCL_CURRENT	0x1		/* lock current mappings */
3140Sstevel@tonic-gate #define	MCL_FUTURE	0x2		/* lock future mappings */
3150Sstevel@tonic-gate #endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE)) || defined(__EXTENSIONS__) */
3160Sstevel@tonic-gate 
3170Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
3180Sstevel@tonic-gate 
3190Sstevel@tonic-gate /* definitions for meminfosys syscall */
3200Sstevel@tonic-gate #define	MISYS_MEMINFO		0x0
3210Sstevel@tonic-gate 
3220Sstevel@tonic-gate #if !defined(_ASM) && defined(__STDC__)
3230Sstevel@tonic-gate 
3240Sstevel@tonic-gate #if defined(_INT64_TYPE)
3250Sstevel@tonic-gate /* private structure for meminfo */
3260Sstevel@tonic-gate typedef struct meminfo {
3270Sstevel@tonic-gate 	const uint64_t *mi_inaddr;	/* array of input addresses */
3280Sstevel@tonic-gate 	const uint_t *mi_info_req;	/* array of types of info requested */
3290Sstevel@tonic-gate 	uint64_t *mi_outdata;		/* array of results are placed */
3300Sstevel@tonic-gate 	uint_t *mi_validity;		/* array of bitwise result codes */
3310Sstevel@tonic-gate 	int mi_info_count;		/* number of pieces of info requested */
3320Sstevel@tonic-gate } meminfo_t;
3330Sstevel@tonic-gate #endif /* defined(_INT64_TYPE) */
3340Sstevel@tonic-gate 
3350Sstevel@tonic-gate #if defined(_SYSCALL32)
3360Sstevel@tonic-gate typedef struct meminfo32 {
3370Sstevel@tonic-gate 	caddr32_t mi_inaddr;	/* array of input addresses */
3380Sstevel@tonic-gate 	caddr32_t mi_info_req;	/* array of types of information requested */
3390Sstevel@tonic-gate 	caddr32_t mi_outdata;	/* array of results are placed */
3400Sstevel@tonic-gate 	caddr32_t mi_validity;	/* array of bitwise result codes */
3410Sstevel@tonic-gate 	int32_t mi_info_count;	/* number of pieces of information requested */
3420Sstevel@tonic-gate } meminfo32_t;
3430Sstevel@tonic-gate #endif /* defined(_SYSCALL32) */
3440Sstevel@tonic-gate 
3450Sstevel@tonic-gate #endif /* !defined(_ASM) && defined(__STDC__) */
3460Sstevel@tonic-gate 
3470Sstevel@tonic-gate /*
3480Sstevel@tonic-gate  * info_req request type definitions for meminfo
3490Sstevel@tonic-gate  * request types starting with MEMINFO_V are used for Virtual addresses
3500Sstevel@tonic-gate  * and should not be mixed with MEMINFO_PLGRP which is targeted for Physical
3510Sstevel@tonic-gate  * addresses
3520Sstevel@tonic-gate  */
3530Sstevel@tonic-gate #define	MEMINFO_SHIFT		16
3540Sstevel@tonic-gate #define	MEMINFO_MASK		(0xFF << MEMINFO_SHIFT)
3550Sstevel@tonic-gate #define	MEMINFO_VPHYSICAL	(0x01 << MEMINFO_SHIFT)	/* get physical addr */
3560Sstevel@tonic-gate #define	MEMINFO_VLGRP		(0x02 << MEMINFO_SHIFT) /* get lgroup */
3570Sstevel@tonic-gate #define	MEMINFO_VPAGESIZE	(0x03 << MEMINFO_SHIFT) /* size of phys page */
3580Sstevel@tonic-gate #define	MEMINFO_VREPLCNT	(0x04 << MEMINFO_SHIFT) /* no. of replica */
3590Sstevel@tonic-gate #define	MEMINFO_VREPL		(0x05 << MEMINFO_SHIFT) /* physical replica */
3600Sstevel@tonic-gate #define	MEMINFO_VREPL_LGRP	(0x06 << MEMINFO_SHIFT) /* lgrp of replica */
3610Sstevel@tonic-gate #define	MEMINFO_PLGRP		(0x07 << MEMINFO_SHIFT) /* lgroup for paddr */
3620Sstevel@tonic-gate 
3630Sstevel@tonic-gate /* maximum number of addresses meminfo() can process at a time */
3640Sstevel@tonic-gate #define	MAX_MEMINFO_CNT	256
3650Sstevel@tonic-gate 
3660Sstevel@tonic-gate /* maximum number of request types */
3670Sstevel@tonic-gate #define	MAX_MEMINFO_REQ	31
3680Sstevel@tonic-gate 
3690Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
3700Sstevel@tonic-gate 
3710Sstevel@tonic-gate #ifdef	__cplusplus
3720Sstevel@tonic-gate }
3730Sstevel@tonic-gate #endif
3740Sstevel@tonic-gate 
3750Sstevel@tonic-gate #endif	/* _SYS_MMAN_H */
376