xref: /onnv-gate/usr/src/uts/common/sys/procfs.h (revision 3235:9af05252020c)
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
52685Sakolb  * Common Development and Distribution License (the "License").
62685Sakolb  * 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  */
212685Sakolb 
220Sstevel@tonic-gate /*
232685Sakolb  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef _SYS_PROCFS_H
280Sstevel@tonic-gate #define	_SYS_PROCFS_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifdef	__cplusplus
330Sstevel@tonic-gate extern "C" {
340Sstevel@tonic-gate #endif
350Sstevel@tonic-gate 
360Sstevel@tonic-gate /*
370Sstevel@tonic-gate  * This definition is temporary.  Structured proc is the preferred API,
380Sstevel@tonic-gate  * and the older ioctl-based interface will be removed in a future version
390Sstevel@tonic-gate  * of Solaris.  Until then, by default, including <sys/procfs.h> will
400Sstevel@tonic-gate  * provide the older ioctl-based /proc definitions.  To get the structured
410Sstevel@tonic-gate  * /proc definitions, either include <procfs.h> or define _STRUCTURED_PROC
420Sstevel@tonic-gate  * to be 1 before including <sys/procfs.h>.
430Sstevel@tonic-gate  */
440Sstevel@tonic-gate #ifndef	_STRUCTURED_PROC
450Sstevel@tonic-gate #define	_STRUCTURED_PROC	0
460Sstevel@tonic-gate #endif
470Sstevel@tonic-gate 
480Sstevel@tonic-gate #if !defined(_KERNEL) && _STRUCTURED_PROC == 0
490Sstevel@tonic-gate 
500Sstevel@tonic-gate #include <sys/old_procfs.h>
510Sstevel@tonic-gate 
520Sstevel@tonic-gate #else	/* !defined(_KERNEL) && _STRUCTURED_PROC == 0 */
530Sstevel@tonic-gate 
540Sstevel@tonic-gate #include <sys/feature_tests.h>
550Sstevel@tonic-gate #include <sys/types.h>
560Sstevel@tonic-gate #include <sys/time_impl.h>
570Sstevel@tonic-gate #include <sys/signal.h>
580Sstevel@tonic-gate #include <sys/siginfo.h>
590Sstevel@tonic-gate #include <sys/fault.h>
600Sstevel@tonic-gate #include <sys/syscall.h>
610Sstevel@tonic-gate #include <sys/pset.h>
620Sstevel@tonic-gate #include <sys/procfs_isa.h>
630Sstevel@tonic-gate #include <sys/priv.h>
640Sstevel@tonic-gate 
650Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
660Sstevel@tonic-gate #error	"Cannot use procfs in the large file compilation environment"
670Sstevel@tonic-gate #endif
680Sstevel@tonic-gate 
690Sstevel@tonic-gate /*
700Sstevel@tonic-gate  * System call interfaces for /proc.
710Sstevel@tonic-gate  */
720Sstevel@tonic-gate 
730Sstevel@tonic-gate /*
740Sstevel@tonic-gate  * Control codes (long values) for messages written to ctl and lwpctl files.
750Sstevel@tonic-gate  */
760Sstevel@tonic-gate #define	PCNULL   0L	/* null request, advance to next message */
770Sstevel@tonic-gate #define	PCSTOP   1L	/* direct process or lwp to stop and wait for stop */
780Sstevel@tonic-gate #define	PCDSTOP  2L	/* direct process or lwp to stop */
790Sstevel@tonic-gate #define	PCWSTOP  3L	/* wait for process or lwp to stop, no timeout */
800Sstevel@tonic-gate #define	PCTWSTOP 4L	/* wait for stop, with long millisecond timeout arg */
810Sstevel@tonic-gate #define	PCRUN    5L	/* make process/lwp runnable, w/ long flags argument */
820Sstevel@tonic-gate #define	PCCSIG   6L	/* clear current signal from lwp */
830Sstevel@tonic-gate #define	PCCFAULT 7L	/* clear current fault from lwp */
840Sstevel@tonic-gate #define	PCSSIG   8L	/* set current signal from siginfo_t argument */
850Sstevel@tonic-gate #define	PCKILL   9L	/* post a signal to process/lwp, long argument */
860Sstevel@tonic-gate #define	PCUNKILL 10L	/* delete a pending signal from process/lwp, long arg */
870Sstevel@tonic-gate #define	PCSHOLD  11L	/* set lwp signal mask from sigset_t argument */
880Sstevel@tonic-gate #define	PCSTRACE 12L	/* set traced signal set from sigset_t argument */
890Sstevel@tonic-gate #define	PCSFAULT 13L	/* set traced fault set from fltset_t argument */
900Sstevel@tonic-gate #define	PCSENTRY 14L	/* set traced syscall entry set from sysset_t arg */
910Sstevel@tonic-gate #define	PCSEXIT  15L	/* set traced syscall exit set from sysset_t arg */
920Sstevel@tonic-gate #define	PCSET    16L	/* set modes from long argument */
930Sstevel@tonic-gate #define	PCUNSET  17L	/* unset modes from long argument */
940Sstevel@tonic-gate #define	PCSREG   18L	/* set lwp general registers from prgregset_t arg */
950Sstevel@tonic-gate #define	PCSFPREG 19L	/* set lwp floating-point registers from prfpregset_t */
960Sstevel@tonic-gate #define	PCSXREG  20L	/* set lwp extra registers from prxregset_t arg */
970Sstevel@tonic-gate #define	PCNICE   21L	/* set nice priority from long argument */
980Sstevel@tonic-gate #define	PCSVADDR 22L	/* set %pc virtual address from long argument */
990Sstevel@tonic-gate #define	PCWATCH  23L	/* set/unset watched memory area from prwatch_t arg */
1000Sstevel@tonic-gate #define	PCAGENT  24L	/* create agent lwp with regs from prgregset_t arg */
1010Sstevel@tonic-gate #define	PCREAD   25L	/* read from the address space via priovec_t arg */
1020Sstevel@tonic-gate #define	PCWRITE  26L	/* write to the address space via priovec_t arg */
1030Sstevel@tonic-gate #define	PCSCRED  27L	/* set process credentials from prcred_t argument */
1040Sstevel@tonic-gate #define	PCSASRS  28L	/* set ancillary state registers from asrset_t arg */
1050Sstevel@tonic-gate #define	PCSPRIV  29L	/* set process privileges from prpriv_t argument */
1060Sstevel@tonic-gate #define	PCSZONE  30L	/* set zoneid from zoneid_t argument */
1070Sstevel@tonic-gate #define	PCSCREDX 31L	/* as PCSCRED but with supplemental groups */
1080Sstevel@tonic-gate /*
1090Sstevel@tonic-gate  * PCRUN long operand flags.
1100Sstevel@tonic-gate  */
1110Sstevel@tonic-gate #define	PRCSIG		0x01	/* clear current signal, if any */
1120Sstevel@tonic-gate #define	PRCFAULT	0x02	/* clear current fault, if any */
1130Sstevel@tonic-gate #define	PRSTEP		0x04	/* direct the lwp to single-step */
1140Sstevel@tonic-gate #define	PRSABORT	0x08	/* abort syscall, if in syscall */
1150Sstevel@tonic-gate #define	PRSTOP		0x10	/* set directed stop request */
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate /*
1180Sstevel@tonic-gate  * lwp status file.  /proc/<pid>/lwp/<lwpid>/lwpstatus
1190Sstevel@tonic-gate  */
1200Sstevel@tonic-gate #define	PRCLSZ		8	/* maximum size of scheduling class name */
1210Sstevel@tonic-gate #define	PRSYSARGS	8	/* maximum number of syscall arguments */
1220Sstevel@tonic-gate typedef struct lwpstatus {
1230Sstevel@tonic-gate 	int	pr_flags;	/* flags (see below) */
1240Sstevel@tonic-gate 	id_t	pr_lwpid;	/* specific lwp identifier */
1250Sstevel@tonic-gate 	short	pr_why;		/* reason for lwp stop, if stopped */
1260Sstevel@tonic-gate 	short	pr_what;	/* more detailed reason */
1270Sstevel@tonic-gate 	short	pr_cursig;	/* current signal, if any */
1280Sstevel@tonic-gate 	short	pr_pad1;
1290Sstevel@tonic-gate 	siginfo_t pr_info;	/* info associated with signal or fault */
1300Sstevel@tonic-gate 	sigset_t pr_lwppend;	/* set of signals pending to the lwp */
1310Sstevel@tonic-gate 	sigset_t pr_lwphold;	/* set of signals blocked by the lwp */
1320Sstevel@tonic-gate 	struct sigaction pr_action;	/* signal action for current signal */
1330Sstevel@tonic-gate 	stack_t	pr_altstack;	/* alternate signal stack info */
1340Sstevel@tonic-gate 	uintptr_t pr_oldcontext;	/* address of previous ucontext */
1350Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
1360Sstevel@tonic-gate 	short	pr_nsysarg;	/* number of arguments to this syscall */
1370Sstevel@tonic-gate 	int	pr_errno;	/* errno for failed syscall, 0 if successful */
1380Sstevel@tonic-gate 	long	pr_sysarg[PRSYSARGS];	/* arguments to this syscall */
1390Sstevel@tonic-gate 	long	pr_rval1;	/* primary syscall return value */
1400Sstevel@tonic-gate 	long	pr_rval2;	/* second syscall return value, if any */
1410Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
1420Sstevel@tonic-gate 	timestruc_t pr_tstamp;	/* real-time time stamp of stop */
1430Sstevel@tonic-gate 	timestruc_t pr_utime;	/* lwp user cpu time */
1440Sstevel@tonic-gate 	timestruc_t pr_stime;	/* lwp system cpu time */
1450Sstevel@tonic-gate 	int	pr_filler[11 - 2 * sizeof (timestruc_t) / sizeof (int)];
1460Sstevel@tonic-gate 	int	pr_errpriv;	/* missing privilege */
1470Sstevel@tonic-gate 	uintptr_t pr_ustack;	/* address of stack boundary data (stack_t) */
1480Sstevel@tonic-gate 	ulong_t	pr_instr;	/* current instruction */
1490Sstevel@tonic-gate 	prgregset_t pr_reg;	/* general registers */
1500Sstevel@tonic-gate 	prfpregset_t pr_fpreg;	/* floating-point registers */
1510Sstevel@tonic-gate } lwpstatus_t;
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate /*
1540Sstevel@tonic-gate  * process status file.  /proc/<pid>/status
1550Sstevel@tonic-gate  */
1560Sstevel@tonic-gate typedef struct pstatus {
1570Sstevel@tonic-gate 	int	pr_flags;	/* flags (see below) */
1580Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
1590Sstevel@tonic-gate 	pid_t	pr_pid;		/* process id */
1600Sstevel@tonic-gate 	pid_t	pr_ppid;	/* parent process id */
1610Sstevel@tonic-gate 	pid_t	pr_pgid;	/* process group id */
1620Sstevel@tonic-gate 	pid_t	pr_sid;		/* session id */
1630Sstevel@tonic-gate 	id_t	pr_aslwpid;	/* historical; now always zero */
1640Sstevel@tonic-gate 	id_t	pr_agentid;	/* lwp id of the /proc agent lwp, if any */
1650Sstevel@tonic-gate 	sigset_t pr_sigpend;	/* set of process pending signals */
1660Sstevel@tonic-gate 	uintptr_t pr_brkbase;	/* address of the process heap */
1670Sstevel@tonic-gate 	size_t	pr_brksize;	/* size of the process heap, in bytes */
1680Sstevel@tonic-gate 	uintptr_t pr_stkbase;	/* address of the process stack */
1690Sstevel@tonic-gate 	size_t	pr_stksize;	/* size of the process stack, in bytes */
1700Sstevel@tonic-gate 	timestruc_t pr_utime;	/* process user cpu time */
1710Sstevel@tonic-gate 	timestruc_t pr_stime;	/* process system cpu time */
1720Sstevel@tonic-gate 	timestruc_t pr_cutime;	/* sum of children's user times */
1730Sstevel@tonic-gate 	timestruc_t pr_cstime;	/* sum of children's system times */
1740Sstevel@tonic-gate 	sigset_t pr_sigtrace;	/* set of traced signals */
1750Sstevel@tonic-gate 	fltset_t pr_flttrace;	/* set of traced faults */
1760Sstevel@tonic-gate 	sysset_t pr_sysentry;	/* set of system calls traced on entry */
1770Sstevel@tonic-gate 	sysset_t pr_sysexit;	/* set of system calls traced on exit */
1780Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process (see below) */
1790Sstevel@tonic-gate 	char	pr_pad[3];
1800Sstevel@tonic-gate 	taskid_t pr_taskid;	/* task id */
1810Sstevel@tonic-gate 	projid_t pr_projid;	/* project id */
1820Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
1830Sstevel@tonic-gate 	zoneid_t pr_zoneid;	/* zone id */
1840Sstevel@tonic-gate 	int	pr_filler[15];	/* reserved for future use */
1850Sstevel@tonic-gate 	lwpstatus_t pr_lwp;	/* status of the representative lwp */
1860Sstevel@tonic-gate } pstatus_t;
1870Sstevel@tonic-gate 
1880Sstevel@tonic-gate /*
1890Sstevel@tonic-gate  * pr_flags (same values appear in both pstatus_t and lwpstatus_t pr_flags).
1900Sstevel@tonic-gate  *
1910Sstevel@tonic-gate  * These flags do *not* apply to psinfo_t.pr_flag or lwpsinfo_t.pr_flag
1920Sstevel@tonic-gate  * (which are both deprecated).
1930Sstevel@tonic-gate  */
1940Sstevel@tonic-gate /* The following flags apply to the specific or representative lwp */
1950Sstevel@tonic-gate #define	PR_STOPPED 0x00000001	/* lwp is stopped */
1960Sstevel@tonic-gate #define	PR_ISTOP   0x00000002	/* lwp is stopped on an event of interest */
1970Sstevel@tonic-gate #define	PR_DSTOP   0x00000004	/* lwp has a stop directive in effect */
1980Sstevel@tonic-gate #define	PR_STEP	   0x00000008	/* lwp has a single-step directive in effect */
1990Sstevel@tonic-gate #define	PR_ASLEEP  0x00000010	/* lwp is sleeping in a system call */
2000Sstevel@tonic-gate #define	PR_PCINVAL 0x00000020	/* contents of pr_instr undefined */
2010Sstevel@tonic-gate #define	PR_ASLWP   0x00000040	/* obsolete flag; never set */
2020Sstevel@tonic-gate #define	PR_AGENT   0x00000080	/* this lwp is the /proc agent lwp */
2030Sstevel@tonic-gate #define	PR_DETACH  0x00000100	/* this is a detached lwp */
2040Sstevel@tonic-gate #define	PR_DAEMON  0x00000200	/* this is a daemon lwp */
205*3235Sraf #define	PR_IDLE    0x00000400	/* lwp is a cpu's idle thread */
2060Sstevel@tonic-gate /* The following flags apply to the process, not to an individual lwp */
2070Sstevel@tonic-gate #define	PR_ISSYS   0x00001000	/* this is a system process */
2080Sstevel@tonic-gate #define	PR_VFORKP  0x00002000	/* process is the parent of a vfork()d child */
2090Sstevel@tonic-gate #define	PR_ORPHAN  0x00004000	/* process's process group is orphaned */
210*3235Sraf #define	PR_NOSIGCHLD 0x00008000	/* process will not generate SIGCHLD on exit */
211*3235Sraf #define	PR_WAITPID 0x00010000	/* only waitid(P_PID, pid) can reap the child */
2120Sstevel@tonic-gate /* The following process flags are modes settable by PCSET/PCUNSET */
2130Sstevel@tonic-gate #define	PR_FORK	   0x00100000	/* inherit-on-fork is in effect */
2140Sstevel@tonic-gate #define	PR_RLC	   0x00200000	/* run-on-last-close is in effect */
2150Sstevel@tonic-gate #define	PR_KLC	   0x00400000	/* kill-on-last-close is in effect */
2160Sstevel@tonic-gate #define	PR_ASYNC   0x00800000	/* asynchronous-stop is in effect */
2170Sstevel@tonic-gate #define	PR_MSACCT  0x01000000	/* micro-state usage accounting is in effect */
2180Sstevel@tonic-gate #define	PR_BPTADJ  0x02000000	/* breakpoint trap pc adjustment is in effect */
2190Sstevel@tonic-gate #define	PR_PTRACE  0x04000000	/* ptrace-compatibility mode is in effect */
2200Sstevel@tonic-gate #define	PR_MSFORK  0x08000000	/* micro-state accounting inherited on fork */
2210Sstevel@tonic-gate 
2220Sstevel@tonic-gate /*
2230Sstevel@tonic-gate  * See <sys/procfs_isa.h> for possible values of pr_dmodel.
2240Sstevel@tonic-gate  */
2250Sstevel@tonic-gate 
2260Sstevel@tonic-gate /*
2270Sstevel@tonic-gate  * Reasons for stopping (pr_why).
2280Sstevel@tonic-gate  */
2290Sstevel@tonic-gate #define	PR_REQUESTED	1
2300Sstevel@tonic-gate #define	PR_SIGNALLED	2
2310Sstevel@tonic-gate #define	PR_SYSENTRY	3
2320Sstevel@tonic-gate #define	PR_SYSEXIT	4
2330Sstevel@tonic-gate #define	PR_JOBCONTROL	5
2340Sstevel@tonic-gate #define	PR_FAULTED	6
2350Sstevel@tonic-gate #define	PR_SUSPENDED	7
2360Sstevel@tonic-gate #define	PR_CHECKPOINT	8
2370Sstevel@tonic-gate 
2380Sstevel@tonic-gate /*
2390Sstevel@tonic-gate  * lwp ps(1) information file.  /proc/<pid>/lwp/<lwpid>/lwpsinfo
2400Sstevel@tonic-gate  */
2410Sstevel@tonic-gate #define	PRFNSZ		16	/* Maximum size of execed filename */
2420Sstevel@tonic-gate typedef struct lwpsinfo {
2430Sstevel@tonic-gate 	int	pr_flag;	/* lwp flags (DEPRECATED; do not use) */
2440Sstevel@tonic-gate 	id_t	pr_lwpid;	/* lwp id */
2450Sstevel@tonic-gate 	uintptr_t pr_addr;	/* internal address of lwp */
2460Sstevel@tonic-gate 	uintptr_t pr_wchan;	/* wait addr for sleeping lwp */
2470Sstevel@tonic-gate 	char	pr_stype;	/* synchronization event type */
2480Sstevel@tonic-gate 	char	pr_state;	/* numeric lwp state */
2490Sstevel@tonic-gate 	char	pr_sname;	/* printable character for pr_state */
2500Sstevel@tonic-gate 	char	pr_nice;	/* nice for cpu usage */
2510Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
2520Sstevel@tonic-gate 	char	pr_oldpri;	/* pre-SVR4, low value is high priority */
2530Sstevel@tonic-gate 	char	pr_cpu;		/* pre-SVR4, cpu usage for scheduling */
2540Sstevel@tonic-gate 	int	pr_pri;		/* priority, high value is high priority */
2550Sstevel@tonic-gate 			/* The following percent number is a 16-bit binary */
2560Sstevel@tonic-gate 			/* fraction [0 .. 1] with the binary point to the */
2570Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
2580Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by this lwp */
2590Sstevel@tonic-gate 	ushort_t pr_pad;
2600Sstevel@tonic-gate 	timestruc_t pr_start;	/* lwp start time, from the epoch */
2610Sstevel@tonic-gate 	timestruc_t pr_time;	/* usr+sys cpu time for this lwp */
2620Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
2630Sstevel@tonic-gate 	char	pr_name[PRFNSZ];	/* name of system lwp */
2640Sstevel@tonic-gate 	processorid_t pr_onpro;		/* processor which last ran this lwp */
2650Sstevel@tonic-gate 	processorid_t pr_bindpro;	/* processor to which lwp is bound */
2660Sstevel@tonic-gate 	psetid_t pr_bindpset;	/* processor set to which lwp is bound */
2672690Sakolb 	int	pr_lgrp;	/* lwp home lgroup */
2682685Sakolb 	int	pr_filler[4];	/* reserved for future use */
2690Sstevel@tonic-gate } lwpsinfo_t;
2700Sstevel@tonic-gate 
2710Sstevel@tonic-gate /*
2720Sstevel@tonic-gate  * process ps(1) information file.  /proc/<pid>/psinfo
2730Sstevel@tonic-gate  */
2740Sstevel@tonic-gate #define	PRARGSZ		80	/* number of chars of arguments */
2750Sstevel@tonic-gate typedef struct psinfo {
2760Sstevel@tonic-gate 	int	pr_flag;	/* process flags (DEPRECATED; do not use) */
2770Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
2780Sstevel@tonic-gate 	pid_t	pr_pid;		/* unique process id */
2790Sstevel@tonic-gate 	pid_t	pr_ppid;	/* process id of parent */
2800Sstevel@tonic-gate 	pid_t	pr_pgid;	/* pid of process group leader */
2810Sstevel@tonic-gate 	pid_t	pr_sid;		/* session id */
2820Sstevel@tonic-gate 	uid_t	pr_uid;		/* real user id */
2830Sstevel@tonic-gate 	uid_t	pr_euid;	/* effective user id */
2840Sstevel@tonic-gate 	gid_t	pr_gid;		/* real group id */
2850Sstevel@tonic-gate 	gid_t	pr_egid;	/* effective group id */
2860Sstevel@tonic-gate 	uintptr_t pr_addr;	/* address of process */
2870Sstevel@tonic-gate 	size_t	pr_size;	/* size of process image in Kbytes */
2880Sstevel@tonic-gate 	size_t	pr_rssize;	/* resident set size in Kbytes */
2890Sstevel@tonic-gate 	size_t	pr_pad1;
2900Sstevel@tonic-gate 	dev_t	pr_ttydev;	/* controlling tty device (or PRNODEV) */
2910Sstevel@tonic-gate 			/* The following percent numbers are 16-bit binary */
2920Sstevel@tonic-gate 			/* fractions [0 .. 1] with the binary point to the */
2930Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
2940Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by all lwps */
2950Sstevel@tonic-gate 	ushort_t pr_pctmem;	/* % of system memory used by process */
2960Sstevel@tonic-gate 	timestruc_t pr_start;	/* process start time, from the epoch */
2970Sstevel@tonic-gate 	timestruc_t pr_time;	/* usr+sys cpu time for this process */
2980Sstevel@tonic-gate 	timestruc_t pr_ctime;	/* usr+sys cpu time for reaped children */
2990Sstevel@tonic-gate 	char	pr_fname[PRFNSZ];	/* name of execed file */
3000Sstevel@tonic-gate 	char	pr_psargs[PRARGSZ];	/* initial characters of arg list */
3010Sstevel@tonic-gate 	int	pr_wstat;	/* if zombie, the wait() status */
3020Sstevel@tonic-gate 	int	pr_argc;	/* initial argument count */
3030Sstevel@tonic-gate 	uintptr_t pr_argv;	/* address of initial argument vector */
3040Sstevel@tonic-gate 	uintptr_t pr_envp;	/* address of initial environment vector */
3050Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
3060Sstevel@tonic-gate 	char	pr_pad2[3];
3070Sstevel@tonic-gate 	taskid_t pr_taskid;	/* task id */
3080Sstevel@tonic-gate 	projid_t pr_projid;	/* project id */
3090Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
3100Sstevel@tonic-gate 	poolid_t pr_poolid;	/* pool id */
3110Sstevel@tonic-gate 	zoneid_t pr_zoneid;	/* zone id */
3120Sstevel@tonic-gate 	id_t	pr_contract;	/* process contract */
3130Sstevel@tonic-gate 	int	pr_filler[1];	/* reserved for future use */
3140Sstevel@tonic-gate 	lwpsinfo_t pr_lwp;	/* information for representative lwp */
3150Sstevel@tonic-gate } psinfo_t;
3160Sstevel@tonic-gate 
3170Sstevel@tonic-gate #define	PRNODEV	(dev_t)(-1)	/* non-existent device */
3180Sstevel@tonic-gate 
3190Sstevel@tonic-gate /*
3200Sstevel@tonic-gate  * Memory-map interface.  /proc/<pid>/map /proc/<pid>/rmap
3210Sstevel@tonic-gate  */
3220Sstevel@tonic-gate #define	PRMAPSZ	64
3230Sstevel@tonic-gate typedef struct prmap {
3240Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
3250Sstevel@tonic-gate 	size_t	pr_size;	/* size of mapping in bytes */
3260Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
3270Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
3280Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
3290Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
3300Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
3310Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
3320Sstevel@tonic-gate } prmap_t;
3330Sstevel@tonic-gate 
3340Sstevel@tonic-gate /*
3350Sstevel@tonic-gate  * HAT memory-map interface.  /proc/<pid>/xmap
3360Sstevel@tonic-gate  */
3370Sstevel@tonic-gate typedef struct prxmap {
3380Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
3390Sstevel@tonic-gate 	size_t	pr_size;	/* size of mapping in bytes */
3400Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
3410Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
3420Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
3430Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
3440Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
3450Sstevel@tonic-gate 	dev_t	pr_dev;	/* st_dev from stat64() of mapped object, or PRNODEV */
3460Sstevel@tonic-gate 	uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */
3473041Selowe 	size_t	pr_rss; 	/* pages of resident memory */
3483041Selowe 	size_t	pr_anon;	/* pages of resident anonymous memory */
3493041Selowe 	size_t	pr_locked;	/* pages of locked memory */
3503041Selowe 	size_t	pr_pad;		/* currently unused */
3513041Selowe 	uint64_t pr_hatpagesize; /* pagesize of the hat mapping */
3523041Selowe #ifdef	_ILP32
3533041Selowe 	ulong_t	pr_filler[6];	/* filler for future expansion */
3543041Selowe #else
3553041Selowe 	ulong_t pr_filler[7];	/* filler for future expansion */
3563041Selowe #endif
3570Sstevel@tonic-gate } prxmap_t;
3580Sstevel@tonic-gate 
3590Sstevel@tonic-gate 
3600Sstevel@tonic-gate /* Protection and attribute flags */
3610Sstevel@tonic-gate #define	MA_READ		0x04	/* readable by the traced process */
3620Sstevel@tonic-gate #define	MA_WRITE	0x02	/* writable by the traced process */
3630Sstevel@tonic-gate #define	MA_EXEC		0x01	/* executable by the traced process */
3640Sstevel@tonic-gate #define	MA_SHARED	0x08	/* changes are shared by mapped object */
3650Sstevel@tonic-gate #define	MA_ANON		0x40	/* anonymous memory (e.g. /dev/zero) */
3660Sstevel@tonic-gate #define	MA_ISM		0x80	/* intimate shared mem (shared MMU resources) */
3670Sstevel@tonic-gate #define	MA_NORESERVE	0x100	/* mapped with MAP_NORESERVE */
3680Sstevel@tonic-gate #define	MA_SHM		0x200	/* System V shared memory */
3690Sstevel@tonic-gate #define	MA_RESERVED1	0x400	/* reserved for future use */
3700Sstevel@tonic-gate 
3710Sstevel@tonic-gate /*
3720Sstevel@tonic-gate  * These are obsolete and unreliable.
3730Sstevel@tonic-gate  * They are included here only for historical compatibility.
3740Sstevel@tonic-gate  */
3750Sstevel@tonic-gate #define	MA_BREAK	0x10	/* grown by brk(2) */
3760Sstevel@tonic-gate #define	MA_STACK	0x20	/* grown automatically on stack faults */
3770Sstevel@tonic-gate 
3780Sstevel@tonic-gate /*
3790Sstevel@tonic-gate  * Process credentials.  PCSCRED and /proc/<pid>/cred
3800Sstevel@tonic-gate  */
3810Sstevel@tonic-gate typedef struct prcred {
3820Sstevel@tonic-gate 	uid_t	pr_euid;	/* effective user id */
3830Sstevel@tonic-gate 	uid_t	pr_ruid;	/* real user id */
3840Sstevel@tonic-gate 	uid_t	pr_suid;	/* saved user id (from exec) */
3850Sstevel@tonic-gate 	gid_t	pr_egid;	/* effective group id */
3860Sstevel@tonic-gate 	gid_t	pr_rgid;	/* real group id */
3870Sstevel@tonic-gate 	gid_t	pr_sgid;	/* saved group id (from exec) */
3880Sstevel@tonic-gate 	int	pr_ngroups;	/* number of supplementary groups */
3890Sstevel@tonic-gate 	gid_t	pr_groups[1];	/* array of supplementary groups */
3900Sstevel@tonic-gate } prcred_t;
3910Sstevel@tonic-gate 
3920Sstevel@tonic-gate /*
3930Sstevel@tonic-gate  * Process privileges.  PCSPRIV and /proc/<pid>/priv
3940Sstevel@tonic-gate  */
3950Sstevel@tonic-gate typedef struct prpriv {
3960Sstevel@tonic-gate 	uint32_t	pr_nsets;		/* number of privilege set */
3970Sstevel@tonic-gate 	uint32_t	pr_setsize;		/* size of privilege set */
3980Sstevel@tonic-gate 	uint32_t	pr_infosize;		/* size of supplementary data */
3990Sstevel@tonic-gate 	priv_chunk_t	pr_sets[1];		/* array of sets */
4000Sstevel@tonic-gate } prpriv_t;
4010Sstevel@tonic-gate 
4020Sstevel@tonic-gate /*
4030Sstevel@tonic-gate  * Watchpoint interface.  PCWATCH and /proc/<pid>/watch
4040Sstevel@tonic-gate  */
4050Sstevel@tonic-gate typedef struct prwatch {
4060Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of watched area */
4070Sstevel@tonic-gate 	size_t	pr_size;	/* size of watched area in bytes */
4080Sstevel@tonic-gate 	int	pr_wflags;	/* watch type flags */
4090Sstevel@tonic-gate 	int	pr_pad;
4100Sstevel@tonic-gate } prwatch_t;
4110Sstevel@tonic-gate 
4120Sstevel@tonic-gate /* pr_wflags */
4130Sstevel@tonic-gate #define	WA_READ		0x04	/* trap on read access */
4140Sstevel@tonic-gate #define	WA_WRITE	0x02	/* trap on write access */
4150Sstevel@tonic-gate #define	WA_EXEC		0x01	/* trap on execute access */
4160Sstevel@tonic-gate #define	WA_TRAPAFTER	0x08	/* trap after instruction completes */
4170Sstevel@tonic-gate 
4180Sstevel@tonic-gate /*
4190Sstevel@tonic-gate  * PCREAD/PCWRITE I/O interface.
4200Sstevel@tonic-gate  */
4210Sstevel@tonic-gate typedef struct priovec {
4220Sstevel@tonic-gate 	void	*pio_base;	/* buffer in controlling process */
4230Sstevel@tonic-gate 	size_t	pio_len;	/* size of read/write request */
4240Sstevel@tonic-gate 	off_t	pio_offset;	/* virtual address in target process */
4250Sstevel@tonic-gate } priovec_t;
4260Sstevel@tonic-gate 
4270Sstevel@tonic-gate /*
4280Sstevel@tonic-gate  * Resource usage.  /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage
4290Sstevel@tonic-gate  */
4300Sstevel@tonic-gate typedef struct prusage {
4310Sstevel@tonic-gate 	id_t		pr_lwpid;	/* lwp id.  0: process or defunct */
4320Sstevel@tonic-gate 	int		pr_count;	/* number of contributing lwps */
4330Sstevel@tonic-gate 	timestruc_t	pr_tstamp;	/* current time stamp */
4340Sstevel@tonic-gate 	timestruc_t	pr_create;	/* process/lwp creation time stamp */
4350Sstevel@tonic-gate 	timestruc_t	pr_term;	/* process/lwp termination time stamp */
4360Sstevel@tonic-gate 	timestruc_t	pr_rtime;	/* total lwp real (elapsed) time */
4370Sstevel@tonic-gate 	timestruc_t	pr_utime;	/* user level cpu time */
4380Sstevel@tonic-gate 	timestruc_t	pr_stime;	/* system call cpu time */
4390Sstevel@tonic-gate 	timestruc_t	pr_ttime;	/* other system trap cpu time */
4400Sstevel@tonic-gate 	timestruc_t	pr_tftime;	/* text page fault sleep time */
4410Sstevel@tonic-gate 	timestruc_t	pr_dftime;	/* data page fault sleep time */
4420Sstevel@tonic-gate 	timestruc_t	pr_kftime;	/* kernel page fault sleep time */
4430Sstevel@tonic-gate 	timestruc_t	pr_ltime;	/* user lock wait sleep time */
4440Sstevel@tonic-gate 	timestruc_t	pr_slptime;	/* all other sleep time */
4450Sstevel@tonic-gate 	timestruc_t	pr_wtime;	/* wait-cpu (latency) time */
4460Sstevel@tonic-gate 	timestruc_t	pr_stoptime;	/* stopped time */
4470Sstevel@tonic-gate 	timestruc_t	filltime[6];	/* filler for future expansion */
4480Sstevel@tonic-gate 	ulong_t		pr_minf;	/* minor page faults */
4490Sstevel@tonic-gate 	ulong_t		pr_majf;	/* major page faults */
4500Sstevel@tonic-gate 	ulong_t		pr_nswap;	/* swaps */
4510Sstevel@tonic-gate 	ulong_t		pr_inblk;	/* input blocks */
4520Sstevel@tonic-gate 	ulong_t		pr_oublk;	/* output blocks */
4530Sstevel@tonic-gate 	ulong_t		pr_msnd;	/* messages sent */
4540Sstevel@tonic-gate 	ulong_t		pr_mrcv;	/* messages received */
4550Sstevel@tonic-gate 	ulong_t		pr_sigs;	/* signals received */
4560Sstevel@tonic-gate 	ulong_t		pr_vctx;	/* voluntary context switches */
4570Sstevel@tonic-gate 	ulong_t		pr_ictx;	/* involuntary context switches */
4580Sstevel@tonic-gate 	ulong_t		pr_sysc;	/* system calls */
4590Sstevel@tonic-gate 	ulong_t		pr_ioch;	/* chars read and written */
4600Sstevel@tonic-gate 	ulong_t		filler[10];	/* filler for future expansion */
4610Sstevel@tonic-gate } prusage_t;
4620Sstevel@tonic-gate 
4630Sstevel@tonic-gate /*
4640Sstevel@tonic-gate  * Page data file.  /proc/<pid>/pagedata
4650Sstevel@tonic-gate  */
4660Sstevel@tonic-gate 
4670Sstevel@tonic-gate /* page data file header */
4680Sstevel@tonic-gate typedef struct prpageheader {
4690Sstevel@tonic-gate 	timestruc_t	pr_tstamp;	/* real time stamp */
4700Sstevel@tonic-gate 	long		pr_nmap;	/* number of address space mappings */
4710Sstevel@tonic-gate 	long		pr_npage;	/* total number of pages */
4720Sstevel@tonic-gate } prpageheader_t;
4730Sstevel@tonic-gate 
4740Sstevel@tonic-gate /* page data mapping header */
4750Sstevel@tonic-gate typedef struct prasmap {
4760Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
4770Sstevel@tonic-gate 	size_t	pr_npage;	/* number of pages in mapping */
4780Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
4790Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
4800Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
4810Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
4820Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
4830Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
4840Sstevel@tonic-gate } prasmap_t;
4850Sstevel@tonic-gate 
4860Sstevel@tonic-gate /*
4870Sstevel@tonic-gate  * pr_npage bytes (plus 0-7 null bytes to round up to an 8-byte boundary)
4880Sstevel@tonic-gate  * follow each mapping header, each containing zero or more of these flags.
4890Sstevel@tonic-gate  */
4900Sstevel@tonic-gate #define	PG_REFERENCED	0x02		/* page referenced since last read */
4910Sstevel@tonic-gate #define	PG_MODIFIED	0x01		/* page modified since last read */
4920Sstevel@tonic-gate #define	PG_HWMAPPED	0x04		/* page is present and mapped */
4930Sstevel@tonic-gate 
4940Sstevel@tonic-gate /*
4950Sstevel@tonic-gate  * Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
4960Sstevel@tonic-gate  */
4970Sstevel@tonic-gate typedef struct prheader {
4980Sstevel@tonic-gate 	long	pr_nent;	/* number of entries */
4990Sstevel@tonic-gate 	long	pr_entsize;	/* size of each entry, in bytes */
5000Sstevel@tonic-gate } prheader_t;
5010Sstevel@tonic-gate 
5020Sstevel@tonic-gate /*
5030Sstevel@tonic-gate  * Macros for manipulating sets of flags.
5040Sstevel@tonic-gate  * sp must be a pointer to one of sigset_t, fltset_t, or sysset_t.
5050Sstevel@tonic-gate  * flag must be a member of the enumeration corresponding to *sp.
5060Sstevel@tonic-gate  */
5070Sstevel@tonic-gate 
5080Sstevel@tonic-gate /* turn on all flags in set */
5090Sstevel@tonic-gate #define	prfillset(sp) \
5100Sstevel@tonic-gate 	{ register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
5110Sstevel@tonic-gate 		while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0xFFFFFFFF; }
5120Sstevel@tonic-gate 
5130Sstevel@tonic-gate /* turn off all flags in set */
5140Sstevel@tonic-gate #define	premptyset(sp) \
5150Sstevel@tonic-gate 	{ register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
5160Sstevel@tonic-gate 		while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0; }
5170Sstevel@tonic-gate 
5180Sstevel@tonic-gate /* turn on specified flag in set */
5190Sstevel@tonic-gate #define	praddset(sp, flag) \
5200Sstevel@tonic-gate 	((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
5210Sstevel@tonic-gate 	(((uint32_t *)(sp))[((flag)-1)/32] |= (1U<<(((flag)-1)%32))) : 0))
5220Sstevel@tonic-gate 
5230Sstevel@tonic-gate /* turn off specified flag in set */
5240Sstevel@tonic-gate #define	prdelset(sp, flag) \
5250Sstevel@tonic-gate 	((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
5260Sstevel@tonic-gate 	    (((uint32_t *)(sp))[((flag)-1)/32] &= ~(1U<<(((flag)-1)%32))) : 0))
5270Sstevel@tonic-gate 
5280Sstevel@tonic-gate /* query: != 0 iff flag is turned on in set */
5290Sstevel@tonic-gate #define	prismember(sp, flag) \
5300Sstevel@tonic-gate 	(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) && \
5310Sstevel@tonic-gate 	    (((uint32_t *)(sp))[((flag)-1)/32] & (1U<<(((flag)-1)%32))))
5320Sstevel@tonic-gate 
5330Sstevel@tonic-gate #if defined(_SYSCALL32)
5340Sstevel@tonic-gate 
5350Sstevel@tonic-gate /*
5360Sstevel@tonic-gate  * dev32_t version of PRNODEV
5370Sstevel@tonic-gate  */
5380Sstevel@tonic-gate #define	PRNODEV32 (dev32_t)(-1)
5390Sstevel@tonic-gate 
5400Sstevel@tonic-gate /*
5410Sstevel@tonic-gate  * Kernel view of /proc structures for _ILP32 programs.
5420Sstevel@tonic-gate  */
5430Sstevel@tonic-gate 
5440Sstevel@tonic-gate /*
5450Sstevel@tonic-gate  * _ILP32 lwp status file.  /proc/<pid>/lwp/<lwpid>/lwpstatus
5460Sstevel@tonic-gate  */
5470Sstevel@tonic-gate typedef struct lwpstatus32 {
5480Sstevel@tonic-gate 	int	pr_flags;	/* flags */
5490Sstevel@tonic-gate 	id32_t	pr_lwpid;	/* specific lwp identifier */
5500Sstevel@tonic-gate 	short	pr_why;		/* reason for lwp stop, if stopped */
5510Sstevel@tonic-gate 	short	pr_what;	/* more detailed reason */
5520Sstevel@tonic-gate 	short	pr_cursig;	/* current signal, if any */
5530Sstevel@tonic-gate 	short	pr_pad1;
5540Sstevel@tonic-gate 	siginfo32_t pr_info;	/* info associated with signal or fault */
5550Sstevel@tonic-gate 	sigset_t pr_lwppend;	/* set of signals pending to the lwp */
5560Sstevel@tonic-gate 	sigset_t pr_lwphold;	/* set of signals blocked by the lwp */
5570Sstevel@tonic-gate 	struct sigaction32 pr_action;	/* signal action for current signal */
5580Sstevel@tonic-gate 	stack32_t pr_altstack;	/* alternate signal stack info */
5590Sstevel@tonic-gate 	caddr32_t pr_oldcontext;	/* address of previous ucontext */
5600Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
5610Sstevel@tonic-gate 	short	pr_nsysarg;	/* number of arguments to this syscall */
5620Sstevel@tonic-gate 	int	pr_errno;	/* errno for failed syscall, 0 if successful */
5630Sstevel@tonic-gate 	int32_t	pr_sysarg[PRSYSARGS];	/* arguments to this syscall */
5640Sstevel@tonic-gate 	int32_t	pr_rval1;	/* primary syscall return value */
5650Sstevel@tonic-gate 	int32_t	pr_rval2;	/* second syscall return value, if any */
5660Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
5670Sstevel@tonic-gate 	timestruc32_t pr_tstamp;	/* real-time time stamp of stop */
5680Sstevel@tonic-gate 	timestruc32_t pr_utime;	/* lwp user cpu time */
5690Sstevel@tonic-gate 	timestruc32_t pr_stime;	/* lwp system cpu time */
5700Sstevel@tonic-gate 	int	pr_filler[11 - 2 * sizeof (timestruc32_t) / sizeof (int)];
5710Sstevel@tonic-gate 	int	pr_errpriv;	/* missing privilege */
5720Sstevel@tonic-gate 	caddr32_t pr_ustack;	/* address of stack boundary data (stack32_t) */
5730Sstevel@tonic-gate 	uint32_t pr_instr;	/* current instruction */
5740Sstevel@tonic-gate 	prgregset32_t pr_reg;	/* general registers */
5750Sstevel@tonic-gate 	prfpregset32_t pr_fpreg; /* floating-point registers */
5760Sstevel@tonic-gate } lwpstatus32_t;
5770Sstevel@tonic-gate 
5780Sstevel@tonic-gate /*
5790Sstevel@tonic-gate  * _ILP32 process status file.  /proc/<pid>/status
5800Sstevel@tonic-gate  */
5810Sstevel@tonic-gate typedef struct pstatus32 {
5820Sstevel@tonic-gate 	int	pr_flags;	/* flags */
5830Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
5840Sstevel@tonic-gate 	pid32_t	pr_pid;		/* process id */
5850Sstevel@tonic-gate 	pid32_t	pr_ppid;	/* parent process id */
5860Sstevel@tonic-gate 	pid32_t	pr_pgid;	/* process group id */
5870Sstevel@tonic-gate 	pid32_t	pr_sid;		/* session id */
5880Sstevel@tonic-gate 	id32_t	pr_aslwpid;	/* historical; now always zero */
5890Sstevel@tonic-gate 	id32_t	pr_agentid;	/* lwp id of the /proc agent lwp, if any */
5900Sstevel@tonic-gate 	sigset_t pr_sigpend;	/* set of process pending signals */
5910Sstevel@tonic-gate 	caddr32_t pr_brkbase;	/* address of the process heap */
5920Sstevel@tonic-gate 	size32_t pr_brksize;	/* size of the process heap, in bytes */
5930Sstevel@tonic-gate 	caddr32_t pr_stkbase;	/* address of the process stack */
5940Sstevel@tonic-gate 	size32_t pr_stksize;	/* size of the process stack, in bytes */
5950Sstevel@tonic-gate 	timestruc32_t pr_utime;	/* process user cpu time */
5960Sstevel@tonic-gate 	timestruc32_t pr_stime;	/* process system cpu time */
5970Sstevel@tonic-gate 	timestruc32_t pr_cutime;	/* sum of children's user times */
5980Sstevel@tonic-gate 	timestruc32_t pr_cstime;	/* sum of children's system times */
5990Sstevel@tonic-gate 	sigset_t pr_sigtrace;	/* set of traced signals */
6000Sstevel@tonic-gate 	fltset_t pr_flttrace;	/* set of traced faults */
6010Sstevel@tonic-gate 	sysset_t pr_sysentry;	/* set of system calls traced on entry */
6020Sstevel@tonic-gate 	sysset_t pr_sysexit;	/* set of system calls traced on exit */
6030Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
6040Sstevel@tonic-gate 	char	pr_pad[3];
6050Sstevel@tonic-gate 	id32_t	pr_taskid;	/* task id */
6060Sstevel@tonic-gate 	id32_t	pr_projid;	/* project id */
6070Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
6080Sstevel@tonic-gate 	id32_t	pr_zoneid;	/* zone id */
6090Sstevel@tonic-gate 	int	pr_filler[15];	/* reserved for future use */
6100Sstevel@tonic-gate 	lwpstatus32_t pr_lwp;	/* status of the representative lwp */
6110Sstevel@tonic-gate } pstatus32_t;
6120Sstevel@tonic-gate 
6130Sstevel@tonic-gate /*
6140Sstevel@tonic-gate  * _ILP32 lwp ps(1) information file.  /proc/<pid>/lwp/<lwpid>/lwpsinfo
6150Sstevel@tonic-gate  */
6160Sstevel@tonic-gate typedef struct lwpsinfo32 {
6170Sstevel@tonic-gate 	int	pr_flag;	/* lwp flags */
6180Sstevel@tonic-gate 	id32_t	pr_lwpid;	/* lwp id */
6190Sstevel@tonic-gate 	caddr32_t pr_addr;	/* internal address of lwp */
6200Sstevel@tonic-gate 	caddr32_t pr_wchan;	/* wait addr for sleeping lwp */
6210Sstevel@tonic-gate 	char	pr_stype;	/* synchronization event type */
6220Sstevel@tonic-gate 	char	pr_state;	/* numeric lwp state */
6230Sstevel@tonic-gate 	char	pr_sname;	/* printable character for pr_state */
6240Sstevel@tonic-gate 	char	pr_nice;	/* nice for cpu usage */
6250Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
6260Sstevel@tonic-gate 	char	pr_oldpri;	/* pre-SVR4, low value is high priority */
6270Sstevel@tonic-gate 	char	pr_cpu;		/* pre-SVR4, cpu usage for scheduling */
6280Sstevel@tonic-gate 	int	pr_pri;		/* priority, high value is high priority */
6290Sstevel@tonic-gate 			/* The following percent number is a 16-bit binary */
6300Sstevel@tonic-gate 			/* fraction [0 .. 1] with the binary point to the */
6310Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
6320Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by this lwp */
6330Sstevel@tonic-gate 	ushort_t pr_pad;
6340Sstevel@tonic-gate 	timestruc32_t pr_start;	/* lwp start time, from the epoch */
6350Sstevel@tonic-gate 	timestruc32_t pr_time;	/* usr+sys cpu time for this lwp */
6360Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
6370Sstevel@tonic-gate 	char	pr_name[PRFNSZ];	/* name of system lwp */
6380Sstevel@tonic-gate 	processorid_t pr_onpro;		/* processor which last ran this lwp */
6390Sstevel@tonic-gate 	processorid_t pr_bindpro;	/* processor to which lwp is bound */
6400Sstevel@tonic-gate 	psetid_t pr_bindpset;	/* processor set to which lwp is bound */
6412690Sakolb 	int	pr_lgrp;	/* lwp home lgroup */
6422685Sakolb 	int	pr_filler[4];	/* reserved for future use */
6430Sstevel@tonic-gate } lwpsinfo32_t;
6440Sstevel@tonic-gate 
6450Sstevel@tonic-gate /*
6460Sstevel@tonic-gate  * _ILP32 process ps(1) information file.  /proc/<pid>/psinfo
6470Sstevel@tonic-gate  */
6480Sstevel@tonic-gate typedef struct psinfo32 {
6490Sstevel@tonic-gate 	int	pr_flag;	/* process flags */
6500Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
6510Sstevel@tonic-gate 	pid32_t	pr_pid;		/* unique process id */
6520Sstevel@tonic-gate 	pid32_t	pr_ppid;	/* process id of parent */
6530Sstevel@tonic-gate 	pid32_t	pr_pgid;	/* pid of process group leader */
6540Sstevel@tonic-gate 	pid32_t	pr_sid;		/* session id */
6550Sstevel@tonic-gate 	uid32_t	pr_uid;		/* real user id */
6560Sstevel@tonic-gate 	uid32_t	pr_euid;	/* effective user id */
6570Sstevel@tonic-gate 	gid32_t	pr_gid;		/* real group id */
6580Sstevel@tonic-gate 	gid32_t	pr_egid;	/* effective group id */
6590Sstevel@tonic-gate 	caddr32_t pr_addr;	/* address of process */
6600Sstevel@tonic-gate 	size32_t pr_size;	/* size of process image in Kbytes */
6610Sstevel@tonic-gate 	size32_t pr_rssize;	/* resident set size in Kbytes */
6620Sstevel@tonic-gate 	size32_t pr_pad1;
6630Sstevel@tonic-gate 	dev32_t	pr_ttydev;	/* controlling tty device (or PRNODEV) */
6640Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by all lwps */
6650Sstevel@tonic-gate 	ushort_t pr_pctmem;	/* % of system memory used by process */
6660Sstevel@tonic-gate 	timestruc32_t pr_start;	/* process start time, from the epoch */
6670Sstevel@tonic-gate 	timestruc32_t pr_time;	/* usr+sys cpu time for this process */
6680Sstevel@tonic-gate 	timestruc32_t pr_ctime;	/* usr+sys cpu time for reaped children */
6690Sstevel@tonic-gate 	char	pr_fname[PRFNSZ];	/* name of execed file */
6700Sstevel@tonic-gate 	char	pr_psargs[PRARGSZ];	/* initial characters of arg list */
6710Sstevel@tonic-gate 	int	pr_wstat;	/* if zombie, the wait() status */
6720Sstevel@tonic-gate 	int	pr_argc;	/* initial argument count */
6730Sstevel@tonic-gate 	caddr32_t pr_argv;	/* address of initial argument vector */
6740Sstevel@tonic-gate 	caddr32_t pr_envp;	/* address of initial environment vector */
6750Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
6760Sstevel@tonic-gate 	char	pr_pad2[3];
6770Sstevel@tonic-gate 	id32_t	pr_taskid;	/* task id */
6780Sstevel@tonic-gate 	id32_t	pr_projid;	/* project id */
6790Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
6800Sstevel@tonic-gate 	id32_t	pr_poolid;	/* pool id */
6810Sstevel@tonic-gate 	id32_t	pr_zoneid;	/* zone id */
6820Sstevel@tonic-gate 	id32_t	pr_contract;	/* process contract */
6830Sstevel@tonic-gate 	int	pr_filler[1];	/* reserved for future use */
6840Sstevel@tonic-gate 	lwpsinfo32_t pr_lwp;	/* information for representative lwp */
6850Sstevel@tonic-gate } psinfo32_t;
6860Sstevel@tonic-gate 
6870Sstevel@tonic-gate /*
6880Sstevel@tonic-gate  * _ILP32 Memory-management interface.  /proc/<pid>/map /proc/<pid>/rmap
6890Sstevel@tonic-gate  */
6900Sstevel@tonic-gate typedef struct prmap32 {
6910Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
6920Sstevel@tonic-gate 	size32_t pr_size;	/* size of mapping in bytes */
6930Sstevel@tonic-gate 	char	pr_mapname[64];	/* name in /proc/<pid>/object */
6940Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
6950Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
6960Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
6970Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
6980Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
6990Sstevel@tonic-gate } prmap32_t;
7000Sstevel@tonic-gate 
7010Sstevel@tonic-gate /*
7020Sstevel@tonic-gate  * _ILP32 HAT memory-map interface.  /proc/<pid>/xmap
7030Sstevel@tonic-gate  */
7040Sstevel@tonic-gate typedef struct prxmap32 {
7050Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
7060Sstevel@tonic-gate 	size32_t pr_size;	/* size of mapping in bytes */
7070Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
7080Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
7090Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
7100Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
7110Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
7120Sstevel@tonic-gate 	dev32_t	pr_dev;  /* st_dev from stat64() of mapped object, or PRNODEV */
7130Sstevel@tonic-gate 	uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */
7140Sstevel@tonic-gate 	uint32_t pr_rss;	/* pages of resident memory */
7150Sstevel@tonic-gate 	uint32_t pr_anon;	/* pages of resident anonymous memory */
7160Sstevel@tonic-gate 	uint32_t pr_locked;	/* pages of locked memory */
7173041Selowe 	uint32_t pr_pad;	/* currently unused */
7183041Selowe 	uint64_t pr_hatpagesize; /* pagesize of the hat mapping */
7193041Selowe 	uint32_t pr_filler[6];	/* filler for future expansion */
7200Sstevel@tonic-gate } prxmap32_t;
7210Sstevel@tonic-gate 
7220Sstevel@tonic-gate /*
7230Sstevel@tonic-gate  * _ILP32 Process credentials.  PCSCRED and /proc/<pid>/cred
7240Sstevel@tonic-gate  */
7250Sstevel@tonic-gate typedef struct prcred32 {
7260Sstevel@tonic-gate 	uid32_t	pr_euid;	/* effective user id */
7270Sstevel@tonic-gate 	uid32_t	pr_ruid;	/* real user id */
7280Sstevel@tonic-gate 	uid32_t	pr_suid;	/* saved user id (from exec) */
7290Sstevel@tonic-gate 	gid32_t	pr_egid;	/* effective group id */
7300Sstevel@tonic-gate 	gid32_t	pr_rgid;	/* real group id */
7310Sstevel@tonic-gate 	gid32_t	pr_sgid;	/* saved group id (from exec) */
7320Sstevel@tonic-gate 	int	pr_ngroups;	/* number of supplementary groups */
7330Sstevel@tonic-gate 	gid32_t	pr_groups[1];	/* array of supplementary groups */
7340Sstevel@tonic-gate } prcred32_t;
7350Sstevel@tonic-gate 
7360Sstevel@tonic-gate /*
7370Sstevel@tonic-gate  * _ILP32 Watchpoint interface.  PCWATCH and /proc/<pid>/watch
7380Sstevel@tonic-gate  */
7390Sstevel@tonic-gate typedef struct prwatch32 {
7400Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of watched area */
7410Sstevel@tonic-gate 	size32_t pr_size;	/* size of watched area in bytes */
7420Sstevel@tonic-gate 	int	pr_wflags;	/* watch type flags */
7430Sstevel@tonic-gate 	int	pr_pad;
7440Sstevel@tonic-gate } prwatch32_t;
7450Sstevel@tonic-gate 
7460Sstevel@tonic-gate /*
7470Sstevel@tonic-gate  * _ILP32 PCREAD/PCWRITE I/O interface.
7480Sstevel@tonic-gate  */
7490Sstevel@tonic-gate typedef struct priovec32 {
7500Sstevel@tonic-gate 	caddr32_t pio_base;	/* buffer in controlling process */
7510Sstevel@tonic-gate 	size32_t pio_len;	/* size of read/write request */
7520Sstevel@tonic-gate 	off32_t	pio_offset;	/* virtual address in target process */
7530Sstevel@tonic-gate } priovec32_t;
7540Sstevel@tonic-gate 
7550Sstevel@tonic-gate /*
7560Sstevel@tonic-gate  * _ILP32 Resource usage.  /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage
7570Sstevel@tonic-gate  */
7580Sstevel@tonic-gate typedef struct prusage32 {
7590Sstevel@tonic-gate 	id32_t		pr_lwpid;	/* lwp id.  0: process or defunct */
7600Sstevel@tonic-gate 	int32_t		pr_count;	/* number of contributing lwps */
7610Sstevel@tonic-gate 	timestruc32_t	pr_tstamp;	/* current time stamp */
7620Sstevel@tonic-gate 	timestruc32_t	pr_create;	/* process/lwp creation time stamp */
7630Sstevel@tonic-gate 	timestruc32_t	pr_term;	/* process/lwp termination time stamp */
7640Sstevel@tonic-gate 	timestruc32_t	pr_rtime;	/* total lwp real (elapsed) time */
7650Sstevel@tonic-gate 	timestruc32_t	pr_utime;	/* user level cpu time */
7660Sstevel@tonic-gate 	timestruc32_t	pr_stime;	/* system call cpu time */
7670Sstevel@tonic-gate 	timestruc32_t	pr_ttime;	/* other system trap cpu time */
7680Sstevel@tonic-gate 	timestruc32_t	pr_tftime;	/* text page fault sleep time */
7690Sstevel@tonic-gate 	timestruc32_t	pr_dftime;	/* data page fault sleep time */
7700Sstevel@tonic-gate 	timestruc32_t	pr_kftime;	/* kernel page fault sleep time */
7710Sstevel@tonic-gate 	timestruc32_t	pr_ltime;	/* user lock wait sleep time */
7720Sstevel@tonic-gate 	timestruc32_t	pr_slptime;	/* all other sleep time */
7730Sstevel@tonic-gate 	timestruc32_t	pr_wtime;	/* wait-cpu (latency) time */
7740Sstevel@tonic-gate 	timestruc32_t	pr_stoptime;	/* stopped time */
7750Sstevel@tonic-gate 	timestruc32_t	filltime[6];	/* filler for future expansion */
7760Sstevel@tonic-gate 	uint32_t	pr_minf;	/* minor page faults */
7770Sstevel@tonic-gate 	uint32_t	pr_majf;	/* major page faults */
7780Sstevel@tonic-gate 	uint32_t	pr_nswap;	/* swaps */
7790Sstevel@tonic-gate 	uint32_t	pr_inblk;	/* input blocks */
7800Sstevel@tonic-gate 	uint32_t	pr_oublk;	/* output blocks */
7810Sstevel@tonic-gate 	uint32_t	pr_msnd;	/* messages sent */
7820Sstevel@tonic-gate 	uint32_t	pr_mrcv;	/* messages received */
7830Sstevel@tonic-gate 	uint32_t	pr_sigs;	/* signals received */
7840Sstevel@tonic-gate 	uint32_t	pr_vctx;	/* voluntary context switches */
7850Sstevel@tonic-gate 	uint32_t	pr_ictx;	/* involuntary context switches */
7860Sstevel@tonic-gate 	uint32_t	pr_sysc;	/* system calls */
7870Sstevel@tonic-gate 	uint32_t	pr_ioch;	/* chars read and written */
7880Sstevel@tonic-gate 	uint32_t	filler[10];	/* filler for future expansion */
7890Sstevel@tonic-gate } prusage32_t;
7900Sstevel@tonic-gate 
7910Sstevel@tonic-gate /*
7920Sstevel@tonic-gate  * _ILP32 Page data file.  /proc/<pid>/pagedata
7930Sstevel@tonic-gate  */
7940Sstevel@tonic-gate 
7950Sstevel@tonic-gate /* _ILP32 page data file header */
7960Sstevel@tonic-gate typedef struct prpageheader32 {
7970Sstevel@tonic-gate 	timestruc32_t	pr_tstamp;	/* real time stamp */
7980Sstevel@tonic-gate 	int32_t		pr_nmap;	/* number of address space mappings */
7990Sstevel@tonic-gate 	int32_t		pr_npage;	/* total number of pages */
8000Sstevel@tonic-gate } prpageheader32_t;
8010Sstevel@tonic-gate 
8020Sstevel@tonic-gate /* _ILP32 page data mapping header */
8030Sstevel@tonic-gate typedef struct prasmap32 {
8040Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
8050Sstevel@tonic-gate 	size32_t pr_npage;	/* number of pages in mapping */
8060Sstevel@tonic-gate 	char	pr_mapname[64];	/* name in /proc/<pid>/object */
8070Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
8080Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
8090Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
8100Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
8110Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
8120Sstevel@tonic-gate } prasmap32_t;
8130Sstevel@tonic-gate 
8140Sstevel@tonic-gate /*
8150Sstevel@tonic-gate  * _ILP32 Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
8160Sstevel@tonic-gate  */
8170Sstevel@tonic-gate typedef struct prheader32 {
8180Sstevel@tonic-gate 	int32_t	pr_nent;	/* number of entries */
8190Sstevel@tonic-gate 	int32_t	pr_entsize;	/* size of each entry, in bytes */
8200Sstevel@tonic-gate } prheader32_t;
8210Sstevel@tonic-gate 
8220Sstevel@tonic-gate #endif	/* _SYSCALL32 */
8230Sstevel@tonic-gate 
8240Sstevel@tonic-gate #endif	/* !_KERNEL && _STRUCTURED_PROC == 0 */
8250Sstevel@tonic-gate 
8260Sstevel@tonic-gate #ifdef	__cplusplus
8270Sstevel@tonic-gate }
8280Sstevel@tonic-gate #endif
8290Sstevel@tonic-gate 
8300Sstevel@tonic-gate #endif	/* _SYS_PROCFS_H */
831