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