xref: /onnv-gate/usr/src/uts/common/sys/procfs.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _SYS_PROCFS_H
28*0Sstevel@tonic-gate #define	_SYS_PROCFS_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate /*
37*0Sstevel@tonic-gate  * This definition is temporary.  Structured proc is the preferred API,
38*0Sstevel@tonic-gate  * and the older ioctl-based interface will be removed in a future version
39*0Sstevel@tonic-gate  * of Solaris.  Until then, by default, including <sys/procfs.h> will
40*0Sstevel@tonic-gate  * provide the older ioctl-based /proc definitions.  To get the structured
41*0Sstevel@tonic-gate  * /proc definitions, either include <procfs.h> or define _STRUCTURED_PROC
42*0Sstevel@tonic-gate  * to be 1 before including <sys/procfs.h>.
43*0Sstevel@tonic-gate  */
44*0Sstevel@tonic-gate #ifndef	_STRUCTURED_PROC
45*0Sstevel@tonic-gate #define	_STRUCTURED_PROC	0
46*0Sstevel@tonic-gate #endif
47*0Sstevel@tonic-gate 
48*0Sstevel@tonic-gate #if !defined(_KERNEL) && _STRUCTURED_PROC == 0
49*0Sstevel@tonic-gate 
50*0Sstevel@tonic-gate #include <sys/old_procfs.h>
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate #else	/* !defined(_KERNEL) && _STRUCTURED_PROC == 0 */
53*0Sstevel@tonic-gate 
54*0Sstevel@tonic-gate #include <sys/feature_tests.h>
55*0Sstevel@tonic-gate #include <sys/types.h>
56*0Sstevel@tonic-gate #include <sys/time_impl.h>
57*0Sstevel@tonic-gate #include <sys/signal.h>
58*0Sstevel@tonic-gate #include <sys/siginfo.h>
59*0Sstevel@tonic-gate #include <sys/fault.h>
60*0Sstevel@tonic-gate #include <sys/syscall.h>
61*0Sstevel@tonic-gate #include <sys/pset.h>
62*0Sstevel@tonic-gate #include <sys/procfs_isa.h>
63*0Sstevel@tonic-gate #include <sys/priv.h>
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
66*0Sstevel@tonic-gate #error	"Cannot use procfs in the large file compilation environment"
67*0Sstevel@tonic-gate #endif
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate /*
70*0Sstevel@tonic-gate  * System call interfaces for /proc.
71*0Sstevel@tonic-gate  */
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate /*
74*0Sstevel@tonic-gate  * Control codes (long values) for messages written to ctl and lwpctl files.
75*0Sstevel@tonic-gate  */
76*0Sstevel@tonic-gate #define	PCNULL   0L	/* null request, advance to next message */
77*0Sstevel@tonic-gate #define	PCSTOP   1L	/* direct process or lwp to stop and wait for stop */
78*0Sstevel@tonic-gate #define	PCDSTOP  2L	/* direct process or lwp to stop */
79*0Sstevel@tonic-gate #define	PCWSTOP  3L	/* wait for process or lwp to stop, no timeout */
80*0Sstevel@tonic-gate #define	PCTWSTOP 4L	/* wait for stop, with long millisecond timeout arg */
81*0Sstevel@tonic-gate #define	PCRUN    5L	/* make process/lwp runnable, w/ long flags argument */
82*0Sstevel@tonic-gate #define	PCCSIG   6L	/* clear current signal from lwp */
83*0Sstevel@tonic-gate #define	PCCFAULT 7L	/* clear current fault from lwp */
84*0Sstevel@tonic-gate #define	PCSSIG   8L	/* set current signal from siginfo_t argument */
85*0Sstevel@tonic-gate #define	PCKILL   9L	/* post a signal to process/lwp, long argument */
86*0Sstevel@tonic-gate #define	PCUNKILL 10L	/* delete a pending signal from process/lwp, long arg */
87*0Sstevel@tonic-gate #define	PCSHOLD  11L	/* set lwp signal mask from sigset_t argument */
88*0Sstevel@tonic-gate #define	PCSTRACE 12L	/* set traced signal set from sigset_t argument */
89*0Sstevel@tonic-gate #define	PCSFAULT 13L	/* set traced fault set from fltset_t argument */
90*0Sstevel@tonic-gate #define	PCSENTRY 14L	/* set traced syscall entry set from sysset_t arg */
91*0Sstevel@tonic-gate #define	PCSEXIT  15L	/* set traced syscall exit set from sysset_t arg */
92*0Sstevel@tonic-gate #define	PCSET    16L	/* set modes from long argument */
93*0Sstevel@tonic-gate #define	PCUNSET  17L	/* unset modes from long argument */
94*0Sstevel@tonic-gate #define	PCSREG   18L	/* set lwp general registers from prgregset_t arg */
95*0Sstevel@tonic-gate #define	PCSFPREG 19L	/* set lwp floating-point registers from prfpregset_t */
96*0Sstevel@tonic-gate #define	PCSXREG  20L	/* set lwp extra registers from prxregset_t arg */
97*0Sstevel@tonic-gate #define	PCNICE   21L	/* set nice priority from long argument */
98*0Sstevel@tonic-gate #define	PCSVADDR 22L	/* set %pc virtual address from long argument */
99*0Sstevel@tonic-gate #define	PCWATCH  23L	/* set/unset watched memory area from prwatch_t arg */
100*0Sstevel@tonic-gate #define	PCAGENT  24L	/* create agent lwp with regs from prgregset_t arg */
101*0Sstevel@tonic-gate #define	PCREAD   25L	/* read from the address space via priovec_t arg */
102*0Sstevel@tonic-gate #define	PCWRITE  26L	/* write to the address space via priovec_t arg */
103*0Sstevel@tonic-gate #define	PCSCRED  27L	/* set process credentials from prcred_t argument */
104*0Sstevel@tonic-gate #define	PCSASRS  28L	/* set ancillary state registers from asrset_t arg */
105*0Sstevel@tonic-gate #define	PCSPRIV  29L	/* set process privileges from prpriv_t argument */
106*0Sstevel@tonic-gate #define	PCSZONE  30L	/* set zoneid from zoneid_t argument */
107*0Sstevel@tonic-gate #define	PCSCREDX 31L	/* as PCSCRED but with supplemental groups */
108*0Sstevel@tonic-gate /*
109*0Sstevel@tonic-gate  * PCRUN long operand flags.
110*0Sstevel@tonic-gate  */
111*0Sstevel@tonic-gate #define	PRCSIG		0x01	/* clear current signal, if any */
112*0Sstevel@tonic-gate #define	PRCFAULT	0x02	/* clear current fault, if any */
113*0Sstevel@tonic-gate #define	PRSTEP		0x04	/* direct the lwp to single-step */
114*0Sstevel@tonic-gate #define	PRSABORT	0x08	/* abort syscall, if in syscall */
115*0Sstevel@tonic-gate #define	PRSTOP		0x10	/* set directed stop request */
116*0Sstevel@tonic-gate 
117*0Sstevel@tonic-gate /*
118*0Sstevel@tonic-gate  * lwp status file.  /proc/<pid>/lwp/<lwpid>/lwpstatus
119*0Sstevel@tonic-gate  */
120*0Sstevel@tonic-gate #define	PRCLSZ		8	/* maximum size of scheduling class name */
121*0Sstevel@tonic-gate #define	PRSYSARGS	8	/* maximum number of syscall arguments */
122*0Sstevel@tonic-gate typedef struct lwpstatus {
123*0Sstevel@tonic-gate 	int	pr_flags;	/* flags (see below) */
124*0Sstevel@tonic-gate 	id_t	pr_lwpid;	/* specific lwp identifier */
125*0Sstevel@tonic-gate 	short	pr_why;		/* reason for lwp stop, if stopped */
126*0Sstevel@tonic-gate 	short	pr_what;	/* more detailed reason */
127*0Sstevel@tonic-gate 	short	pr_cursig;	/* current signal, if any */
128*0Sstevel@tonic-gate 	short	pr_pad1;
129*0Sstevel@tonic-gate 	siginfo_t pr_info;	/* info associated with signal or fault */
130*0Sstevel@tonic-gate 	sigset_t pr_lwppend;	/* set of signals pending to the lwp */
131*0Sstevel@tonic-gate 	sigset_t pr_lwphold;	/* set of signals blocked by the lwp */
132*0Sstevel@tonic-gate 	struct sigaction pr_action;	/* signal action for current signal */
133*0Sstevel@tonic-gate 	stack_t	pr_altstack;	/* alternate signal stack info */
134*0Sstevel@tonic-gate 	uintptr_t pr_oldcontext;	/* address of previous ucontext */
135*0Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
136*0Sstevel@tonic-gate 	short	pr_nsysarg;	/* number of arguments to this syscall */
137*0Sstevel@tonic-gate 	int	pr_errno;	/* errno for failed syscall, 0 if successful */
138*0Sstevel@tonic-gate 	long	pr_sysarg[PRSYSARGS];	/* arguments to this syscall */
139*0Sstevel@tonic-gate 	long	pr_rval1;	/* primary syscall return value */
140*0Sstevel@tonic-gate 	long	pr_rval2;	/* second syscall return value, if any */
141*0Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
142*0Sstevel@tonic-gate 	timestruc_t pr_tstamp;	/* real-time time stamp of stop */
143*0Sstevel@tonic-gate 	timestruc_t pr_utime;	/* lwp user cpu time */
144*0Sstevel@tonic-gate 	timestruc_t pr_stime;	/* lwp system cpu time */
145*0Sstevel@tonic-gate 	int	pr_filler[11 - 2 * sizeof (timestruc_t) / sizeof (int)];
146*0Sstevel@tonic-gate 	int	pr_errpriv;	/* missing privilege */
147*0Sstevel@tonic-gate 	uintptr_t pr_ustack;	/* address of stack boundary data (stack_t) */
148*0Sstevel@tonic-gate 	ulong_t	pr_instr;	/* current instruction */
149*0Sstevel@tonic-gate 	prgregset_t pr_reg;	/* general registers */
150*0Sstevel@tonic-gate 	prfpregset_t pr_fpreg;	/* floating-point registers */
151*0Sstevel@tonic-gate } lwpstatus_t;
152*0Sstevel@tonic-gate 
153*0Sstevel@tonic-gate /*
154*0Sstevel@tonic-gate  * process status file.  /proc/<pid>/status
155*0Sstevel@tonic-gate  */
156*0Sstevel@tonic-gate typedef struct pstatus {
157*0Sstevel@tonic-gate 	int	pr_flags;	/* flags (see below) */
158*0Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
159*0Sstevel@tonic-gate 	pid_t	pr_pid;		/* process id */
160*0Sstevel@tonic-gate 	pid_t	pr_ppid;	/* parent process id */
161*0Sstevel@tonic-gate 	pid_t	pr_pgid;	/* process group id */
162*0Sstevel@tonic-gate 	pid_t	pr_sid;		/* session id */
163*0Sstevel@tonic-gate 	id_t	pr_aslwpid;	/* historical; now always zero */
164*0Sstevel@tonic-gate 	id_t	pr_agentid;	/* lwp id of the /proc agent lwp, if any */
165*0Sstevel@tonic-gate 	sigset_t pr_sigpend;	/* set of process pending signals */
166*0Sstevel@tonic-gate 	uintptr_t pr_brkbase;	/* address of the process heap */
167*0Sstevel@tonic-gate 	size_t	pr_brksize;	/* size of the process heap, in bytes */
168*0Sstevel@tonic-gate 	uintptr_t pr_stkbase;	/* address of the process stack */
169*0Sstevel@tonic-gate 	size_t	pr_stksize;	/* size of the process stack, in bytes */
170*0Sstevel@tonic-gate 	timestruc_t pr_utime;	/* process user cpu time */
171*0Sstevel@tonic-gate 	timestruc_t pr_stime;	/* process system cpu time */
172*0Sstevel@tonic-gate 	timestruc_t pr_cutime;	/* sum of children's user times */
173*0Sstevel@tonic-gate 	timestruc_t pr_cstime;	/* sum of children's system times */
174*0Sstevel@tonic-gate 	sigset_t pr_sigtrace;	/* set of traced signals */
175*0Sstevel@tonic-gate 	fltset_t pr_flttrace;	/* set of traced faults */
176*0Sstevel@tonic-gate 	sysset_t pr_sysentry;	/* set of system calls traced on entry */
177*0Sstevel@tonic-gate 	sysset_t pr_sysexit;	/* set of system calls traced on exit */
178*0Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process (see below) */
179*0Sstevel@tonic-gate 	char	pr_pad[3];
180*0Sstevel@tonic-gate 	taskid_t pr_taskid;	/* task id */
181*0Sstevel@tonic-gate 	projid_t pr_projid;	/* project id */
182*0Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
183*0Sstevel@tonic-gate 	zoneid_t pr_zoneid;	/* zone id */
184*0Sstevel@tonic-gate 	int	pr_filler[15];	/* reserved for future use */
185*0Sstevel@tonic-gate 	lwpstatus_t pr_lwp;	/* status of the representative lwp */
186*0Sstevel@tonic-gate } pstatus_t;
187*0Sstevel@tonic-gate 
188*0Sstevel@tonic-gate /*
189*0Sstevel@tonic-gate  * pr_flags (same values appear in both pstatus_t and lwpstatus_t pr_flags).
190*0Sstevel@tonic-gate  *
191*0Sstevel@tonic-gate  * These flags do *not* apply to psinfo_t.pr_flag or lwpsinfo_t.pr_flag
192*0Sstevel@tonic-gate  * (which are both deprecated).
193*0Sstevel@tonic-gate  */
194*0Sstevel@tonic-gate /* The following flags apply to the specific or representative lwp */
195*0Sstevel@tonic-gate #define	PR_STOPPED 0x00000001	/* lwp is stopped */
196*0Sstevel@tonic-gate #define	PR_ISTOP   0x00000002	/* lwp is stopped on an event of interest */
197*0Sstevel@tonic-gate #define	PR_DSTOP   0x00000004	/* lwp has a stop directive in effect */
198*0Sstevel@tonic-gate #define	PR_STEP	   0x00000008	/* lwp has a single-step directive in effect */
199*0Sstevel@tonic-gate #define	PR_ASLEEP  0x00000010	/* lwp is sleeping in a system call */
200*0Sstevel@tonic-gate #define	PR_PCINVAL 0x00000020	/* contents of pr_instr undefined */
201*0Sstevel@tonic-gate #define	PR_ASLWP   0x00000040	/* obsolete flag; never set */
202*0Sstevel@tonic-gate #define	PR_AGENT   0x00000080	/* this lwp is the /proc agent lwp */
203*0Sstevel@tonic-gate #define	PR_DETACH  0x00000100	/* this is a detached lwp */
204*0Sstevel@tonic-gate #define	PR_DAEMON  0x00000200	/* this is a daemon lwp */
205*0Sstevel@tonic-gate /* The following flags apply to the process, not to an individual lwp */
206*0Sstevel@tonic-gate #define	PR_ISSYS   0x00001000	/* this is a system process */
207*0Sstevel@tonic-gate #define	PR_VFORKP  0x00002000	/* process is the parent of a vfork()d child */
208*0Sstevel@tonic-gate #define	PR_ORPHAN  0x00004000	/* process's process group is orphaned */
209*0Sstevel@tonic-gate /* The following process flags are modes settable by PCSET/PCUNSET */
210*0Sstevel@tonic-gate #define	PR_FORK	   0x00100000	/* inherit-on-fork is in effect */
211*0Sstevel@tonic-gate #define	PR_RLC	   0x00200000	/* run-on-last-close is in effect */
212*0Sstevel@tonic-gate #define	PR_KLC	   0x00400000	/* kill-on-last-close is in effect */
213*0Sstevel@tonic-gate #define	PR_ASYNC   0x00800000	/* asynchronous-stop is in effect */
214*0Sstevel@tonic-gate #define	PR_MSACCT  0x01000000	/* micro-state usage accounting is in effect */
215*0Sstevel@tonic-gate #define	PR_BPTADJ  0x02000000	/* breakpoint trap pc adjustment is in effect */
216*0Sstevel@tonic-gate #define	PR_PTRACE  0x04000000	/* ptrace-compatibility mode is in effect */
217*0Sstevel@tonic-gate #define	PR_MSFORK  0x08000000	/* micro-state accounting inherited on fork */
218*0Sstevel@tonic-gate #define	PR_IDLE    0x10000000	/* lwp is a cpu's idle thread */
219*0Sstevel@tonic-gate 
220*0Sstevel@tonic-gate /*
221*0Sstevel@tonic-gate  * See <sys/procfs_isa.h> for possible values of pr_dmodel.
222*0Sstevel@tonic-gate  */
223*0Sstevel@tonic-gate 
224*0Sstevel@tonic-gate /*
225*0Sstevel@tonic-gate  * Reasons for stopping (pr_why).
226*0Sstevel@tonic-gate  */
227*0Sstevel@tonic-gate #define	PR_REQUESTED	1
228*0Sstevel@tonic-gate #define	PR_SIGNALLED	2
229*0Sstevel@tonic-gate #define	PR_SYSENTRY	3
230*0Sstevel@tonic-gate #define	PR_SYSEXIT	4
231*0Sstevel@tonic-gate #define	PR_JOBCONTROL	5
232*0Sstevel@tonic-gate #define	PR_FAULTED	6
233*0Sstevel@tonic-gate #define	PR_SUSPENDED	7
234*0Sstevel@tonic-gate #define	PR_CHECKPOINT	8
235*0Sstevel@tonic-gate 
236*0Sstevel@tonic-gate /*
237*0Sstevel@tonic-gate  * lwp ps(1) information file.  /proc/<pid>/lwp/<lwpid>/lwpsinfo
238*0Sstevel@tonic-gate  */
239*0Sstevel@tonic-gate #define	PRFNSZ		16	/* Maximum size of execed filename */
240*0Sstevel@tonic-gate typedef struct lwpsinfo {
241*0Sstevel@tonic-gate 	int	pr_flag;	/* lwp flags (DEPRECATED; do not use) */
242*0Sstevel@tonic-gate 	id_t	pr_lwpid;	/* lwp id */
243*0Sstevel@tonic-gate 	uintptr_t pr_addr;	/* internal address of lwp */
244*0Sstevel@tonic-gate 	uintptr_t pr_wchan;	/* wait addr for sleeping lwp */
245*0Sstevel@tonic-gate 	char	pr_stype;	/* synchronization event type */
246*0Sstevel@tonic-gate 	char	pr_state;	/* numeric lwp state */
247*0Sstevel@tonic-gate 	char	pr_sname;	/* printable character for pr_state */
248*0Sstevel@tonic-gate 	char	pr_nice;	/* nice for cpu usage */
249*0Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
250*0Sstevel@tonic-gate 	char	pr_oldpri;	/* pre-SVR4, low value is high priority */
251*0Sstevel@tonic-gate 	char	pr_cpu;		/* pre-SVR4, cpu usage for scheduling */
252*0Sstevel@tonic-gate 	int	pr_pri;		/* priority, high value is high priority */
253*0Sstevel@tonic-gate 			/* The following percent number is a 16-bit binary */
254*0Sstevel@tonic-gate 			/* fraction [0 .. 1] with the binary point to the */
255*0Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
256*0Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by this lwp */
257*0Sstevel@tonic-gate 	ushort_t pr_pad;
258*0Sstevel@tonic-gate 	timestruc_t pr_start;	/* lwp start time, from the epoch */
259*0Sstevel@tonic-gate 	timestruc_t pr_time;	/* usr+sys cpu time for this lwp */
260*0Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
261*0Sstevel@tonic-gate 	char	pr_name[PRFNSZ];	/* name of system lwp */
262*0Sstevel@tonic-gate 	processorid_t pr_onpro;		/* processor which last ran this lwp */
263*0Sstevel@tonic-gate 	processorid_t pr_bindpro;	/* processor to which lwp is bound */
264*0Sstevel@tonic-gate 	psetid_t pr_bindpset;	/* processor set to which lwp is bound */
265*0Sstevel@tonic-gate 	int	pr_filler[5];	/* reserved for future use */
266*0Sstevel@tonic-gate } lwpsinfo_t;
267*0Sstevel@tonic-gate 
268*0Sstevel@tonic-gate /*
269*0Sstevel@tonic-gate  * process ps(1) information file.  /proc/<pid>/psinfo
270*0Sstevel@tonic-gate  */
271*0Sstevel@tonic-gate #define	PRARGSZ		80	/* number of chars of arguments */
272*0Sstevel@tonic-gate typedef struct psinfo {
273*0Sstevel@tonic-gate 	int	pr_flag;	/* process flags (DEPRECATED; do not use) */
274*0Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
275*0Sstevel@tonic-gate 	pid_t	pr_pid;		/* unique process id */
276*0Sstevel@tonic-gate 	pid_t	pr_ppid;	/* process id of parent */
277*0Sstevel@tonic-gate 	pid_t	pr_pgid;	/* pid of process group leader */
278*0Sstevel@tonic-gate 	pid_t	pr_sid;		/* session id */
279*0Sstevel@tonic-gate 	uid_t	pr_uid;		/* real user id */
280*0Sstevel@tonic-gate 	uid_t	pr_euid;	/* effective user id */
281*0Sstevel@tonic-gate 	gid_t	pr_gid;		/* real group id */
282*0Sstevel@tonic-gate 	gid_t	pr_egid;	/* effective group id */
283*0Sstevel@tonic-gate 	uintptr_t pr_addr;	/* address of process */
284*0Sstevel@tonic-gate 	size_t	pr_size;	/* size of process image in Kbytes */
285*0Sstevel@tonic-gate 	size_t	pr_rssize;	/* resident set size in Kbytes */
286*0Sstevel@tonic-gate 	size_t	pr_pad1;
287*0Sstevel@tonic-gate 	dev_t	pr_ttydev;	/* controlling tty device (or PRNODEV) */
288*0Sstevel@tonic-gate 			/* The following percent numbers are 16-bit binary */
289*0Sstevel@tonic-gate 			/* fractions [0 .. 1] with the binary point to the */
290*0Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
291*0Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by all lwps */
292*0Sstevel@tonic-gate 	ushort_t pr_pctmem;	/* % of system memory used by process */
293*0Sstevel@tonic-gate 	timestruc_t pr_start;	/* process start time, from the epoch */
294*0Sstevel@tonic-gate 	timestruc_t pr_time;	/* usr+sys cpu time for this process */
295*0Sstevel@tonic-gate 	timestruc_t pr_ctime;	/* usr+sys cpu time for reaped children */
296*0Sstevel@tonic-gate 	char	pr_fname[PRFNSZ];	/* name of execed file */
297*0Sstevel@tonic-gate 	char	pr_psargs[PRARGSZ];	/* initial characters of arg list */
298*0Sstevel@tonic-gate 	int	pr_wstat;	/* if zombie, the wait() status */
299*0Sstevel@tonic-gate 	int	pr_argc;	/* initial argument count */
300*0Sstevel@tonic-gate 	uintptr_t pr_argv;	/* address of initial argument vector */
301*0Sstevel@tonic-gate 	uintptr_t pr_envp;	/* address of initial environment vector */
302*0Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
303*0Sstevel@tonic-gate 	char	pr_pad2[3];
304*0Sstevel@tonic-gate 	taskid_t pr_taskid;	/* task id */
305*0Sstevel@tonic-gate 	projid_t pr_projid;	/* project id */
306*0Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
307*0Sstevel@tonic-gate 	poolid_t pr_poolid;	/* pool id */
308*0Sstevel@tonic-gate 	zoneid_t pr_zoneid;	/* zone id */
309*0Sstevel@tonic-gate 	id_t	pr_contract;	/* process contract */
310*0Sstevel@tonic-gate 	int	pr_filler[1];	/* reserved for future use */
311*0Sstevel@tonic-gate 	lwpsinfo_t pr_lwp;	/* information for representative lwp */
312*0Sstevel@tonic-gate } psinfo_t;
313*0Sstevel@tonic-gate 
314*0Sstevel@tonic-gate #define	PRNODEV	(dev_t)(-1)	/* non-existent device */
315*0Sstevel@tonic-gate 
316*0Sstevel@tonic-gate /*
317*0Sstevel@tonic-gate  * Memory-map interface.  /proc/<pid>/map /proc/<pid>/rmap
318*0Sstevel@tonic-gate  */
319*0Sstevel@tonic-gate #define	PRMAPSZ	64
320*0Sstevel@tonic-gate typedef struct prmap {
321*0Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
322*0Sstevel@tonic-gate 	size_t	pr_size;	/* size of mapping in bytes */
323*0Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
324*0Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
325*0Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
326*0Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
327*0Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
328*0Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
329*0Sstevel@tonic-gate } prmap_t;
330*0Sstevel@tonic-gate 
331*0Sstevel@tonic-gate /*
332*0Sstevel@tonic-gate  * HAT memory-map interface.  /proc/<pid>/xmap
333*0Sstevel@tonic-gate  *
334*0Sstevel@tonic-gate  * The xmap structure is a Sun private interface. The existence, semantics
335*0Sstevel@tonic-gate  * and contents of the xmap structure are subject to arbitrary change.
336*0Sstevel@tonic-gate  */
337*0Sstevel@tonic-gate typedef struct prxmap {
338*0Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
339*0Sstevel@tonic-gate 	size_t	pr_size;	/* size of mapping in bytes */
340*0Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
341*0Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
342*0Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
343*0Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
344*0Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
345*0Sstevel@tonic-gate 	dev_t	pr_dev;	/* st_dev from stat64() of mapped object, or PRNODEV */
346*0Sstevel@tonic-gate 	uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */
347*0Sstevel@tonic-gate 	ulong_t	pr_rss; 	/* pages of resident memory */
348*0Sstevel@tonic-gate 	ulong_t	pr_anon;	/* pages of resident anonymous memory */
349*0Sstevel@tonic-gate 	ulong_t	pr_locked;	/* pages of locked memory */
350*0Sstevel@tonic-gate 	int	pr_hatpagesize;	/* pagesize of the hat mapping */
351*0Sstevel@tonic-gate 	ulong_t	pr_filler[8];	/* filler for future expansion */
352*0Sstevel@tonic-gate } prxmap_t;
353*0Sstevel@tonic-gate 
354*0Sstevel@tonic-gate 
355*0Sstevel@tonic-gate /* Protection and attribute flags */
356*0Sstevel@tonic-gate #define	MA_READ		0x04	/* readable by the traced process */
357*0Sstevel@tonic-gate #define	MA_WRITE	0x02	/* writable by the traced process */
358*0Sstevel@tonic-gate #define	MA_EXEC		0x01	/* executable by the traced process */
359*0Sstevel@tonic-gate #define	MA_SHARED	0x08	/* changes are shared by mapped object */
360*0Sstevel@tonic-gate #define	MA_ANON		0x40	/* anonymous memory (e.g. /dev/zero) */
361*0Sstevel@tonic-gate #define	MA_ISM		0x80	/* intimate shared mem (shared MMU resources) */
362*0Sstevel@tonic-gate #define	MA_NORESERVE	0x100	/* mapped with MAP_NORESERVE */
363*0Sstevel@tonic-gate #define	MA_SHM		0x200	/* System V shared memory */
364*0Sstevel@tonic-gate #define	MA_RESERVED1	0x400	/* reserved for future use */
365*0Sstevel@tonic-gate 
366*0Sstevel@tonic-gate /*
367*0Sstevel@tonic-gate  * These are obsolete and unreliable.
368*0Sstevel@tonic-gate  * They are included here only for historical compatibility.
369*0Sstevel@tonic-gate  */
370*0Sstevel@tonic-gate #define	MA_BREAK	0x10	/* grown by brk(2) */
371*0Sstevel@tonic-gate #define	MA_STACK	0x20	/* grown automatically on stack faults */
372*0Sstevel@tonic-gate 
373*0Sstevel@tonic-gate /*
374*0Sstevel@tonic-gate  * Process credentials.  PCSCRED and /proc/<pid>/cred
375*0Sstevel@tonic-gate  */
376*0Sstevel@tonic-gate typedef struct prcred {
377*0Sstevel@tonic-gate 	uid_t	pr_euid;	/* effective user id */
378*0Sstevel@tonic-gate 	uid_t	pr_ruid;	/* real user id */
379*0Sstevel@tonic-gate 	uid_t	pr_suid;	/* saved user id (from exec) */
380*0Sstevel@tonic-gate 	gid_t	pr_egid;	/* effective group id */
381*0Sstevel@tonic-gate 	gid_t	pr_rgid;	/* real group id */
382*0Sstevel@tonic-gate 	gid_t	pr_sgid;	/* saved group id (from exec) */
383*0Sstevel@tonic-gate 	int	pr_ngroups;	/* number of supplementary groups */
384*0Sstevel@tonic-gate 	gid_t	pr_groups[1];	/* array of supplementary groups */
385*0Sstevel@tonic-gate } prcred_t;
386*0Sstevel@tonic-gate 
387*0Sstevel@tonic-gate /*
388*0Sstevel@tonic-gate  * Process privileges.  PCSPRIV and /proc/<pid>/priv
389*0Sstevel@tonic-gate  */
390*0Sstevel@tonic-gate typedef struct prpriv {
391*0Sstevel@tonic-gate 	uint32_t	pr_nsets;		/* number of privilege set */
392*0Sstevel@tonic-gate 	uint32_t	pr_setsize;		/* size of privilege set */
393*0Sstevel@tonic-gate 	uint32_t	pr_infosize;		/* size of supplementary data */
394*0Sstevel@tonic-gate 	priv_chunk_t	pr_sets[1];		/* array of sets */
395*0Sstevel@tonic-gate } prpriv_t;
396*0Sstevel@tonic-gate 
397*0Sstevel@tonic-gate /*
398*0Sstevel@tonic-gate  * Watchpoint interface.  PCWATCH and /proc/<pid>/watch
399*0Sstevel@tonic-gate  */
400*0Sstevel@tonic-gate typedef struct prwatch {
401*0Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of watched area */
402*0Sstevel@tonic-gate 	size_t	pr_size;	/* size of watched area in bytes */
403*0Sstevel@tonic-gate 	int	pr_wflags;	/* watch type flags */
404*0Sstevel@tonic-gate 	int	pr_pad;
405*0Sstevel@tonic-gate } prwatch_t;
406*0Sstevel@tonic-gate 
407*0Sstevel@tonic-gate /* pr_wflags */
408*0Sstevel@tonic-gate #define	WA_READ		0x04	/* trap on read access */
409*0Sstevel@tonic-gate #define	WA_WRITE	0x02	/* trap on write access */
410*0Sstevel@tonic-gate #define	WA_EXEC		0x01	/* trap on execute access */
411*0Sstevel@tonic-gate #define	WA_TRAPAFTER	0x08	/* trap after instruction completes */
412*0Sstevel@tonic-gate 
413*0Sstevel@tonic-gate /*
414*0Sstevel@tonic-gate  * PCREAD/PCWRITE I/O interface.
415*0Sstevel@tonic-gate  */
416*0Sstevel@tonic-gate typedef struct priovec {
417*0Sstevel@tonic-gate 	void	*pio_base;	/* buffer in controlling process */
418*0Sstevel@tonic-gate 	size_t	pio_len;	/* size of read/write request */
419*0Sstevel@tonic-gate 	off_t	pio_offset;	/* virtual address in target process */
420*0Sstevel@tonic-gate } priovec_t;
421*0Sstevel@tonic-gate 
422*0Sstevel@tonic-gate /*
423*0Sstevel@tonic-gate  * Resource usage.  /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage
424*0Sstevel@tonic-gate  */
425*0Sstevel@tonic-gate typedef struct prusage {
426*0Sstevel@tonic-gate 	id_t		pr_lwpid;	/* lwp id.  0: process or defunct */
427*0Sstevel@tonic-gate 	int		pr_count;	/* number of contributing lwps */
428*0Sstevel@tonic-gate 	timestruc_t	pr_tstamp;	/* current time stamp */
429*0Sstevel@tonic-gate 	timestruc_t	pr_create;	/* process/lwp creation time stamp */
430*0Sstevel@tonic-gate 	timestruc_t	pr_term;	/* process/lwp termination time stamp */
431*0Sstevel@tonic-gate 	timestruc_t	pr_rtime;	/* total lwp real (elapsed) time */
432*0Sstevel@tonic-gate 	timestruc_t	pr_utime;	/* user level cpu time */
433*0Sstevel@tonic-gate 	timestruc_t	pr_stime;	/* system call cpu time */
434*0Sstevel@tonic-gate 	timestruc_t	pr_ttime;	/* other system trap cpu time */
435*0Sstevel@tonic-gate 	timestruc_t	pr_tftime;	/* text page fault sleep time */
436*0Sstevel@tonic-gate 	timestruc_t	pr_dftime;	/* data page fault sleep time */
437*0Sstevel@tonic-gate 	timestruc_t	pr_kftime;	/* kernel page fault sleep time */
438*0Sstevel@tonic-gate 	timestruc_t	pr_ltime;	/* user lock wait sleep time */
439*0Sstevel@tonic-gate 	timestruc_t	pr_slptime;	/* all other sleep time */
440*0Sstevel@tonic-gate 	timestruc_t	pr_wtime;	/* wait-cpu (latency) time */
441*0Sstevel@tonic-gate 	timestruc_t	pr_stoptime;	/* stopped time */
442*0Sstevel@tonic-gate 	timestruc_t	filltime[6];	/* filler for future expansion */
443*0Sstevel@tonic-gate 	ulong_t		pr_minf;	/* minor page faults */
444*0Sstevel@tonic-gate 	ulong_t		pr_majf;	/* major page faults */
445*0Sstevel@tonic-gate 	ulong_t		pr_nswap;	/* swaps */
446*0Sstevel@tonic-gate 	ulong_t		pr_inblk;	/* input blocks */
447*0Sstevel@tonic-gate 	ulong_t		pr_oublk;	/* output blocks */
448*0Sstevel@tonic-gate 	ulong_t		pr_msnd;	/* messages sent */
449*0Sstevel@tonic-gate 	ulong_t		pr_mrcv;	/* messages received */
450*0Sstevel@tonic-gate 	ulong_t		pr_sigs;	/* signals received */
451*0Sstevel@tonic-gate 	ulong_t		pr_vctx;	/* voluntary context switches */
452*0Sstevel@tonic-gate 	ulong_t		pr_ictx;	/* involuntary context switches */
453*0Sstevel@tonic-gate 	ulong_t		pr_sysc;	/* system calls */
454*0Sstevel@tonic-gate 	ulong_t		pr_ioch;	/* chars read and written */
455*0Sstevel@tonic-gate 	ulong_t		filler[10];	/* filler for future expansion */
456*0Sstevel@tonic-gate } prusage_t;
457*0Sstevel@tonic-gate 
458*0Sstevel@tonic-gate /*
459*0Sstevel@tonic-gate  * Page data file.  /proc/<pid>/pagedata
460*0Sstevel@tonic-gate  */
461*0Sstevel@tonic-gate 
462*0Sstevel@tonic-gate /* page data file header */
463*0Sstevel@tonic-gate typedef struct prpageheader {
464*0Sstevel@tonic-gate 	timestruc_t	pr_tstamp;	/* real time stamp */
465*0Sstevel@tonic-gate 	long		pr_nmap;	/* number of address space mappings */
466*0Sstevel@tonic-gate 	long		pr_npage;	/* total number of pages */
467*0Sstevel@tonic-gate } prpageheader_t;
468*0Sstevel@tonic-gate 
469*0Sstevel@tonic-gate /* page data mapping header */
470*0Sstevel@tonic-gate typedef struct prasmap {
471*0Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
472*0Sstevel@tonic-gate 	size_t	pr_npage;	/* number of pages in mapping */
473*0Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
474*0Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
475*0Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
476*0Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
477*0Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
478*0Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
479*0Sstevel@tonic-gate } prasmap_t;
480*0Sstevel@tonic-gate 
481*0Sstevel@tonic-gate /*
482*0Sstevel@tonic-gate  * pr_npage bytes (plus 0-7 null bytes to round up to an 8-byte boundary)
483*0Sstevel@tonic-gate  * follow each mapping header, each containing zero or more of these flags.
484*0Sstevel@tonic-gate  */
485*0Sstevel@tonic-gate #define	PG_REFERENCED	0x02		/* page referenced since last read */
486*0Sstevel@tonic-gate #define	PG_MODIFIED	0x01		/* page modified since last read */
487*0Sstevel@tonic-gate #define	PG_HWMAPPED	0x04		/* page is present and mapped */
488*0Sstevel@tonic-gate 
489*0Sstevel@tonic-gate /*
490*0Sstevel@tonic-gate  * Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
491*0Sstevel@tonic-gate  */
492*0Sstevel@tonic-gate typedef struct prheader {
493*0Sstevel@tonic-gate 	long	pr_nent;	/* number of entries */
494*0Sstevel@tonic-gate 	long	pr_entsize;	/* size of each entry, in bytes */
495*0Sstevel@tonic-gate } prheader_t;
496*0Sstevel@tonic-gate 
497*0Sstevel@tonic-gate /*
498*0Sstevel@tonic-gate  * Macros for manipulating sets of flags.
499*0Sstevel@tonic-gate  * sp must be a pointer to one of sigset_t, fltset_t, or sysset_t.
500*0Sstevel@tonic-gate  * flag must be a member of the enumeration corresponding to *sp.
501*0Sstevel@tonic-gate  */
502*0Sstevel@tonic-gate 
503*0Sstevel@tonic-gate /* turn on all flags in set */
504*0Sstevel@tonic-gate #define	prfillset(sp) \
505*0Sstevel@tonic-gate 	{ register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
506*0Sstevel@tonic-gate 		while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0xFFFFFFFF; }
507*0Sstevel@tonic-gate 
508*0Sstevel@tonic-gate /* turn off all flags in set */
509*0Sstevel@tonic-gate #define	premptyset(sp) \
510*0Sstevel@tonic-gate 	{ register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
511*0Sstevel@tonic-gate 		while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0; }
512*0Sstevel@tonic-gate 
513*0Sstevel@tonic-gate /* turn on specified flag in set */
514*0Sstevel@tonic-gate #define	praddset(sp, flag) \
515*0Sstevel@tonic-gate 	((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
516*0Sstevel@tonic-gate 	(((uint32_t *)(sp))[((flag)-1)/32] |= (1U<<(((flag)-1)%32))) : 0))
517*0Sstevel@tonic-gate 
518*0Sstevel@tonic-gate /* turn off specified flag in set */
519*0Sstevel@tonic-gate #define	prdelset(sp, flag) \
520*0Sstevel@tonic-gate 	((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
521*0Sstevel@tonic-gate 	    (((uint32_t *)(sp))[((flag)-1)/32] &= ~(1U<<(((flag)-1)%32))) : 0))
522*0Sstevel@tonic-gate 
523*0Sstevel@tonic-gate /* query: != 0 iff flag is turned on in set */
524*0Sstevel@tonic-gate #define	prismember(sp, flag) \
525*0Sstevel@tonic-gate 	(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) && \
526*0Sstevel@tonic-gate 	    (((uint32_t *)(sp))[((flag)-1)/32] & (1U<<(((flag)-1)%32))))
527*0Sstevel@tonic-gate 
528*0Sstevel@tonic-gate #if defined(_SYSCALL32)
529*0Sstevel@tonic-gate 
530*0Sstevel@tonic-gate /*
531*0Sstevel@tonic-gate  * dev32_t version of PRNODEV
532*0Sstevel@tonic-gate  */
533*0Sstevel@tonic-gate #define	PRNODEV32 (dev32_t)(-1)
534*0Sstevel@tonic-gate 
535*0Sstevel@tonic-gate /*
536*0Sstevel@tonic-gate  * Kernel view of /proc structures for _ILP32 programs.
537*0Sstevel@tonic-gate  */
538*0Sstevel@tonic-gate 
539*0Sstevel@tonic-gate /*
540*0Sstevel@tonic-gate  * _ILP32 lwp status file.  /proc/<pid>/lwp/<lwpid>/lwpstatus
541*0Sstevel@tonic-gate  */
542*0Sstevel@tonic-gate typedef struct lwpstatus32 {
543*0Sstevel@tonic-gate 	int	pr_flags;	/* flags */
544*0Sstevel@tonic-gate 	id32_t	pr_lwpid;	/* specific lwp identifier */
545*0Sstevel@tonic-gate 	short	pr_why;		/* reason for lwp stop, if stopped */
546*0Sstevel@tonic-gate 	short	pr_what;	/* more detailed reason */
547*0Sstevel@tonic-gate 	short	pr_cursig;	/* current signal, if any */
548*0Sstevel@tonic-gate 	short	pr_pad1;
549*0Sstevel@tonic-gate 	siginfo32_t pr_info;	/* info associated with signal or fault */
550*0Sstevel@tonic-gate 	sigset_t pr_lwppend;	/* set of signals pending to the lwp */
551*0Sstevel@tonic-gate 	sigset_t pr_lwphold;	/* set of signals blocked by the lwp */
552*0Sstevel@tonic-gate 	struct sigaction32 pr_action;	/* signal action for current signal */
553*0Sstevel@tonic-gate 	stack32_t pr_altstack;	/* alternate signal stack info */
554*0Sstevel@tonic-gate 	caddr32_t pr_oldcontext;	/* address of previous ucontext */
555*0Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
556*0Sstevel@tonic-gate 	short	pr_nsysarg;	/* number of arguments to this syscall */
557*0Sstevel@tonic-gate 	int	pr_errno;	/* errno for failed syscall, 0 if successful */
558*0Sstevel@tonic-gate 	int32_t	pr_sysarg[PRSYSARGS];	/* arguments to this syscall */
559*0Sstevel@tonic-gate 	int32_t	pr_rval1;	/* primary syscall return value */
560*0Sstevel@tonic-gate 	int32_t	pr_rval2;	/* second syscall return value, if any */
561*0Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
562*0Sstevel@tonic-gate 	timestruc32_t pr_tstamp;	/* real-time time stamp of stop */
563*0Sstevel@tonic-gate 	timestruc32_t pr_utime;	/* lwp user cpu time */
564*0Sstevel@tonic-gate 	timestruc32_t pr_stime;	/* lwp system cpu time */
565*0Sstevel@tonic-gate 	int	pr_filler[11 - 2 * sizeof (timestruc32_t) / sizeof (int)];
566*0Sstevel@tonic-gate 	int	pr_errpriv;	/* missing privilege */
567*0Sstevel@tonic-gate 	caddr32_t pr_ustack;	/* address of stack boundary data (stack32_t) */
568*0Sstevel@tonic-gate 	uint32_t pr_instr;	/* current instruction */
569*0Sstevel@tonic-gate 	prgregset32_t pr_reg;	/* general registers */
570*0Sstevel@tonic-gate 	prfpregset32_t pr_fpreg; /* floating-point registers */
571*0Sstevel@tonic-gate } lwpstatus32_t;
572*0Sstevel@tonic-gate 
573*0Sstevel@tonic-gate /*
574*0Sstevel@tonic-gate  * _ILP32 process status file.  /proc/<pid>/status
575*0Sstevel@tonic-gate  */
576*0Sstevel@tonic-gate typedef struct pstatus32 {
577*0Sstevel@tonic-gate 	int	pr_flags;	/* flags */
578*0Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
579*0Sstevel@tonic-gate 	pid32_t	pr_pid;		/* process id */
580*0Sstevel@tonic-gate 	pid32_t	pr_ppid;	/* parent process id */
581*0Sstevel@tonic-gate 	pid32_t	pr_pgid;	/* process group id */
582*0Sstevel@tonic-gate 	pid32_t	pr_sid;		/* session id */
583*0Sstevel@tonic-gate 	id32_t	pr_aslwpid;	/* historical; now always zero */
584*0Sstevel@tonic-gate 	id32_t	pr_agentid;	/* lwp id of the /proc agent lwp, if any */
585*0Sstevel@tonic-gate 	sigset_t pr_sigpend;	/* set of process pending signals */
586*0Sstevel@tonic-gate 	caddr32_t pr_brkbase;	/* address of the process heap */
587*0Sstevel@tonic-gate 	size32_t pr_brksize;	/* size of the process heap, in bytes */
588*0Sstevel@tonic-gate 	caddr32_t pr_stkbase;	/* address of the process stack */
589*0Sstevel@tonic-gate 	size32_t pr_stksize;	/* size of the process stack, in bytes */
590*0Sstevel@tonic-gate 	timestruc32_t pr_utime;	/* process user cpu time */
591*0Sstevel@tonic-gate 	timestruc32_t pr_stime;	/* process system cpu time */
592*0Sstevel@tonic-gate 	timestruc32_t pr_cutime;	/* sum of children's user times */
593*0Sstevel@tonic-gate 	timestruc32_t pr_cstime;	/* sum of children's system times */
594*0Sstevel@tonic-gate 	sigset_t pr_sigtrace;	/* set of traced signals */
595*0Sstevel@tonic-gate 	fltset_t pr_flttrace;	/* set of traced faults */
596*0Sstevel@tonic-gate 	sysset_t pr_sysentry;	/* set of system calls traced on entry */
597*0Sstevel@tonic-gate 	sysset_t pr_sysexit;	/* set of system calls traced on exit */
598*0Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
599*0Sstevel@tonic-gate 	char	pr_pad[3];
600*0Sstevel@tonic-gate 	id32_t	pr_taskid;	/* task id */
601*0Sstevel@tonic-gate 	id32_t	pr_projid;	/* project id */
602*0Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
603*0Sstevel@tonic-gate 	id32_t	pr_zoneid;	/* zone id */
604*0Sstevel@tonic-gate 	int	pr_filler[15];	/* reserved for future use */
605*0Sstevel@tonic-gate 	lwpstatus32_t pr_lwp;	/* status of the representative lwp */
606*0Sstevel@tonic-gate } pstatus32_t;
607*0Sstevel@tonic-gate 
608*0Sstevel@tonic-gate /*
609*0Sstevel@tonic-gate  * _ILP32 lwp ps(1) information file.  /proc/<pid>/lwp/<lwpid>/lwpsinfo
610*0Sstevel@tonic-gate  */
611*0Sstevel@tonic-gate typedef struct lwpsinfo32 {
612*0Sstevel@tonic-gate 	int	pr_flag;	/* lwp flags */
613*0Sstevel@tonic-gate 	id32_t	pr_lwpid;	/* lwp id */
614*0Sstevel@tonic-gate 	caddr32_t pr_addr;	/* internal address of lwp */
615*0Sstevel@tonic-gate 	caddr32_t pr_wchan;	/* wait addr for sleeping lwp */
616*0Sstevel@tonic-gate 	char	pr_stype;	/* synchronization event type */
617*0Sstevel@tonic-gate 	char	pr_state;	/* numeric lwp state */
618*0Sstevel@tonic-gate 	char	pr_sname;	/* printable character for pr_state */
619*0Sstevel@tonic-gate 	char	pr_nice;	/* nice for cpu usage */
620*0Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
621*0Sstevel@tonic-gate 	char	pr_oldpri;	/* pre-SVR4, low value is high priority */
622*0Sstevel@tonic-gate 	char	pr_cpu;		/* pre-SVR4, cpu usage for scheduling */
623*0Sstevel@tonic-gate 	int	pr_pri;		/* priority, high value is high priority */
624*0Sstevel@tonic-gate 			/* The following percent number is a 16-bit binary */
625*0Sstevel@tonic-gate 			/* fraction [0 .. 1] with the binary point to the */
626*0Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
627*0Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by this lwp */
628*0Sstevel@tonic-gate 	ushort_t pr_pad;
629*0Sstevel@tonic-gate 	timestruc32_t pr_start;	/* lwp start time, from the epoch */
630*0Sstevel@tonic-gate 	timestruc32_t pr_time;	/* usr+sys cpu time for this lwp */
631*0Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
632*0Sstevel@tonic-gate 	char	pr_name[PRFNSZ];	/* name of system lwp */
633*0Sstevel@tonic-gate 	processorid_t pr_onpro;		/* processor which last ran this lwp */
634*0Sstevel@tonic-gate 	processorid_t pr_bindpro;	/* processor to which lwp is bound */
635*0Sstevel@tonic-gate 	psetid_t pr_bindpset;	/* processor set to which lwp is bound */
636*0Sstevel@tonic-gate 	int	pr_filler[5];	/* reserved for future use */
637*0Sstevel@tonic-gate } lwpsinfo32_t;
638*0Sstevel@tonic-gate 
639*0Sstevel@tonic-gate /*
640*0Sstevel@tonic-gate  * _ILP32 process ps(1) information file.  /proc/<pid>/psinfo
641*0Sstevel@tonic-gate  */
642*0Sstevel@tonic-gate typedef struct psinfo32 {
643*0Sstevel@tonic-gate 	int	pr_flag;	/* process flags */
644*0Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
645*0Sstevel@tonic-gate 	pid32_t	pr_pid;		/* unique process id */
646*0Sstevel@tonic-gate 	pid32_t	pr_ppid;	/* process id of parent */
647*0Sstevel@tonic-gate 	pid32_t	pr_pgid;	/* pid of process group leader */
648*0Sstevel@tonic-gate 	pid32_t	pr_sid;		/* session id */
649*0Sstevel@tonic-gate 	uid32_t	pr_uid;		/* real user id */
650*0Sstevel@tonic-gate 	uid32_t	pr_euid;	/* effective user id */
651*0Sstevel@tonic-gate 	gid32_t	pr_gid;		/* real group id */
652*0Sstevel@tonic-gate 	gid32_t	pr_egid;	/* effective group id */
653*0Sstevel@tonic-gate 	caddr32_t pr_addr;	/* address of process */
654*0Sstevel@tonic-gate 	size32_t pr_size;	/* size of process image in Kbytes */
655*0Sstevel@tonic-gate 	size32_t pr_rssize;	/* resident set size in Kbytes */
656*0Sstevel@tonic-gate 	size32_t pr_pad1;
657*0Sstevel@tonic-gate 	dev32_t	pr_ttydev;	/* controlling tty device (or PRNODEV) */
658*0Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by all lwps */
659*0Sstevel@tonic-gate 	ushort_t pr_pctmem;	/* % of system memory used by process */
660*0Sstevel@tonic-gate 	timestruc32_t pr_start;	/* process start time, from the epoch */
661*0Sstevel@tonic-gate 	timestruc32_t pr_time;	/* usr+sys cpu time for this process */
662*0Sstevel@tonic-gate 	timestruc32_t pr_ctime;	/* usr+sys cpu time for reaped children */
663*0Sstevel@tonic-gate 	char	pr_fname[PRFNSZ];	/* name of execed file */
664*0Sstevel@tonic-gate 	char	pr_psargs[PRARGSZ];	/* initial characters of arg list */
665*0Sstevel@tonic-gate 	int	pr_wstat;	/* if zombie, the wait() status */
666*0Sstevel@tonic-gate 	int	pr_argc;	/* initial argument count */
667*0Sstevel@tonic-gate 	caddr32_t pr_argv;	/* address of initial argument vector */
668*0Sstevel@tonic-gate 	caddr32_t pr_envp;	/* address of initial environment vector */
669*0Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
670*0Sstevel@tonic-gate 	char	pr_pad2[3];
671*0Sstevel@tonic-gate 	id32_t	pr_taskid;	/* task id */
672*0Sstevel@tonic-gate 	id32_t	pr_projid;	/* project id */
673*0Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
674*0Sstevel@tonic-gate 	id32_t	pr_poolid;	/* pool id */
675*0Sstevel@tonic-gate 	id32_t	pr_zoneid;	/* zone id */
676*0Sstevel@tonic-gate 	id32_t	pr_contract;	/* process contract */
677*0Sstevel@tonic-gate 	int	pr_filler[1];	/* reserved for future use */
678*0Sstevel@tonic-gate 	lwpsinfo32_t pr_lwp;	/* information for representative lwp */
679*0Sstevel@tonic-gate } psinfo32_t;
680*0Sstevel@tonic-gate 
681*0Sstevel@tonic-gate /*
682*0Sstevel@tonic-gate  * _ILP32 Memory-management interface.  /proc/<pid>/map /proc/<pid>/rmap
683*0Sstevel@tonic-gate  */
684*0Sstevel@tonic-gate typedef struct prmap32 {
685*0Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
686*0Sstevel@tonic-gate 	size32_t pr_size;	/* size of mapping in bytes */
687*0Sstevel@tonic-gate 	char	pr_mapname[64];	/* name in /proc/<pid>/object */
688*0Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
689*0Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
690*0Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
691*0Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
692*0Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
693*0Sstevel@tonic-gate } prmap32_t;
694*0Sstevel@tonic-gate 
695*0Sstevel@tonic-gate /*
696*0Sstevel@tonic-gate  * _ILP32 HAT memory-map interface.  /proc/<pid>/xmap
697*0Sstevel@tonic-gate  *
698*0Sstevel@tonic-gate  * The xmap structure is a Sun private interface. The existence, semantics
699*0Sstevel@tonic-gate  * and contents of the xmap structure are subject to arbitrary change.
700*0Sstevel@tonic-gate  */
701*0Sstevel@tonic-gate typedef struct prxmap32 {
702*0Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
703*0Sstevel@tonic-gate 	size32_t pr_size;	/* size of mapping in bytes */
704*0Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
705*0Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
706*0Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
707*0Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
708*0Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
709*0Sstevel@tonic-gate 	dev32_t	pr_dev;  /* st_dev from stat64() of mapped object, or PRNODEV */
710*0Sstevel@tonic-gate 	uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */
711*0Sstevel@tonic-gate 	uint32_t pr_rss;	/* pages of resident memory */
712*0Sstevel@tonic-gate 	uint32_t pr_anon;	/* pages of resident anonymous memory */
713*0Sstevel@tonic-gate 	uint32_t pr_locked;	/* pages of locked memory */
714*0Sstevel@tonic-gate 	int	pr_hatpagesize;	/* pagesize of the hat mapping */
715*0Sstevel@tonic-gate 	uint32_t pr_filler[7];	/* filler for future expansion */
716*0Sstevel@tonic-gate } prxmap32_t;
717*0Sstevel@tonic-gate 
718*0Sstevel@tonic-gate /*
719*0Sstevel@tonic-gate  * _ILP32 Process credentials.  PCSCRED and /proc/<pid>/cred
720*0Sstevel@tonic-gate  */
721*0Sstevel@tonic-gate typedef struct prcred32 {
722*0Sstevel@tonic-gate 	uid32_t	pr_euid;	/* effective user id */
723*0Sstevel@tonic-gate 	uid32_t	pr_ruid;	/* real user id */
724*0Sstevel@tonic-gate 	uid32_t	pr_suid;	/* saved user id (from exec) */
725*0Sstevel@tonic-gate 	gid32_t	pr_egid;	/* effective group id */
726*0Sstevel@tonic-gate 	gid32_t	pr_rgid;	/* real group id */
727*0Sstevel@tonic-gate 	gid32_t	pr_sgid;	/* saved group id (from exec) */
728*0Sstevel@tonic-gate 	int	pr_ngroups;	/* number of supplementary groups */
729*0Sstevel@tonic-gate 	gid32_t	pr_groups[1];	/* array of supplementary groups */
730*0Sstevel@tonic-gate } prcred32_t;
731*0Sstevel@tonic-gate 
732*0Sstevel@tonic-gate /*
733*0Sstevel@tonic-gate  * _ILP32 Watchpoint interface.  PCWATCH and /proc/<pid>/watch
734*0Sstevel@tonic-gate  */
735*0Sstevel@tonic-gate typedef struct prwatch32 {
736*0Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of watched area */
737*0Sstevel@tonic-gate 	size32_t pr_size;	/* size of watched area in bytes */
738*0Sstevel@tonic-gate 	int	pr_wflags;	/* watch type flags */
739*0Sstevel@tonic-gate 	int	pr_pad;
740*0Sstevel@tonic-gate } prwatch32_t;
741*0Sstevel@tonic-gate 
742*0Sstevel@tonic-gate /*
743*0Sstevel@tonic-gate  * _ILP32 PCREAD/PCWRITE I/O interface.
744*0Sstevel@tonic-gate  */
745*0Sstevel@tonic-gate typedef struct priovec32 {
746*0Sstevel@tonic-gate 	caddr32_t pio_base;	/* buffer in controlling process */
747*0Sstevel@tonic-gate 	size32_t pio_len;	/* size of read/write request */
748*0Sstevel@tonic-gate 	off32_t	pio_offset;	/* virtual address in target process */
749*0Sstevel@tonic-gate } priovec32_t;
750*0Sstevel@tonic-gate 
751*0Sstevel@tonic-gate /*
752*0Sstevel@tonic-gate  * _ILP32 Resource usage.  /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage
753*0Sstevel@tonic-gate  */
754*0Sstevel@tonic-gate typedef struct prusage32 {
755*0Sstevel@tonic-gate 	id32_t		pr_lwpid;	/* lwp id.  0: process or defunct */
756*0Sstevel@tonic-gate 	int32_t		pr_count;	/* number of contributing lwps */
757*0Sstevel@tonic-gate 	timestruc32_t	pr_tstamp;	/* current time stamp */
758*0Sstevel@tonic-gate 	timestruc32_t	pr_create;	/* process/lwp creation time stamp */
759*0Sstevel@tonic-gate 	timestruc32_t	pr_term;	/* process/lwp termination time stamp */
760*0Sstevel@tonic-gate 	timestruc32_t	pr_rtime;	/* total lwp real (elapsed) time */
761*0Sstevel@tonic-gate 	timestruc32_t	pr_utime;	/* user level cpu time */
762*0Sstevel@tonic-gate 	timestruc32_t	pr_stime;	/* system call cpu time */
763*0Sstevel@tonic-gate 	timestruc32_t	pr_ttime;	/* other system trap cpu time */
764*0Sstevel@tonic-gate 	timestruc32_t	pr_tftime;	/* text page fault sleep time */
765*0Sstevel@tonic-gate 	timestruc32_t	pr_dftime;	/* data page fault sleep time */
766*0Sstevel@tonic-gate 	timestruc32_t	pr_kftime;	/* kernel page fault sleep time */
767*0Sstevel@tonic-gate 	timestruc32_t	pr_ltime;	/* user lock wait sleep time */
768*0Sstevel@tonic-gate 	timestruc32_t	pr_slptime;	/* all other sleep time */
769*0Sstevel@tonic-gate 	timestruc32_t	pr_wtime;	/* wait-cpu (latency) time */
770*0Sstevel@tonic-gate 	timestruc32_t	pr_stoptime;	/* stopped time */
771*0Sstevel@tonic-gate 	timestruc32_t	filltime[6];	/* filler for future expansion */
772*0Sstevel@tonic-gate 	uint32_t	pr_minf;	/* minor page faults */
773*0Sstevel@tonic-gate 	uint32_t	pr_majf;	/* major page faults */
774*0Sstevel@tonic-gate 	uint32_t	pr_nswap;	/* swaps */
775*0Sstevel@tonic-gate 	uint32_t	pr_inblk;	/* input blocks */
776*0Sstevel@tonic-gate 	uint32_t	pr_oublk;	/* output blocks */
777*0Sstevel@tonic-gate 	uint32_t	pr_msnd;	/* messages sent */
778*0Sstevel@tonic-gate 	uint32_t	pr_mrcv;	/* messages received */
779*0Sstevel@tonic-gate 	uint32_t	pr_sigs;	/* signals received */
780*0Sstevel@tonic-gate 	uint32_t	pr_vctx;	/* voluntary context switches */
781*0Sstevel@tonic-gate 	uint32_t	pr_ictx;	/* involuntary context switches */
782*0Sstevel@tonic-gate 	uint32_t	pr_sysc;	/* system calls */
783*0Sstevel@tonic-gate 	uint32_t	pr_ioch;	/* chars read and written */
784*0Sstevel@tonic-gate 	uint32_t	filler[10];	/* filler for future expansion */
785*0Sstevel@tonic-gate } prusage32_t;
786*0Sstevel@tonic-gate 
787*0Sstevel@tonic-gate /*
788*0Sstevel@tonic-gate  * _ILP32 Page data file.  /proc/<pid>/pagedata
789*0Sstevel@tonic-gate  */
790*0Sstevel@tonic-gate 
791*0Sstevel@tonic-gate /* _ILP32 page data file header */
792*0Sstevel@tonic-gate typedef struct prpageheader32 {
793*0Sstevel@tonic-gate 	timestruc32_t	pr_tstamp;	/* real time stamp */
794*0Sstevel@tonic-gate 	int32_t		pr_nmap;	/* number of address space mappings */
795*0Sstevel@tonic-gate 	int32_t		pr_npage;	/* total number of pages */
796*0Sstevel@tonic-gate } prpageheader32_t;
797*0Sstevel@tonic-gate 
798*0Sstevel@tonic-gate /* _ILP32 page data mapping header */
799*0Sstevel@tonic-gate typedef struct prasmap32 {
800*0Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
801*0Sstevel@tonic-gate 	size32_t pr_npage;	/* number of pages in mapping */
802*0Sstevel@tonic-gate 	char	pr_mapname[64];	/* name in /proc/<pid>/object */
803*0Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
804*0Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
805*0Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
806*0Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
807*0Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
808*0Sstevel@tonic-gate } prasmap32_t;
809*0Sstevel@tonic-gate 
810*0Sstevel@tonic-gate /*
811*0Sstevel@tonic-gate  * _ILP32 Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
812*0Sstevel@tonic-gate  */
813*0Sstevel@tonic-gate typedef struct prheader32 {
814*0Sstevel@tonic-gate 	int32_t	pr_nent;	/* number of entries */
815*0Sstevel@tonic-gate 	int32_t	pr_entsize;	/* size of each entry, in bytes */
816*0Sstevel@tonic-gate } prheader32_t;
817*0Sstevel@tonic-gate 
818*0Sstevel@tonic-gate #endif	/* _SYSCALL32 */
819*0Sstevel@tonic-gate 
820*0Sstevel@tonic-gate #endif	/* !_KERNEL && _STRUCTURED_PROC == 0 */
821*0Sstevel@tonic-gate 
822*0Sstevel@tonic-gate #ifdef	__cplusplus
823*0Sstevel@tonic-gate }
824*0Sstevel@tonic-gate #endif
825*0Sstevel@tonic-gate 
826*0Sstevel@tonic-gate #endif	/* _SYS_PROCFS_H */
827