xref: /titanic_51/usr/src/uts/common/sys/procfs.h (revision d1b18d1a1255ac607d5e072515d727cdfe52f878)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5c6402783Sakolb  * Common Development and Distribution License (the "License").
6c6402783Sakolb  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21c6402783Sakolb 
227c478bd9Sstevel@tonic-gate /*
23c6402783Sakolb  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
26*34bdffbfSGarrett D'Amore /*
27*34bdffbfSGarrett D'Amore  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
28*34bdffbfSGarrett D'Amore  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SYS_PROCFS_H
317c478bd9Sstevel@tonic-gate #define	_SYS_PROCFS_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * This definition is temporary.  Structured proc is the preferred API,
397c478bd9Sstevel@tonic-gate  * and the older ioctl-based interface will be removed in a future version
407c478bd9Sstevel@tonic-gate  * of Solaris.  Until then, by default, including <sys/procfs.h> will
417c478bd9Sstevel@tonic-gate  * provide the older ioctl-based /proc definitions.  To get the structured
427c478bd9Sstevel@tonic-gate  * /proc definitions, either include <procfs.h> or define _STRUCTURED_PROC
437c478bd9Sstevel@tonic-gate  * to be 1 before including <sys/procfs.h>.
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate #ifndef	_STRUCTURED_PROC
467c478bd9Sstevel@tonic-gate #define	_STRUCTURED_PROC	0
477c478bd9Sstevel@tonic-gate #endif
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) && _STRUCTURED_PROC == 0
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #include <sys/old_procfs.h>
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate #else	/* !defined(_KERNEL) && _STRUCTURED_PROC == 0 */
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
567c478bd9Sstevel@tonic-gate #include <sys/types.h>
577c478bd9Sstevel@tonic-gate #include <sys/time_impl.h>
587c478bd9Sstevel@tonic-gate #include <sys/signal.h>
597c478bd9Sstevel@tonic-gate #include <sys/siginfo.h>
607c478bd9Sstevel@tonic-gate #include <sys/fault.h>
617c478bd9Sstevel@tonic-gate #include <sys/syscall.h>
627c478bd9Sstevel@tonic-gate #include <sys/pset.h>
637c478bd9Sstevel@tonic-gate #include <sys/procfs_isa.h>
647c478bd9Sstevel@tonic-gate #include <sys/priv.h>
65*34bdffbfSGarrett D'Amore #include <sys/stat.h>
66*34bdffbfSGarrett D'Amore #include <sys/param.h>
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /*
697c478bd9Sstevel@tonic-gate  * System call interfaces for /proc.
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate /*
737c478bd9Sstevel@tonic-gate  * Control codes (long values) for messages written to ctl and lwpctl files.
747c478bd9Sstevel@tonic-gate  */
757c478bd9Sstevel@tonic-gate #define	PCNULL   0L	/* null request, advance to next message */
767c478bd9Sstevel@tonic-gate #define	PCSTOP   1L	/* direct process or lwp to stop and wait for stop */
777c478bd9Sstevel@tonic-gate #define	PCDSTOP  2L	/* direct process or lwp to stop */
787c478bd9Sstevel@tonic-gate #define	PCWSTOP  3L	/* wait for process or lwp to stop, no timeout */
797c478bd9Sstevel@tonic-gate #define	PCTWSTOP 4L	/* wait for stop, with long millisecond timeout arg */
807c478bd9Sstevel@tonic-gate #define	PCRUN    5L	/* make process/lwp runnable, w/ long flags argument */
817c478bd9Sstevel@tonic-gate #define	PCCSIG   6L	/* clear current signal from lwp */
827c478bd9Sstevel@tonic-gate #define	PCCFAULT 7L	/* clear current fault from lwp */
837c478bd9Sstevel@tonic-gate #define	PCSSIG   8L	/* set current signal from siginfo_t argument */
847c478bd9Sstevel@tonic-gate #define	PCKILL   9L	/* post a signal to process/lwp, long argument */
857c478bd9Sstevel@tonic-gate #define	PCUNKILL 10L	/* delete a pending signal from process/lwp, long arg */
867c478bd9Sstevel@tonic-gate #define	PCSHOLD  11L	/* set lwp signal mask from sigset_t argument */
877c478bd9Sstevel@tonic-gate #define	PCSTRACE 12L	/* set traced signal set from sigset_t argument */
887c478bd9Sstevel@tonic-gate #define	PCSFAULT 13L	/* set traced fault set from fltset_t argument */
897c478bd9Sstevel@tonic-gate #define	PCSENTRY 14L	/* set traced syscall entry set from sysset_t arg */
907c478bd9Sstevel@tonic-gate #define	PCSEXIT  15L	/* set traced syscall exit set from sysset_t arg */
917c478bd9Sstevel@tonic-gate #define	PCSET    16L	/* set modes from long argument */
927c478bd9Sstevel@tonic-gate #define	PCUNSET  17L	/* unset modes from long argument */
937c478bd9Sstevel@tonic-gate #define	PCSREG   18L	/* set lwp general registers from prgregset_t arg */
947c478bd9Sstevel@tonic-gate #define	PCSFPREG 19L	/* set lwp floating-point registers from prfpregset_t */
957c478bd9Sstevel@tonic-gate #define	PCSXREG  20L	/* set lwp extra registers from prxregset_t arg */
967c478bd9Sstevel@tonic-gate #define	PCNICE   21L	/* set nice priority from long argument */
977c478bd9Sstevel@tonic-gate #define	PCSVADDR 22L	/* set %pc virtual address from long argument */
987c478bd9Sstevel@tonic-gate #define	PCWATCH  23L	/* set/unset watched memory area from prwatch_t arg */
997c478bd9Sstevel@tonic-gate #define	PCAGENT  24L	/* create agent lwp with regs from prgregset_t arg */
1007c478bd9Sstevel@tonic-gate #define	PCREAD   25L	/* read from the address space via priovec_t arg */
1017c478bd9Sstevel@tonic-gate #define	PCWRITE  26L	/* write to the address space via priovec_t arg */
1027c478bd9Sstevel@tonic-gate #define	PCSCRED  27L	/* set process credentials from prcred_t argument */
1037c478bd9Sstevel@tonic-gate #define	PCSASRS  28L	/* set ancillary state registers from asrset_t arg */
1047c478bd9Sstevel@tonic-gate #define	PCSPRIV  29L	/* set process privileges from prpriv_t argument */
1057c478bd9Sstevel@tonic-gate #define	PCSZONE  30L	/* set zoneid from zoneid_t argument */
1067c478bd9Sstevel@tonic-gate #define	PCSCREDX 31L	/* as PCSCRED but with supplemental groups */
1077c478bd9Sstevel@tonic-gate /*
1087c478bd9Sstevel@tonic-gate  * PCRUN long operand flags.
1097c478bd9Sstevel@tonic-gate  */
1107c478bd9Sstevel@tonic-gate #define	PRCSIG		0x01	/* clear current signal, if any */
1117c478bd9Sstevel@tonic-gate #define	PRCFAULT	0x02	/* clear current fault, if any */
1127c478bd9Sstevel@tonic-gate #define	PRSTEP		0x04	/* direct the lwp to single-step */
1137c478bd9Sstevel@tonic-gate #define	PRSABORT	0x08	/* abort syscall, if in syscall */
1147c478bd9Sstevel@tonic-gate #define	PRSTOP		0x10	/* set directed stop request */
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /*
1177c478bd9Sstevel@tonic-gate  * lwp status file.  /proc/<pid>/lwp/<lwpid>/lwpstatus
1187c478bd9Sstevel@tonic-gate  */
1197c478bd9Sstevel@tonic-gate #define	PRCLSZ		8	/* maximum size of scheduling class name */
1207c478bd9Sstevel@tonic-gate #define	PRSYSARGS	8	/* maximum number of syscall arguments */
1217c478bd9Sstevel@tonic-gate typedef struct lwpstatus {
1227c478bd9Sstevel@tonic-gate 	int	pr_flags;	/* flags (see below) */
1237c478bd9Sstevel@tonic-gate 	id_t	pr_lwpid;	/* specific lwp identifier */
1247c478bd9Sstevel@tonic-gate 	short	pr_why;		/* reason for lwp stop, if stopped */
1257c478bd9Sstevel@tonic-gate 	short	pr_what;	/* more detailed reason */
1267c478bd9Sstevel@tonic-gate 	short	pr_cursig;	/* current signal, if any */
1277c478bd9Sstevel@tonic-gate 	short	pr_pad1;
1287c478bd9Sstevel@tonic-gate 	siginfo_t pr_info;	/* info associated with signal or fault */
1297c478bd9Sstevel@tonic-gate 	sigset_t pr_lwppend;	/* set of signals pending to the lwp */
1307c478bd9Sstevel@tonic-gate 	sigset_t pr_lwphold;	/* set of signals blocked by the lwp */
1317c478bd9Sstevel@tonic-gate 	struct sigaction pr_action;	/* signal action for current signal */
1327c478bd9Sstevel@tonic-gate 	stack_t	pr_altstack;	/* alternate signal stack info */
1337c478bd9Sstevel@tonic-gate 	uintptr_t pr_oldcontext;	/* address of previous ucontext */
1347c478bd9Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
1357c478bd9Sstevel@tonic-gate 	short	pr_nsysarg;	/* number of arguments to this syscall */
1367c478bd9Sstevel@tonic-gate 	int	pr_errno;	/* errno for failed syscall, 0 if successful */
1377c478bd9Sstevel@tonic-gate 	long	pr_sysarg[PRSYSARGS];	/* arguments to this syscall */
1387c478bd9Sstevel@tonic-gate 	long	pr_rval1;	/* primary syscall return value */
1397c478bd9Sstevel@tonic-gate 	long	pr_rval2;	/* second syscall return value, if any */
1407c478bd9Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
1417c478bd9Sstevel@tonic-gate 	timestruc_t pr_tstamp;	/* real-time time stamp of stop */
1427c478bd9Sstevel@tonic-gate 	timestruc_t pr_utime;	/* lwp user cpu time */
1437c478bd9Sstevel@tonic-gate 	timestruc_t pr_stime;	/* lwp system cpu time */
1447c478bd9Sstevel@tonic-gate 	int	pr_filler[11 - 2 * sizeof (timestruc_t) / sizeof (int)];
1457c478bd9Sstevel@tonic-gate 	int	pr_errpriv;	/* missing privilege */
1467c478bd9Sstevel@tonic-gate 	uintptr_t pr_ustack;	/* address of stack boundary data (stack_t) */
1477c478bd9Sstevel@tonic-gate 	ulong_t	pr_instr;	/* current instruction */
1487c478bd9Sstevel@tonic-gate 	prgregset_t pr_reg;	/* general registers */
1497c478bd9Sstevel@tonic-gate 	prfpregset_t pr_fpreg;	/* floating-point registers */
1507c478bd9Sstevel@tonic-gate } lwpstatus_t;
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate /*
1537c478bd9Sstevel@tonic-gate  * process status file.  /proc/<pid>/status
1547c478bd9Sstevel@tonic-gate  */
1557c478bd9Sstevel@tonic-gate typedef struct pstatus {
1567c478bd9Sstevel@tonic-gate 	int	pr_flags;	/* flags (see below) */
1577c478bd9Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
1587c478bd9Sstevel@tonic-gate 	pid_t	pr_pid;		/* process id */
1597c478bd9Sstevel@tonic-gate 	pid_t	pr_ppid;	/* parent process id */
1607c478bd9Sstevel@tonic-gate 	pid_t	pr_pgid;	/* process group id */
1617c478bd9Sstevel@tonic-gate 	pid_t	pr_sid;		/* session id */
1627c478bd9Sstevel@tonic-gate 	id_t	pr_aslwpid;	/* historical; now always zero */
1637c478bd9Sstevel@tonic-gate 	id_t	pr_agentid;	/* lwp id of the /proc agent lwp, if any */
1647c478bd9Sstevel@tonic-gate 	sigset_t pr_sigpend;	/* set of process pending signals */
1657c478bd9Sstevel@tonic-gate 	uintptr_t pr_brkbase;	/* address of the process heap */
1667c478bd9Sstevel@tonic-gate 	size_t	pr_brksize;	/* size of the process heap, in bytes */
1677c478bd9Sstevel@tonic-gate 	uintptr_t pr_stkbase;	/* address of the process stack */
1687c478bd9Sstevel@tonic-gate 	size_t	pr_stksize;	/* size of the process stack, in bytes */
1697c478bd9Sstevel@tonic-gate 	timestruc_t pr_utime;	/* process user cpu time */
1707c478bd9Sstevel@tonic-gate 	timestruc_t pr_stime;	/* process system cpu time */
1717c478bd9Sstevel@tonic-gate 	timestruc_t pr_cutime;	/* sum of children's user times */
1727c478bd9Sstevel@tonic-gate 	timestruc_t pr_cstime;	/* sum of children's system times */
1737c478bd9Sstevel@tonic-gate 	sigset_t pr_sigtrace;	/* set of traced signals */
1747c478bd9Sstevel@tonic-gate 	fltset_t pr_flttrace;	/* set of traced faults */
1757c478bd9Sstevel@tonic-gate 	sysset_t pr_sysentry;	/* set of system calls traced on entry */
1767c478bd9Sstevel@tonic-gate 	sysset_t pr_sysexit;	/* set of system calls traced on exit */
1777c478bd9Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process (see below) */
1787c478bd9Sstevel@tonic-gate 	char	pr_pad[3];
1797c478bd9Sstevel@tonic-gate 	taskid_t pr_taskid;	/* task id */
1807c478bd9Sstevel@tonic-gate 	projid_t pr_projid;	/* project id */
1817c478bd9Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
1827c478bd9Sstevel@tonic-gate 	zoneid_t pr_zoneid;	/* zone id */
1837c478bd9Sstevel@tonic-gate 	int	pr_filler[15];	/* reserved for future use */
1847c478bd9Sstevel@tonic-gate 	lwpstatus_t pr_lwp;	/* status of the representative lwp */
1857c478bd9Sstevel@tonic-gate } pstatus_t;
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate /*
1887c478bd9Sstevel@tonic-gate  * pr_flags (same values appear in both pstatus_t and lwpstatus_t pr_flags).
1897c478bd9Sstevel@tonic-gate  *
1907c478bd9Sstevel@tonic-gate  * These flags do *not* apply to psinfo_t.pr_flag or lwpsinfo_t.pr_flag
1917c478bd9Sstevel@tonic-gate  * (which are both deprecated).
1927c478bd9Sstevel@tonic-gate  */
1937c478bd9Sstevel@tonic-gate /* The following flags apply to the specific or representative lwp */
1947c478bd9Sstevel@tonic-gate #define	PR_STOPPED 0x00000001	/* lwp is stopped */
1957c478bd9Sstevel@tonic-gate #define	PR_ISTOP   0x00000002	/* lwp is stopped on an event of interest */
1967c478bd9Sstevel@tonic-gate #define	PR_DSTOP   0x00000004	/* lwp has a stop directive in effect */
1977c478bd9Sstevel@tonic-gate #define	PR_STEP	   0x00000008	/* lwp has a single-step directive in effect */
1987c478bd9Sstevel@tonic-gate #define	PR_ASLEEP  0x00000010	/* lwp is sleeping in a system call */
1997c478bd9Sstevel@tonic-gate #define	PR_PCINVAL 0x00000020	/* contents of pr_instr undefined */
2007c478bd9Sstevel@tonic-gate #define	PR_ASLWP   0x00000040	/* obsolete flag; never set */
2017c478bd9Sstevel@tonic-gate #define	PR_AGENT   0x00000080	/* this lwp is the /proc agent lwp */
2027c478bd9Sstevel@tonic-gate #define	PR_DETACH  0x00000100	/* this is a detached lwp */
2037c478bd9Sstevel@tonic-gate #define	PR_DAEMON  0x00000200	/* this is a daemon lwp */
204657b1f3dSraf #define	PR_IDLE    0x00000400	/* lwp is a cpu's idle thread */
2057c478bd9Sstevel@tonic-gate /* The following flags apply to the process, not to an individual lwp */
2067c478bd9Sstevel@tonic-gate #define	PR_ISSYS   0x00001000	/* this is a system process */
2077c478bd9Sstevel@tonic-gate #define	PR_VFORKP  0x00002000	/* process is the parent of a vfork()d child */
2087c478bd9Sstevel@tonic-gate #define	PR_ORPHAN  0x00004000	/* process's process group is orphaned */
209657b1f3dSraf #define	PR_NOSIGCHLD 0x00008000	/* process will not generate SIGCHLD on exit */
210657b1f3dSraf #define	PR_WAITPID 0x00010000	/* only waitid(P_PID, pid) can reap the child */
2117c478bd9Sstevel@tonic-gate /* The following process flags are modes settable by PCSET/PCUNSET */
2127c478bd9Sstevel@tonic-gate #define	PR_FORK	   0x00100000	/* inherit-on-fork is in effect */
2137c478bd9Sstevel@tonic-gate #define	PR_RLC	   0x00200000	/* run-on-last-close is in effect */
2147c478bd9Sstevel@tonic-gate #define	PR_KLC	   0x00400000	/* kill-on-last-close is in effect */
2157c478bd9Sstevel@tonic-gate #define	PR_ASYNC   0x00800000	/* asynchronous-stop is in effect */
2167c478bd9Sstevel@tonic-gate #define	PR_MSACCT  0x01000000	/* micro-state usage accounting is in effect */
2177c478bd9Sstevel@tonic-gate #define	PR_BPTADJ  0x02000000	/* breakpoint trap pc adjustment is in effect */
2187c478bd9Sstevel@tonic-gate #define	PR_PTRACE  0x04000000	/* ptrace-compatibility mode is in effect */
2197c478bd9Sstevel@tonic-gate #define	PR_MSFORK  0x08000000	/* micro-state accounting inherited on fork */
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate /*
2227c478bd9Sstevel@tonic-gate  * See <sys/procfs_isa.h> for possible values of pr_dmodel.
2237c478bd9Sstevel@tonic-gate  */
2247c478bd9Sstevel@tonic-gate 
2257c478bd9Sstevel@tonic-gate /*
2267c478bd9Sstevel@tonic-gate  * Reasons for stopping (pr_why).
2277c478bd9Sstevel@tonic-gate  */
2287c478bd9Sstevel@tonic-gate #define	PR_REQUESTED	1
2297c478bd9Sstevel@tonic-gate #define	PR_SIGNALLED	2
2307c478bd9Sstevel@tonic-gate #define	PR_SYSENTRY	3
2317c478bd9Sstevel@tonic-gate #define	PR_SYSEXIT	4
2327c478bd9Sstevel@tonic-gate #define	PR_JOBCONTROL	5
2337c478bd9Sstevel@tonic-gate #define	PR_FAULTED	6
2347c478bd9Sstevel@tonic-gate #define	PR_SUSPENDED	7
2357c478bd9Sstevel@tonic-gate #define	PR_CHECKPOINT	8
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate /*
2387c478bd9Sstevel@tonic-gate  * lwp ps(1) information file.  /proc/<pid>/lwp/<lwpid>/lwpsinfo
2397c478bd9Sstevel@tonic-gate  */
2407c478bd9Sstevel@tonic-gate #define	PRFNSZ		16	/* Maximum size of execed filename */
2417c478bd9Sstevel@tonic-gate typedef struct lwpsinfo {
2427c478bd9Sstevel@tonic-gate 	int	pr_flag;	/* lwp flags (DEPRECATED; do not use) */
2437c478bd9Sstevel@tonic-gate 	id_t	pr_lwpid;	/* lwp id */
2447c478bd9Sstevel@tonic-gate 	uintptr_t pr_addr;	/* internal address of lwp */
2457c478bd9Sstevel@tonic-gate 	uintptr_t pr_wchan;	/* wait addr for sleeping lwp */
2467c478bd9Sstevel@tonic-gate 	char	pr_stype;	/* synchronization event type */
2477c478bd9Sstevel@tonic-gate 	char	pr_state;	/* numeric lwp state */
2487c478bd9Sstevel@tonic-gate 	char	pr_sname;	/* printable character for pr_state */
2497c478bd9Sstevel@tonic-gate 	char	pr_nice;	/* nice for cpu usage */
2507c478bd9Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
2517c478bd9Sstevel@tonic-gate 	char	pr_oldpri;	/* pre-SVR4, low value is high priority */
2527c478bd9Sstevel@tonic-gate 	char	pr_cpu;		/* pre-SVR4, cpu usage for scheduling */
2537c478bd9Sstevel@tonic-gate 	int	pr_pri;		/* priority, high value is high priority */
2547c478bd9Sstevel@tonic-gate 			/* The following percent number is a 16-bit binary */
2557c478bd9Sstevel@tonic-gate 			/* fraction [0 .. 1] with the binary point to the */
2567c478bd9Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
2577c478bd9Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by this lwp */
2587c478bd9Sstevel@tonic-gate 	ushort_t pr_pad;
2597c478bd9Sstevel@tonic-gate 	timestruc_t pr_start;	/* lwp start time, from the epoch */
2607c478bd9Sstevel@tonic-gate 	timestruc_t pr_time;	/* usr+sys cpu time for this lwp */
2617c478bd9Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
2627c478bd9Sstevel@tonic-gate 	char	pr_name[PRFNSZ];	/* name of system lwp */
2637c478bd9Sstevel@tonic-gate 	processorid_t pr_onpro;		/* processor which last ran this lwp */
2647c478bd9Sstevel@tonic-gate 	processorid_t pr_bindpro;	/* processor to which lwp is bound */
2657c478bd9Sstevel@tonic-gate 	psetid_t pr_bindpset;	/* processor set to which lwp is bound */
266a3c951f0Sakolb 	int	pr_lgrp;	/* lwp home lgroup */
267c6402783Sakolb 	int	pr_filler[4];	/* reserved for future use */
2687c478bd9Sstevel@tonic-gate } lwpsinfo_t;
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate /*
2717c478bd9Sstevel@tonic-gate  * process ps(1) information file.  /proc/<pid>/psinfo
2727c478bd9Sstevel@tonic-gate  */
2737c478bd9Sstevel@tonic-gate #define	PRARGSZ		80	/* number of chars of arguments */
2747c478bd9Sstevel@tonic-gate typedef struct psinfo {
2757c478bd9Sstevel@tonic-gate 	int	pr_flag;	/* process flags (DEPRECATED; do not use) */
2767c478bd9Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
2777c478bd9Sstevel@tonic-gate 	pid_t	pr_pid;		/* unique process id */
2787c478bd9Sstevel@tonic-gate 	pid_t	pr_ppid;	/* process id of parent */
2797c478bd9Sstevel@tonic-gate 	pid_t	pr_pgid;	/* pid of process group leader */
2807c478bd9Sstevel@tonic-gate 	pid_t	pr_sid;		/* session id */
2817c478bd9Sstevel@tonic-gate 	uid_t	pr_uid;		/* real user id */
2827c478bd9Sstevel@tonic-gate 	uid_t	pr_euid;	/* effective user id */
2837c478bd9Sstevel@tonic-gate 	gid_t	pr_gid;		/* real group id */
2847c478bd9Sstevel@tonic-gate 	gid_t	pr_egid;	/* effective group id */
2857c478bd9Sstevel@tonic-gate 	uintptr_t pr_addr;	/* address of process */
2867c478bd9Sstevel@tonic-gate 	size_t	pr_size;	/* size of process image in Kbytes */
2877c478bd9Sstevel@tonic-gate 	size_t	pr_rssize;	/* resident set size in Kbytes */
2887c478bd9Sstevel@tonic-gate 	size_t	pr_pad1;
2897c478bd9Sstevel@tonic-gate 	dev_t	pr_ttydev;	/* controlling tty device (or PRNODEV) */
2907c478bd9Sstevel@tonic-gate 			/* The following percent numbers are 16-bit binary */
2917c478bd9Sstevel@tonic-gate 			/* fractions [0 .. 1] with the binary point to the */
2927c478bd9Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
2937c478bd9Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by all lwps */
2947c478bd9Sstevel@tonic-gate 	ushort_t pr_pctmem;	/* % of system memory used by process */
2957c478bd9Sstevel@tonic-gate 	timestruc_t pr_start;	/* process start time, from the epoch */
2967c478bd9Sstevel@tonic-gate 	timestruc_t pr_time;	/* usr+sys cpu time for this process */
2977c478bd9Sstevel@tonic-gate 	timestruc_t pr_ctime;	/* usr+sys cpu time for reaped children */
2987c478bd9Sstevel@tonic-gate 	char	pr_fname[PRFNSZ];	/* name of execed file */
2997c478bd9Sstevel@tonic-gate 	char	pr_psargs[PRARGSZ];	/* initial characters of arg list */
3007c478bd9Sstevel@tonic-gate 	int	pr_wstat;	/* if zombie, the wait() status */
3017c478bd9Sstevel@tonic-gate 	int	pr_argc;	/* initial argument count */
3027c478bd9Sstevel@tonic-gate 	uintptr_t pr_argv;	/* address of initial argument vector */
3037c478bd9Sstevel@tonic-gate 	uintptr_t pr_envp;	/* address of initial environment vector */
3047c478bd9Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
3057c478bd9Sstevel@tonic-gate 	char	pr_pad2[3];
3067c478bd9Sstevel@tonic-gate 	taskid_t pr_taskid;	/* task id */
3077c478bd9Sstevel@tonic-gate 	projid_t pr_projid;	/* project id */
3087c478bd9Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
3097c478bd9Sstevel@tonic-gate 	poolid_t pr_poolid;	/* pool id */
3107c478bd9Sstevel@tonic-gate 	zoneid_t pr_zoneid;	/* zone id */
3117c478bd9Sstevel@tonic-gate 	id_t	pr_contract;	/* process contract */
3127c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* reserved for future use */
3137c478bd9Sstevel@tonic-gate 	lwpsinfo_t pr_lwp;	/* information for representative lwp */
3147c478bd9Sstevel@tonic-gate } psinfo_t;
3157c478bd9Sstevel@tonic-gate 
3167c478bd9Sstevel@tonic-gate #define	PRNODEV	(dev_t)(-1)	/* non-existent device */
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate /*
3197c478bd9Sstevel@tonic-gate  * Memory-map interface.  /proc/<pid>/map /proc/<pid>/rmap
3207c478bd9Sstevel@tonic-gate  */
3217c478bd9Sstevel@tonic-gate #define	PRMAPSZ	64
3227c478bd9Sstevel@tonic-gate typedef struct prmap {
3237c478bd9Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
3247c478bd9Sstevel@tonic-gate 	size_t	pr_size;	/* size of mapping in bytes */
3257c478bd9Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
3267c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
3277c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
3287c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
3297c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
3307c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
3317c478bd9Sstevel@tonic-gate } prmap_t;
3327c478bd9Sstevel@tonic-gate 
3337c478bd9Sstevel@tonic-gate /*
3347c478bd9Sstevel@tonic-gate  * HAT memory-map interface.  /proc/<pid>/xmap
3357c478bd9Sstevel@tonic-gate  */
3367c478bd9Sstevel@tonic-gate typedef struct prxmap {
3377c478bd9Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
3387c478bd9Sstevel@tonic-gate 	size_t	pr_size;	/* size of mapping in bytes */
3397c478bd9Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
3407c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
3417c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
3427c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
3437c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
3447c478bd9Sstevel@tonic-gate 	dev_t	pr_dev;	/* st_dev from stat64() of mapped object, or PRNODEV */
3457c478bd9Sstevel@tonic-gate 	uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */
346f4471a27Selowe 	size_t	pr_rss; 	/* pages of resident memory */
347f4471a27Selowe 	size_t	pr_anon;	/* pages of resident anonymous memory */
348f4471a27Selowe 	size_t	pr_locked;	/* pages of locked memory */
349f4471a27Selowe 	size_t	pr_pad;		/* currently unused */
350f4471a27Selowe 	uint64_t pr_hatpagesize; /* pagesize of the hat mapping */
351f4471a27Selowe #ifdef	_ILP32
352f4471a27Selowe 	ulong_t	pr_filler[6];	/* filler for future expansion */
353f4471a27Selowe #else
354f4471a27Selowe 	ulong_t pr_filler[7];	/* filler for future expansion */
355f4471a27Selowe #endif
3567c478bd9Sstevel@tonic-gate } prxmap_t;
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate 
3597c478bd9Sstevel@tonic-gate /* Protection and attribute flags */
3607c478bd9Sstevel@tonic-gate #define	MA_READ		0x04	/* readable by the traced process */
3617c478bd9Sstevel@tonic-gate #define	MA_WRITE	0x02	/* writable by the traced process */
3627c478bd9Sstevel@tonic-gate #define	MA_EXEC		0x01	/* executable by the traced process */
3637c478bd9Sstevel@tonic-gate #define	MA_SHARED	0x08	/* changes are shared by mapped object */
3647c478bd9Sstevel@tonic-gate #define	MA_ANON		0x40	/* anonymous memory (e.g. /dev/zero) */
3657c478bd9Sstevel@tonic-gate #define	MA_ISM		0x80	/* intimate shared mem (shared MMU resources) */
3667c478bd9Sstevel@tonic-gate #define	MA_NORESERVE	0x100	/* mapped with MAP_NORESERVE */
3677c478bd9Sstevel@tonic-gate #define	MA_SHM		0x200	/* System V shared memory */
3687c478bd9Sstevel@tonic-gate #define	MA_RESERVED1	0x400	/* reserved for future use */
3697c478bd9Sstevel@tonic-gate 
3707c478bd9Sstevel@tonic-gate /*
3717c478bd9Sstevel@tonic-gate  * These are obsolete and unreliable.
3727c478bd9Sstevel@tonic-gate  * They are included here only for historical compatibility.
3737c478bd9Sstevel@tonic-gate  */
3747c478bd9Sstevel@tonic-gate #define	MA_BREAK	0x10	/* grown by brk(2) */
3757c478bd9Sstevel@tonic-gate #define	MA_STACK	0x20	/* grown automatically on stack faults */
3767c478bd9Sstevel@tonic-gate 
3777c478bd9Sstevel@tonic-gate /*
3787c478bd9Sstevel@tonic-gate  * Process credentials.  PCSCRED and /proc/<pid>/cred
3797c478bd9Sstevel@tonic-gate  */
3807c478bd9Sstevel@tonic-gate typedef struct prcred {
3817c478bd9Sstevel@tonic-gate 	uid_t	pr_euid;	/* effective user id */
3827c478bd9Sstevel@tonic-gate 	uid_t	pr_ruid;	/* real user id */
3837c478bd9Sstevel@tonic-gate 	uid_t	pr_suid;	/* saved user id (from exec) */
3847c478bd9Sstevel@tonic-gate 	gid_t	pr_egid;	/* effective group id */
3857c478bd9Sstevel@tonic-gate 	gid_t	pr_rgid;	/* real group id */
3867c478bd9Sstevel@tonic-gate 	gid_t	pr_sgid;	/* saved group id (from exec) */
3877c478bd9Sstevel@tonic-gate 	int	pr_ngroups;	/* number of supplementary groups */
3887c478bd9Sstevel@tonic-gate 	gid_t	pr_groups[1];	/* array of supplementary groups */
3897c478bd9Sstevel@tonic-gate } prcred_t;
3907c478bd9Sstevel@tonic-gate 
3917c478bd9Sstevel@tonic-gate /*
3927c478bd9Sstevel@tonic-gate  * Process privileges.  PCSPRIV and /proc/<pid>/priv
3937c478bd9Sstevel@tonic-gate  */
3947c478bd9Sstevel@tonic-gate typedef struct prpriv {
3957c478bd9Sstevel@tonic-gate 	uint32_t	pr_nsets;		/* number of privilege set */
3967c478bd9Sstevel@tonic-gate 	uint32_t	pr_setsize;		/* size of privilege set */
3977c478bd9Sstevel@tonic-gate 	uint32_t	pr_infosize;		/* size of supplementary data */
3987c478bd9Sstevel@tonic-gate 	priv_chunk_t	pr_sets[1];		/* array of sets */
3997c478bd9Sstevel@tonic-gate } prpriv_t;
4007c478bd9Sstevel@tonic-gate 
4017c478bd9Sstevel@tonic-gate /*
4027c478bd9Sstevel@tonic-gate  * Watchpoint interface.  PCWATCH and /proc/<pid>/watch
4037c478bd9Sstevel@tonic-gate  */
4047c478bd9Sstevel@tonic-gate typedef struct prwatch {
4057c478bd9Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of watched area */
4067c478bd9Sstevel@tonic-gate 	size_t	pr_size;	/* size of watched area in bytes */
4077c478bd9Sstevel@tonic-gate 	int	pr_wflags;	/* watch type flags */
4087c478bd9Sstevel@tonic-gate 	int	pr_pad;
4097c478bd9Sstevel@tonic-gate } prwatch_t;
4107c478bd9Sstevel@tonic-gate 
4117c478bd9Sstevel@tonic-gate /* pr_wflags */
4127c478bd9Sstevel@tonic-gate #define	WA_READ		0x04	/* trap on read access */
4137c478bd9Sstevel@tonic-gate #define	WA_WRITE	0x02	/* trap on write access */
4147c478bd9Sstevel@tonic-gate #define	WA_EXEC		0x01	/* trap on execute access */
4157c478bd9Sstevel@tonic-gate #define	WA_TRAPAFTER	0x08	/* trap after instruction completes */
4167c478bd9Sstevel@tonic-gate 
4177c478bd9Sstevel@tonic-gate /*
4187c478bd9Sstevel@tonic-gate  * PCREAD/PCWRITE I/O interface.
4197c478bd9Sstevel@tonic-gate  */
4207c478bd9Sstevel@tonic-gate typedef struct priovec {
4217c478bd9Sstevel@tonic-gate 	void	*pio_base;	/* buffer in controlling process */
4227c478bd9Sstevel@tonic-gate 	size_t	pio_len;	/* size of read/write request */
4237c478bd9Sstevel@tonic-gate 	off_t	pio_offset;	/* virtual address in target process */
4247c478bd9Sstevel@tonic-gate } priovec_t;
4257c478bd9Sstevel@tonic-gate 
4267c478bd9Sstevel@tonic-gate /*
4277c478bd9Sstevel@tonic-gate  * Resource usage.  /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage
4287c478bd9Sstevel@tonic-gate  */
4297c478bd9Sstevel@tonic-gate typedef struct prusage {
4307c478bd9Sstevel@tonic-gate 	id_t		pr_lwpid;	/* lwp id.  0: process or defunct */
4317c478bd9Sstevel@tonic-gate 	int		pr_count;	/* number of contributing lwps */
4327c478bd9Sstevel@tonic-gate 	timestruc_t	pr_tstamp;	/* current time stamp */
4337c478bd9Sstevel@tonic-gate 	timestruc_t	pr_create;	/* process/lwp creation time stamp */
4347c478bd9Sstevel@tonic-gate 	timestruc_t	pr_term;	/* process/lwp termination time stamp */
4357c478bd9Sstevel@tonic-gate 	timestruc_t	pr_rtime;	/* total lwp real (elapsed) time */
4367c478bd9Sstevel@tonic-gate 	timestruc_t	pr_utime;	/* user level cpu time */
4377c478bd9Sstevel@tonic-gate 	timestruc_t	pr_stime;	/* system call cpu time */
4387c478bd9Sstevel@tonic-gate 	timestruc_t	pr_ttime;	/* other system trap cpu time */
4397c478bd9Sstevel@tonic-gate 	timestruc_t	pr_tftime;	/* text page fault sleep time */
4407c478bd9Sstevel@tonic-gate 	timestruc_t	pr_dftime;	/* data page fault sleep time */
4417c478bd9Sstevel@tonic-gate 	timestruc_t	pr_kftime;	/* kernel page fault sleep time */
4427c478bd9Sstevel@tonic-gate 	timestruc_t	pr_ltime;	/* user lock wait sleep time */
4437c478bd9Sstevel@tonic-gate 	timestruc_t	pr_slptime;	/* all other sleep time */
4447c478bd9Sstevel@tonic-gate 	timestruc_t	pr_wtime;	/* wait-cpu (latency) time */
4457c478bd9Sstevel@tonic-gate 	timestruc_t	pr_stoptime;	/* stopped time */
4467c478bd9Sstevel@tonic-gate 	timestruc_t	filltime[6];	/* filler for future expansion */
4477c478bd9Sstevel@tonic-gate 	ulong_t		pr_minf;	/* minor page faults */
4487c478bd9Sstevel@tonic-gate 	ulong_t		pr_majf;	/* major page faults */
4497c478bd9Sstevel@tonic-gate 	ulong_t		pr_nswap;	/* swaps */
4507c478bd9Sstevel@tonic-gate 	ulong_t		pr_inblk;	/* input blocks */
4517c478bd9Sstevel@tonic-gate 	ulong_t		pr_oublk;	/* output blocks */
4527c478bd9Sstevel@tonic-gate 	ulong_t		pr_msnd;	/* messages sent */
4537c478bd9Sstevel@tonic-gate 	ulong_t		pr_mrcv;	/* messages received */
4547c478bd9Sstevel@tonic-gate 	ulong_t		pr_sigs;	/* signals received */
4557c478bd9Sstevel@tonic-gate 	ulong_t		pr_vctx;	/* voluntary context switches */
4567c478bd9Sstevel@tonic-gate 	ulong_t		pr_ictx;	/* involuntary context switches */
4577c478bd9Sstevel@tonic-gate 	ulong_t		pr_sysc;	/* system calls */
4587c478bd9Sstevel@tonic-gate 	ulong_t		pr_ioch;	/* chars read and written */
4597c478bd9Sstevel@tonic-gate 	ulong_t		filler[10];	/* filler for future expansion */
4607c478bd9Sstevel@tonic-gate } prusage_t;
4617c478bd9Sstevel@tonic-gate 
4627c478bd9Sstevel@tonic-gate /*
4637c478bd9Sstevel@tonic-gate  * Page data file.  /proc/<pid>/pagedata
4647c478bd9Sstevel@tonic-gate  */
4657c478bd9Sstevel@tonic-gate 
4667c478bd9Sstevel@tonic-gate /* page data file header */
4677c478bd9Sstevel@tonic-gate typedef struct prpageheader {
4687c478bd9Sstevel@tonic-gate 	timestruc_t	pr_tstamp;	/* real time stamp */
4697c478bd9Sstevel@tonic-gate 	long		pr_nmap;	/* number of address space mappings */
4707c478bd9Sstevel@tonic-gate 	long		pr_npage;	/* total number of pages */
4717c478bd9Sstevel@tonic-gate } prpageheader_t;
4727c478bd9Sstevel@tonic-gate 
4737c478bd9Sstevel@tonic-gate /* page data mapping header */
4747c478bd9Sstevel@tonic-gate typedef struct prasmap {
4757c478bd9Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
4767c478bd9Sstevel@tonic-gate 	size_t	pr_npage;	/* number of pages in mapping */
4777c478bd9Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
4787c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
4797c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
4807c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
4817c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
4827c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
4837c478bd9Sstevel@tonic-gate } prasmap_t;
4847c478bd9Sstevel@tonic-gate 
4857c478bd9Sstevel@tonic-gate /*
4867c478bd9Sstevel@tonic-gate  * pr_npage bytes (plus 0-7 null bytes to round up to an 8-byte boundary)
4877c478bd9Sstevel@tonic-gate  * follow each mapping header, each containing zero or more of these flags.
4887c478bd9Sstevel@tonic-gate  */
4897c478bd9Sstevel@tonic-gate #define	PG_REFERENCED	0x02		/* page referenced since last read */
4907c478bd9Sstevel@tonic-gate #define	PG_MODIFIED	0x01		/* page modified since last read */
4917c478bd9Sstevel@tonic-gate #define	PG_HWMAPPED	0x04		/* page is present and mapped */
4927c478bd9Sstevel@tonic-gate 
4937c478bd9Sstevel@tonic-gate /*
494*34bdffbfSGarrett D'Amore  * Open files.  Only in core files (for now).  Note that we'd like to use
495*34bdffbfSGarrett D'Amore  * the stat or stat64 structure, but both of these structures are unfortunately
496*34bdffbfSGarrett D'Amore  * not consistent between 32 and 64 bit modes.  To keep our lives simpler, we
497*34bdffbfSGarrett D'Amore  * just define our own structure with types that are not sensitive to this
498*34bdffbfSGarrett D'Amore  * difference.  Also, it turns out that pfiles omits a lot of info from the
499*34bdffbfSGarrett D'Amore  * struct stat (e.g. times, device sizes, etc.) so we don't bother adding those
500*34bdffbfSGarrett D'Amore  * here.
501*34bdffbfSGarrett D'Amore  */
502*34bdffbfSGarrett D'Amore typedef struct prfdinfo {
503*34bdffbfSGarrett D'Amore 	int		pr_fd;
504*34bdffbfSGarrett D'Amore 	mode_t		pr_mode;
505*34bdffbfSGarrett D'Amore 
506*34bdffbfSGarrett D'Amore 	uid_t		pr_uid;
507*34bdffbfSGarrett D'Amore 	gid_t		pr_gid;
508*34bdffbfSGarrett D'Amore 
509*34bdffbfSGarrett D'Amore 	major_t		pr_major;	/* think stat.st_dev */
510*34bdffbfSGarrett D'Amore 	minor_t		pr_minor;
511*34bdffbfSGarrett D'Amore 
512*34bdffbfSGarrett D'Amore 	major_t		pr_rmajor;	/* think stat.st_rdev */
513*34bdffbfSGarrett D'Amore 	minor_t		pr_rminor;
514*34bdffbfSGarrett D'Amore 
515*34bdffbfSGarrett D'Amore 	ino64_t		pr_ino;
516*34bdffbfSGarrett D'Amore 	off64_t		pr_offset;
517*34bdffbfSGarrett D'Amore 	off64_t		pr_size;
518*34bdffbfSGarrett D'Amore 
519*34bdffbfSGarrett D'Amore 	int		pr_fileflags;	/* fcntl(F_GETXFL), etc */
520*34bdffbfSGarrett D'Amore 	int		pr_fdflags;	/* fcntl(F_GETFD), etc. */
521*34bdffbfSGarrett D'Amore 
522*34bdffbfSGarrett D'Amore 	char		pr_path[MAXPATHLEN];
523*34bdffbfSGarrett D'Amore } prfdinfo_t;
524*34bdffbfSGarrett D'Amore 
525*34bdffbfSGarrett D'Amore /*
5267c478bd9Sstevel@tonic-gate  * Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
5277c478bd9Sstevel@tonic-gate  */
5287c478bd9Sstevel@tonic-gate typedef struct prheader {
5297c478bd9Sstevel@tonic-gate 	long	pr_nent;	/* number of entries */
5307c478bd9Sstevel@tonic-gate 	long	pr_entsize;	/* size of each entry, in bytes */
5317c478bd9Sstevel@tonic-gate } prheader_t;
5327c478bd9Sstevel@tonic-gate 
5337c478bd9Sstevel@tonic-gate /*
5347c478bd9Sstevel@tonic-gate  * Macros for manipulating sets of flags.
5357c478bd9Sstevel@tonic-gate  * sp must be a pointer to one of sigset_t, fltset_t, or sysset_t.
5367c478bd9Sstevel@tonic-gate  * flag must be a member of the enumeration corresponding to *sp.
5377c478bd9Sstevel@tonic-gate  */
5387c478bd9Sstevel@tonic-gate 
5397c478bd9Sstevel@tonic-gate /* turn on all flags in set */
5407c478bd9Sstevel@tonic-gate #define	prfillset(sp) \
5417c478bd9Sstevel@tonic-gate 	{ register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
5427c478bd9Sstevel@tonic-gate 		while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0xFFFFFFFF; }
5437c478bd9Sstevel@tonic-gate 
5447c478bd9Sstevel@tonic-gate /* turn off all flags in set */
5457c478bd9Sstevel@tonic-gate #define	premptyset(sp) \
5467c478bd9Sstevel@tonic-gate 	{ register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
5477c478bd9Sstevel@tonic-gate 		while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0; }
5487c478bd9Sstevel@tonic-gate 
5497c478bd9Sstevel@tonic-gate /* turn on specified flag in set */
5507c478bd9Sstevel@tonic-gate #define	praddset(sp, flag) \
5517c478bd9Sstevel@tonic-gate 	((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
5527c478bd9Sstevel@tonic-gate 	(((uint32_t *)(sp))[((flag)-1)/32] |= (1U<<(((flag)-1)%32))) : 0))
5537c478bd9Sstevel@tonic-gate 
5547c478bd9Sstevel@tonic-gate /* turn off specified flag in set */
5557c478bd9Sstevel@tonic-gate #define	prdelset(sp, flag) \
5567c478bd9Sstevel@tonic-gate 	((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
5577c478bd9Sstevel@tonic-gate 	    (((uint32_t *)(sp))[((flag)-1)/32] &= ~(1U<<(((flag)-1)%32))) : 0))
5587c478bd9Sstevel@tonic-gate 
5597c478bd9Sstevel@tonic-gate /* query: != 0 iff flag is turned on in set */
5607c478bd9Sstevel@tonic-gate #define	prismember(sp, flag) \
5617c478bd9Sstevel@tonic-gate 	(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) && \
5627c478bd9Sstevel@tonic-gate 	    (((uint32_t *)(sp))[((flag)-1)/32] & (1U<<(((flag)-1)%32))))
5637c478bd9Sstevel@tonic-gate 
5647c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
5657c478bd9Sstevel@tonic-gate 
5667c478bd9Sstevel@tonic-gate /*
5677c478bd9Sstevel@tonic-gate  * dev32_t version of PRNODEV
5687c478bd9Sstevel@tonic-gate  */
5697c478bd9Sstevel@tonic-gate #define	PRNODEV32 (dev32_t)(-1)
5707c478bd9Sstevel@tonic-gate 
5717c478bd9Sstevel@tonic-gate /*
5727c478bd9Sstevel@tonic-gate  * Kernel view of /proc structures for _ILP32 programs.
5737c478bd9Sstevel@tonic-gate  */
5747c478bd9Sstevel@tonic-gate 
5757c478bd9Sstevel@tonic-gate /*
5767c478bd9Sstevel@tonic-gate  * _ILP32 lwp status file.  /proc/<pid>/lwp/<lwpid>/lwpstatus
5777c478bd9Sstevel@tonic-gate  */
5787c478bd9Sstevel@tonic-gate typedef struct lwpstatus32 {
5797c478bd9Sstevel@tonic-gate 	int	pr_flags;	/* flags */
5807c478bd9Sstevel@tonic-gate 	id32_t	pr_lwpid;	/* specific lwp identifier */
5817c478bd9Sstevel@tonic-gate 	short	pr_why;		/* reason for lwp stop, if stopped */
5827c478bd9Sstevel@tonic-gate 	short	pr_what;	/* more detailed reason */
5837c478bd9Sstevel@tonic-gate 	short	pr_cursig;	/* current signal, if any */
5847c478bd9Sstevel@tonic-gate 	short	pr_pad1;
5857c478bd9Sstevel@tonic-gate 	siginfo32_t pr_info;	/* info associated with signal or fault */
5867c478bd9Sstevel@tonic-gate 	sigset_t pr_lwppend;	/* set of signals pending to the lwp */
5877c478bd9Sstevel@tonic-gate 	sigset_t pr_lwphold;	/* set of signals blocked by the lwp */
5887c478bd9Sstevel@tonic-gate 	struct sigaction32 pr_action;	/* signal action for current signal */
5897c478bd9Sstevel@tonic-gate 	stack32_t pr_altstack;	/* alternate signal stack info */
5907c478bd9Sstevel@tonic-gate 	caddr32_t pr_oldcontext;	/* address of previous ucontext */
5917c478bd9Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
5927c478bd9Sstevel@tonic-gate 	short	pr_nsysarg;	/* number of arguments to this syscall */
5937c478bd9Sstevel@tonic-gate 	int	pr_errno;	/* errno for failed syscall, 0 if successful */
5947c478bd9Sstevel@tonic-gate 	int32_t	pr_sysarg[PRSYSARGS];	/* arguments to this syscall */
5957c478bd9Sstevel@tonic-gate 	int32_t	pr_rval1;	/* primary syscall return value */
5967c478bd9Sstevel@tonic-gate 	int32_t	pr_rval2;	/* second syscall return value, if any */
5977c478bd9Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
5987c478bd9Sstevel@tonic-gate 	timestruc32_t pr_tstamp;	/* real-time time stamp of stop */
5997c478bd9Sstevel@tonic-gate 	timestruc32_t pr_utime;	/* lwp user cpu time */
6007c478bd9Sstevel@tonic-gate 	timestruc32_t pr_stime;	/* lwp system cpu time */
6017c478bd9Sstevel@tonic-gate 	int	pr_filler[11 - 2 * sizeof (timestruc32_t) / sizeof (int)];
6027c478bd9Sstevel@tonic-gate 	int	pr_errpriv;	/* missing privilege */
6037c478bd9Sstevel@tonic-gate 	caddr32_t pr_ustack;	/* address of stack boundary data (stack32_t) */
6047c478bd9Sstevel@tonic-gate 	uint32_t pr_instr;	/* current instruction */
6057c478bd9Sstevel@tonic-gate 	prgregset32_t pr_reg;	/* general registers */
6067c478bd9Sstevel@tonic-gate 	prfpregset32_t pr_fpreg; /* floating-point registers */
6077c478bd9Sstevel@tonic-gate } lwpstatus32_t;
6087c478bd9Sstevel@tonic-gate 
6097c478bd9Sstevel@tonic-gate /*
6107c478bd9Sstevel@tonic-gate  * _ILP32 process status file.  /proc/<pid>/status
6117c478bd9Sstevel@tonic-gate  */
6127c478bd9Sstevel@tonic-gate typedef struct pstatus32 {
6137c478bd9Sstevel@tonic-gate 	int	pr_flags;	/* flags */
6147c478bd9Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
6157c478bd9Sstevel@tonic-gate 	pid32_t	pr_pid;		/* process id */
6167c478bd9Sstevel@tonic-gate 	pid32_t	pr_ppid;	/* parent process id */
6177c478bd9Sstevel@tonic-gate 	pid32_t	pr_pgid;	/* process group id */
6187c478bd9Sstevel@tonic-gate 	pid32_t	pr_sid;		/* session id */
6197c478bd9Sstevel@tonic-gate 	id32_t	pr_aslwpid;	/* historical; now always zero */
6207c478bd9Sstevel@tonic-gate 	id32_t	pr_agentid;	/* lwp id of the /proc agent lwp, if any */
6217c478bd9Sstevel@tonic-gate 	sigset_t pr_sigpend;	/* set of process pending signals */
6227c478bd9Sstevel@tonic-gate 	caddr32_t pr_brkbase;	/* address of the process heap */
6237c478bd9Sstevel@tonic-gate 	size32_t pr_brksize;	/* size of the process heap, in bytes */
6247c478bd9Sstevel@tonic-gate 	caddr32_t pr_stkbase;	/* address of the process stack */
6257c478bd9Sstevel@tonic-gate 	size32_t pr_stksize;	/* size of the process stack, in bytes */
6267c478bd9Sstevel@tonic-gate 	timestruc32_t pr_utime;	/* process user cpu time */
6277c478bd9Sstevel@tonic-gate 	timestruc32_t pr_stime;	/* process system cpu time */
6287c478bd9Sstevel@tonic-gate 	timestruc32_t pr_cutime;	/* sum of children's user times */
6297c478bd9Sstevel@tonic-gate 	timestruc32_t pr_cstime;	/* sum of children's system times */
6307c478bd9Sstevel@tonic-gate 	sigset_t pr_sigtrace;	/* set of traced signals */
6317c478bd9Sstevel@tonic-gate 	fltset_t pr_flttrace;	/* set of traced faults */
6327c478bd9Sstevel@tonic-gate 	sysset_t pr_sysentry;	/* set of system calls traced on entry */
6337c478bd9Sstevel@tonic-gate 	sysset_t pr_sysexit;	/* set of system calls traced on exit */
6347c478bd9Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
6357c478bd9Sstevel@tonic-gate 	char	pr_pad[3];
6367c478bd9Sstevel@tonic-gate 	id32_t	pr_taskid;	/* task id */
6377c478bd9Sstevel@tonic-gate 	id32_t	pr_projid;	/* project id */
6387c478bd9Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
6397c478bd9Sstevel@tonic-gate 	id32_t	pr_zoneid;	/* zone id */
6407c478bd9Sstevel@tonic-gate 	int	pr_filler[15];	/* reserved for future use */
6417c478bd9Sstevel@tonic-gate 	lwpstatus32_t pr_lwp;	/* status of the representative lwp */
6427c478bd9Sstevel@tonic-gate } pstatus32_t;
6437c478bd9Sstevel@tonic-gate 
6447c478bd9Sstevel@tonic-gate /*
6457c478bd9Sstevel@tonic-gate  * _ILP32 lwp ps(1) information file.  /proc/<pid>/lwp/<lwpid>/lwpsinfo
6467c478bd9Sstevel@tonic-gate  */
6477c478bd9Sstevel@tonic-gate typedef struct lwpsinfo32 {
6487c478bd9Sstevel@tonic-gate 	int	pr_flag;	/* lwp flags */
6497c478bd9Sstevel@tonic-gate 	id32_t	pr_lwpid;	/* lwp id */
6507c478bd9Sstevel@tonic-gate 	caddr32_t pr_addr;	/* internal address of lwp */
6517c478bd9Sstevel@tonic-gate 	caddr32_t pr_wchan;	/* wait addr for sleeping lwp */
6527c478bd9Sstevel@tonic-gate 	char	pr_stype;	/* synchronization event type */
6537c478bd9Sstevel@tonic-gate 	char	pr_state;	/* numeric lwp state */
6547c478bd9Sstevel@tonic-gate 	char	pr_sname;	/* printable character for pr_state */
6557c478bd9Sstevel@tonic-gate 	char	pr_nice;	/* nice for cpu usage */
6567c478bd9Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
6577c478bd9Sstevel@tonic-gate 	char	pr_oldpri;	/* pre-SVR4, low value is high priority */
6587c478bd9Sstevel@tonic-gate 	char	pr_cpu;		/* pre-SVR4, cpu usage for scheduling */
6597c478bd9Sstevel@tonic-gate 	int	pr_pri;		/* priority, high value is high priority */
6607c478bd9Sstevel@tonic-gate 			/* The following percent number is a 16-bit binary */
6617c478bd9Sstevel@tonic-gate 			/* fraction [0 .. 1] with the binary point to the */
6627c478bd9Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
6637c478bd9Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by this lwp */
6647c478bd9Sstevel@tonic-gate 	ushort_t pr_pad;
6657c478bd9Sstevel@tonic-gate 	timestruc32_t pr_start;	/* lwp start time, from the epoch */
6667c478bd9Sstevel@tonic-gate 	timestruc32_t pr_time;	/* usr+sys cpu time for this lwp */
6677c478bd9Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
6687c478bd9Sstevel@tonic-gate 	char	pr_name[PRFNSZ];	/* name of system lwp */
6697c478bd9Sstevel@tonic-gate 	processorid_t pr_onpro;		/* processor which last ran this lwp */
6707c478bd9Sstevel@tonic-gate 	processorid_t pr_bindpro;	/* processor to which lwp is bound */
6717c478bd9Sstevel@tonic-gate 	psetid_t pr_bindpset;	/* processor set to which lwp is bound */
672a3c951f0Sakolb 	int	pr_lgrp;	/* lwp home lgroup */
673c6402783Sakolb 	int	pr_filler[4];	/* reserved for future use */
6747c478bd9Sstevel@tonic-gate } lwpsinfo32_t;
6757c478bd9Sstevel@tonic-gate 
6767c478bd9Sstevel@tonic-gate /*
6777c478bd9Sstevel@tonic-gate  * _ILP32 process ps(1) information file.  /proc/<pid>/psinfo
6787c478bd9Sstevel@tonic-gate  */
6797c478bd9Sstevel@tonic-gate typedef struct psinfo32 {
6807c478bd9Sstevel@tonic-gate 	int	pr_flag;	/* process flags */
6817c478bd9Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
6827c478bd9Sstevel@tonic-gate 	pid32_t	pr_pid;		/* unique process id */
6837c478bd9Sstevel@tonic-gate 	pid32_t	pr_ppid;	/* process id of parent */
6847c478bd9Sstevel@tonic-gate 	pid32_t	pr_pgid;	/* pid of process group leader */
6857c478bd9Sstevel@tonic-gate 	pid32_t	pr_sid;		/* session id */
6867c478bd9Sstevel@tonic-gate 	uid32_t	pr_uid;		/* real user id */
6877c478bd9Sstevel@tonic-gate 	uid32_t	pr_euid;	/* effective user id */
6887c478bd9Sstevel@tonic-gate 	gid32_t	pr_gid;		/* real group id */
6897c478bd9Sstevel@tonic-gate 	gid32_t	pr_egid;	/* effective group id */
6907c478bd9Sstevel@tonic-gate 	caddr32_t pr_addr;	/* address of process */
6917c478bd9Sstevel@tonic-gate 	size32_t pr_size;	/* size of process image in Kbytes */
6927c478bd9Sstevel@tonic-gate 	size32_t pr_rssize;	/* resident set size in Kbytes */
6937c478bd9Sstevel@tonic-gate 	size32_t pr_pad1;
6947c478bd9Sstevel@tonic-gate 	dev32_t	pr_ttydev;	/* controlling tty device (or PRNODEV) */
6957c478bd9Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by all lwps */
6967c478bd9Sstevel@tonic-gate 	ushort_t pr_pctmem;	/* % of system memory used by process */
6977c478bd9Sstevel@tonic-gate 	timestruc32_t pr_start;	/* process start time, from the epoch */
6987c478bd9Sstevel@tonic-gate 	timestruc32_t pr_time;	/* usr+sys cpu time for this process */
6997c478bd9Sstevel@tonic-gate 	timestruc32_t pr_ctime;	/* usr+sys cpu time for reaped children */
7007c478bd9Sstevel@tonic-gate 	char	pr_fname[PRFNSZ];	/* name of execed file */
7017c478bd9Sstevel@tonic-gate 	char	pr_psargs[PRARGSZ];	/* initial characters of arg list */
7027c478bd9Sstevel@tonic-gate 	int	pr_wstat;	/* if zombie, the wait() status */
7037c478bd9Sstevel@tonic-gate 	int	pr_argc;	/* initial argument count */
7047c478bd9Sstevel@tonic-gate 	caddr32_t pr_argv;	/* address of initial argument vector */
7057c478bd9Sstevel@tonic-gate 	caddr32_t pr_envp;	/* address of initial environment vector */
7067c478bd9Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
7077c478bd9Sstevel@tonic-gate 	char	pr_pad2[3];
7087c478bd9Sstevel@tonic-gate 	id32_t	pr_taskid;	/* task id */
7097c478bd9Sstevel@tonic-gate 	id32_t	pr_projid;	/* project id */
7107c478bd9Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
7117c478bd9Sstevel@tonic-gate 	id32_t	pr_poolid;	/* pool id */
7127c478bd9Sstevel@tonic-gate 	id32_t	pr_zoneid;	/* zone id */
7137c478bd9Sstevel@tonic-gate 	id32_t	pr_contract;	/* process contract */
7147c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* reserved for future use */
7157c478bd9Sstevel@tonic-gate 	lwpsinfo32_t pr_lwp;	/* information for representative lwp */
7167c478bd9Sstevel@tonic-gate } psinfo32_t;
7177c478bd9Sstevel@tonic-gate 
7187c478bd9Sstevel@tonic-gate /*
7197c478bd9Sstevel@tonic-gate  * _ILP32 Memory-management interface.  /proc/<pid>/map /proc/<pid>/rmap
7207c478bd9Sstevel@tonic-gate  */
7217c478bd9Sstevel@tonic-gate typedef struct prmap32 {
7227c478bd9Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
7237c478bd9Sstevel@tonic-gate 	size32_t pr_size;	/* size of mapping in bytes */
7247c478bd9Sstevel@tonic-gate 	char	pr_mapname[64];	/* name in /proc/<pid>/object */
7257c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
7267c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
7277c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
7287c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
7297c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
7307c478bd9Sstevel@tonic-gate } prmap32_t;
7317c478bd9Sstevel@tonic-gate 
7327c478bd9Sstevel@tonic-gate /*
7337c478bd9Sstevel@tonic-gate  * _ILP32 HAT memory-map interface.  /proc/<pid>/xmap
7347c478bd9Sstevel@tonic-gate  */
7357c478bd9Sstevel@tonic-gate typedef struct prxmap32 {
7367c478bd9Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
7377c478bd9Sstevel@tonic-gate 	size32_t pr_size;	/* size of mapping in bytes */
7387c478bd9Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
7397c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
7407c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
7417c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
7427c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
7437c478bd9Sstevel@tonic-gate 	dev32_t	pr_dev;  /* st_dev from stat64() of mapped object, or PRNODEV */
7447c478bd9Sstevel@tonic-gate 	uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */
7457c478bd9Sstevel@tonic-gate 	uint32_t pr_rss;	/* pages of resident memory */
7467c478bd9Sstevel@tonic-gate 	uint32_t pr_anon;	/* pages of resident anonymous memory */
7477c478bd9Sstevel@tonic-gate 	uint32_t pr_locked;	/* pages of locked memory */
748f4471a27Selowe 	uint32_t pr_pad;	/* currently unused */
749f4471a27Selowe 	uint64_t pr_hatpagesize; /* pagesize of the hat mapping */
750f4471a27Selowe 	uint32_t pr_filler[6];	/* filler for future expansion */
7517c478bd9Sstevel@tonic-gate } prxmap32_t;
7527c478bd9Sstevel@tonic-gate 
7537c478bd9Sstevel@tonic-gate /*
7547c478bd9Sstevel@tonic-gate  * _ILP32 Process credentials.  PCSCRED and /proc/<pid>/cred
7557c478bd9Sstevel@tonic-gate  */
7567c478bd9Sstevel@tonic-gate typedef struct prcred32 {
7577c478bd9Sstevel@tonic-gate 	uid32_t	pr_euid;	/* effective user id */
7587c478bd9Sstevel@tonic-gate 	uid32_t	pr_ruid;	/* real user id */
7597c478bd9Sstevel@tonic-gate 	uid32_t	pr_suid;	/* saved user id (from exec) */
7607c478bd9Sstevel@tonic-gate 	gid32_t	pr_egid;	/* effective group id */
7617c478bd9Sstevel@tonic-gate 	gid32_t	pr_rgid;	/* real group id */
7627c478bd9Sstevel@tonic-gate 	gid32_t	pr_sgid;	/* saved group id (from exec) */
7637c478bd9Sstevel@tonic-gate 	int	pr_ngroups;	/* number of supplementary groups */
7647c478bd9Sstevel@tonic-gate 	gid32_t	pr_groups[1];	/* array of supplementary groups */
7657c478bd9Sstevel@tonic-gate } prcred32_t;
7667c478bd9Sstevel@tonic-gate 
7677c478bd9Sstevel@tonic-gate /*
7687c478bd9Sstevel@tonic-gate  * _ILP32 Watchpoint interface.  PCWATCH and /proc/<pid>/watch
7697c478bd9Sstevel@tonic-gate  */
7707c478bd9Sstevel@tonic-gate typedef struct prwatch32 {
7717c478bd9Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of watched area */
7727c478bd9Sstevel@tonic-gate 	size32_t pr_size;	/* size of watched area in bytes */
7737c478bd9Sstevel@tonic-gate 	int	pr_wflags;	/* watch type flags */
7747c478bd9Sstevel@tonic-gate 	int	pr_pad;
7757c478bd9Sstevel@tonic-gate } prwatch32_t;
7767c478bd9Sstevel@tonic-gate 
7777c478bd9Sstevel@tonic-gate /*
7787c478bd9Sstevel@tonic-gate  * _ILP32 PCREAD/PCWRITE I/O interface.
7797c478bd9Sstevel@tonic-gate  */
7807c478bd9Sstevel@tonic-gate typedef struct priovec32 {
7817c478bd9Sstevel@tonic-gate 	caddr32_t pio_base;	/* buffer in controlling process */
7827c478bd9Sstevel@tonic-gate 	size32_t pio_len;	/* size of read/write request */
7837c478bd9Sstevel@tonic-gate 	off32_t	pio_offset;	/* virtual address in target process */
7847c478bd9Sstevel@tonic-gate } priovec32_t;
7857c478bd9Sstevel@tonic-gate 
7867c478bd9Sstevel@tonic-gate /*
7877c478bd9Sstevel@tonic-gate  * _ILP32 Resource usage.  /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage
7887c478bd9Sstevel@tonic-gate  */
7897c478bd9Sstevel@tonic-gate typedef struct prusage32 {
7907c478bd9Sstevel@tonic-gate 	id32_t		pr_lwpid;	/* lwp id.  0: process or defunct */
7917c478bd9Sstevel@tonic-gate 	int32_t		pr_count;	/* number of contributing lwps */
7927c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_tstamp;	/* current time stamp */
7937c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_create;	/* process/lwp creation time stamp */
7947c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_term;	/* process/lwp termination time stamp */
7957c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_rtime;	/* total lwp real (elapsed) time */
7967c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_utime;	/* user level cpu time */
7977c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_stime;	/* system call cpu time */
7987c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_ttime;	/* other system trap cpu time */
7997c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_tftime;	/* text page fault sleep time */
8007c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_dftime;	/* data page fault sleep time */
8017c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_kftime;	/* kernel page fault sleep time */
8027c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_ltime;	/* user lock wait sleep time */
8037c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_slptime;	/* all other sleep time */
8047c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_wtime;	/* wait-cpu (latency) time */
8057c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_stoptime;	/* stopped time */
8067c478bd9Sstevel@tonic-gate 	timestruc32_t	filltime[6];	/* filler for future expansion */
8077c478bd9Sstevel@tonic-gate 	uint32_t	pr_minf;	/* minor page faults */
8087c478bd9Sstevel@tonic-gate 	uint32_t	pr_majf;	/* major page faults */
8097c478bd9Sstevel@tonic-gate 	uint32_t	pr_nswap;	/* swaps */
8107c478bd9Sstevel@tonic-gate 	uint32_t	pr_inblk;	/* input blocks */
8117c478bd9Sstevel@tonic-gate 	uint32_t	pr_oublk;	/* output blocks */
8127c478bd9Sstevel@tonic-gate 	uint32_t	pr_msnd;	/* messages sent */
8137c478bd9Sstevel@tonic-gate 	uint32_t	pr_mrcv;	/* messages received */
8147c478bd9Sstevel@tonic-gate 	uint32_t	pr_sigs;	/* signals received */
8157c478bd9Sstevel@tonic-gate 	uint32_t	pr_vctx;	/* voluntary context switches */
8167c478bd9Sstevel@tonic-gate 	uint32_t	pr_ictx;	/* involuntary context switches */
8177c478bd9Sstevel@tonic-gate 	uint32_t	pr_sysc;	/* system calls */
8187c478bd9Sstevel@tonic-gate 	uint32_t	pr_ioch;	/* chars read and written */
8197c478bd9Sstevel@tonic-gate 	uint32_t	filler[10];	/* filler for future expansion */
8207c478bd9Sstevel@tonic-gate } prusage32_t;
8217c478bd9Sstevel@tonic-gate 
8227c478bd9Sstevel@tonic-gate /*
8237c478bd9Sstevel@tonic-gate  * _ILP32 Page data file.  /proc/<pid>/pagedata
8247c478bd9Sstevel@tonic-gate  */
8257c478bd9Sstevel@tonic-gate 
8267c478bd9Sstevel@tonic-gate /* _ILP32 page data file header */
8277c478bd9Sstevel@tonic-gate typedef struct prpageheader32 {
8287c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_tstamp;	/* real time stamp */
8297c478bd9Sstevel@tonic-gate 	int32_t		pr_nmap;	/* number of address space mappings */
8307c478bd9Sstevel@tonic-gate 	int32_t		pr_npage;	/* total number of pages */
8317c478bd9Sstevel@tonic-gate } prpageheader32_t;
8327c478bd9Sstevel@tonic-gate 
8337c478bd9Sstevel@tonic-gate /* _ILP32 page data mapping header */
8347c478bd9Sstevel@tonic-gate typedef struct prasmap32 {
8357c478bd9Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
8367c478bd9Sstevel@tonic-gate 	size32_t pr_npage;	/* number of pages in mapping */
8377c478bd9Sstevel@tonic-gate 	char	pr_mapname[64];	/* name in /proc/<pid>/object */
8387c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
8397c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
8407c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
8417c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
8427c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
8437c478bd9Sstevel@tonic-gate } prasmap32_t;
8447c478bd9Sstevel@tonic-gate 
8457c478bd9Sstevel@tonic-gate /*
8467c478bd9Sstevel@tonic-gate  * _ILP32 Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
8477c478bd9Sstevel@tonic-gate  */
8487c478bd9Sstevel@tonic-gate typedef struct prheader32 {
8497c478bd9Sstevel@tonic-gate 	int32_t	pr_nent;	/* number of entries */
8507c478bd9Sstevel@tonic-gate 	int32_t	pr_entsize;	/* size of each entry, in bytes */
8517c478bd9Sstevel@tonic-gate } prheader32_t;
8527c478bd9Sstevel@tonic-gate 
8537c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
8547c478bd9Sstevel@tonic-gate 
8557c478bd9Sstevel@tonic-gate #endif	/* !_KERNEL && _STRUCTURED_PROC == 0 */
8567c478bd9Sstevel@tonic-gate 
8577c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
8587c478bd9Sstevel@tonic-gate }
8597c478bd9Sstevel@tonic-gate #endif
8607c478bd9Sstevel@tonic-gate 
8617c478bd9Sstevel@tonic-gate #endif	/* _SYS_PROCFS_H */
862