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 2009 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28/*	  All Rights Reserved  	*/
29
30#ifndef _SYS_OLD_PROCFS_H
31#define	_SYS_OLD_PROCFS_H
32
33/*
34 * This file contains the definitions for the old ioctl()-based
35 * version of the process file system.  It is obsolete but will
36 * continue to be supported in SunOS until the next major release.
37 */
38
39#include <sys/types.h>
40#include <sys/time_impl.h>
41#include <sys/signal.h>
42#include <sys/siginfo.h>
43#include <sys/fault.h>
44#include <sys/syscall.h>
45#include <sys/procfs_isa.h>
46
47#ifdef	__cplusplus
48extern "C" {
49#endif
50
51#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
52#error	"Cannot use procfs in the large file compilation environment"
53#endif
54
55#if _STRUCTURED_PROC == 0
56
57/*
58 * The old (ioctl-based) and new (structured) /proc interfaces define
59 * related structures of the same name, but slightly diferent contents:
60 *	prmap_t
61 *	prcred_t
62 * This doesn't hurt because you can't include both of these
63 * in the same compilation unit:
64 *	<sys/procfs.h>
65 *	<sys/old_procfs.h>
66 * unless _STRUCTURED_PROC is first defined to be 1.
67 * (Including <procfs.h> defines it to be 1.)
68 *
69 * However, the latest version of lint goes overboard in hunting
70 * down and reporting differences in functions and data of the
71 * same name across multiple compilation units, even though there
72 * is no real problem.  To mitigate this, we redefine the old procfs
73 * names when performing lint.
74 */
75#if defined(__lint)
76#define	prmap		Prmap
77#define	prmap_t		Prmap_t
78#define	prcred		Prcred
79#define	prcred_t	Prcred_t
80#endif	/* __lint */
81
82/*
83 * ioctl codes and system call interfaces for /proc.
84 */
85
86#define	PIOC		('q'<<8)
87#define	PIOCSTATUS	(PIOC|1)	/* get process status */
88#define	PIOCSTOP	(PIOC|2)	/* post STOP request and... */
89#define	PIOCWSTOP	(PIOC|3)	/* wait for process to STOP */
90#define	PIOCRUN		(PIOC|4)	/* make process runnable */
91#define	PIOCGTRACE	(PIOC|5)	/* get traced signal set */
92#define	PIOCSTRACE	(PIOC|6)	/* set traced signal set */
93#define	PIOCSSIG	(PIOC|7)	/* set current signal */
94#define	PIOCKILL	(PIOC|8)	/* send signal */
95#define	PIOCUNKILL	(PIOC|9)	/* delete a signal */
96#define	PIOCGHOLD	(PIOC|10)	/* get held signal set */
97#define	PIOCSHOLD	(PIOC|11)	/* set held signal set */
98#define	PIOCMAXSIG	(PIOC|12)	/* get max signal number */
99#define	PIOCACTION	(PIOC|13)	/* get signal action structs */
100#define	PIOCGFAULT	(PIOC|14)	/* get traced fault set */
101#define	PIOCSFAULT	(PIOC|15)	/* set traced fault set */
102#define	PIOCCFAULT	(PIOC|16)	/* clear current fault */
103#define	PIOCGENTRY	(PIOC|17)	/* get syscall entry set */
104#define	PIOCSENTRY	(PIOC|18)	/* set syscall entry set */
105#define	PIOCGEXIT	(PIOC|19)	/* get syscall exit set */
106#define	PIOCSEXIT	(PIOC|20)	/* set syscall exit set */
107
108/*
109 * These four are obsolete (replaced by PIOCSET/PIOCRESET).
110 */
111#define	PIOCSFORK	(PIOC|21)	/* set inherit-on-fork flag */
112#define	PIOCRFORK	(PIOC|22)	/* reset inherit-on-fork flag */
113#define	PIOCSRLC	(PIOC|23)	/* set run-on-last-close flag */
114#define	PIOCRRLC	(PIOC|24)	/* reset run-on-last-close flag */
115
116#define	PIOCGREG	(PIOC|25)	/* get general registers */
117#define	PIOCSREG	(PIOC|26)	/* set general registers */
118#define	PIOCGFPREG	(PIOC|27)	/* get floating-point registers */
119#define	PIOCSFPREG	(PIOC|28)	/* set floating-point registers */
120#define	PIOCNICE	(PIOC|29)	/* set nice priority */
121#define	PIOCPSINFO	(PIOC|30)	/* get ps(1) information */
122#define	PIOCNMAP	(PIOC|31)	/* get number of memory mappings */
123#define	PIOCMAP		(PIOC|32)	/* get memory map information */
124#define	PIOCOPENM	(PIOC|33)	/* open mapped object for reading */
125#define	PIOCCRED	(PIOC|34)	/* get process credentials */
126#define	PIOCGROUPS	(PIOC|35)	/* get supplementary groups */
127#define	PIOCGETPR	(PIOC|36)	/* read struct proc */
128#define	PIOCGETU	(PIOC|37)	/* read user area */
129
130/*
131 * These are new with SunOS5.0.
132 */
133#define	PIOCSET		(PIOC|38)	/* set process flags */
134#define	PIOCRESET	(PIOC|39)	/* reset process flags */
135#define	PIOCUSAGE	(PIOC|43)	/* get resource usage */
136#define	PIOCOPENPD	(PIOC|44)	/* get page data file descriptor */
137
138/*
139 * Lightweight process interfaces.
140 */
141#define	PIOCLWPIDS	(PIOC|45)	/* get lwp identifiers */
142#define	PIOCOPENLWP	(PIOC|46)	/* get lwp file descriptor */
143#define	PIOCLSTATUS	(PIOC|47)	/* get status of all lwps */
144#define	PIOCLUSAGE	(PIOC|48)	/* get resource usage of all lwps */
145
146/*
147 * SVR4 run-time loader interfaces.
148 */
149#define	PIOCNAUXV	(PIOC|49)	/* get number of aux vector entries */
150#define	PIOCAUXV	(PIOC|50)	/* get aux vector (see sys/auxv.h) */
151
152/*
153 * extra register state interfaces
154 */
155#define	PIOCGXREGSIZE	(PIOC|51)	/* get extra register state size */
156#define	PIOCGXREG	(PIOC|52)	/* get extra register state */
157#define	PIOCSXREG	(PIOC|53)	/* set extra register state */
158
159/*
160 * Intel-specific interfaces.
161 */
162#define	PIOCNLDT	(PIOC|103)	/* get number of LDT entries */
163#define	PIOCLDT		(PIOC|104)	/* get LDT (see sys/sysi86.h) */
164
165/* Process/lwp status structure */
166
167#define	PRCLSZ		8	/* maximum size of scheduling class name */
168#define	PRSYSARGS	8	/* maximum number of syscall arguments */
169
170#endif	/* _STRUCTURED_PROC == 0 */
171
172typedef struct prstatus {
173	int	pr_flags;	/* Flags (see below) */
174	short	pr_why;		/* Reason for process stop (if stopped) */
175	short	pr_what;	/* More detailed reason */
176	siginfo_t pr_info;	/* Info associated with signal or fault */
177	short	pr_cursig;	/* Current signal */
178	ushort_t pr_nlwp;	/* Number of lwps in the process */
179	sigset_t pr_sigpend;	/* Set of signals pending to the process */
180	sigset_t pr_sighold;	/* Set of signals held (blocked) by the lwp */
181	struct	sigaltstack pr_altstack; /* Alternate signal stack info */
182	struct	sigaction pr_action; /* Signal action for current signal */
183	pid_t	pr_pid;		/* Process id */
184	pid_t	pr_ppid;	/* Parent process id */
185	pid_t	pr_pgrp;	/* Process group id */
186	pid_t	pr_sid;		/* Session id */
187	timestruc_t pr_utime;	/* Process user cpu time */
188	timestruc_t pr_stime;	/* Process system cpu time */
189	timestruc_t pr_cutime;	/* Sum of children's user times */
190	timestruc_t pr_cstime;	/* Sum of children's system times */
191	char	pr_clname[PRCLSZ]; /* Scheduling class name */
192	short	pr_syscall;	/* System call number (if in syscall) */
193	short	pr_nsysarg;	/* Number of arguments to this syscall */
194	long	pr_sysarg[PRSYSARGS]; /* Arguments to this syscall */
195	id_t	pr_who;		/* Specific lwp identifier */
196	sigset_t pr_lwppend;	/* Set of signals pending to the lwp */
197	struct ucontext *pr_oldcontext; /* Address of previous ucontext */
198	caddr_t	pr_brkbase;	/* Address of the process heap */
199	size_t	pr_brksize;	/* Size of the process heap, in bytes */
200	caddr_t	pr_stkbase;	/* Address of the process stack */
201	size_t	pr_stksize;	/* Size of the process stack, in bytes */
202	short	pr_processor;	/* processor which last ran this LWP */
203	short	pr_bind;	/* processor LWP bound to or PBIND_NONE */
204	long	pr_instr;	/* Current instruction */
205	prgregset_t pr_reg;	/* General registers */
206} prstatus_t;
207
208#if _STRUCTURED_PROC == 0
209
210/* pr_flags */
211
212#define	PR_STOPPED	0x0001	/* lwp is stopped */
213#define	PR_ISTOP	0x0002	/* lwp is stopped on an event of interest */
214#define	PR_DSTOP	0x0004	/* lwp has a stop directive in effect */
215#define	PR_ASLEEP	0x0008	/* lwp is sleeping in a system call */
216#define	PR_FORK		0x0010	/* inherit-on-fork is in effect */
217#define	PR_RLC		0x0020	/* run-on-last-close is in effect */
218#define	PR_PTRACE	0x0040	/* obsolete, never set in SunOS5.0 */
219#define	PR_PCINVAL	0x0080	/* contents of pr_instr undefined */
220#define	PR_ISSYS	0x0100	/* system process */
221#define	PR_STEP		0x0200	/* lwp has a single-step directive in effect */
222#define	PR_KLC		0x0400	/* kill-on-last-close is in effect */
223#define	PR_ASYNC	0x0800	/* asynchronous-stop is in effect */
224#define	PR_PCOMPAT	0x1000	/* ptrace-compatibility mode is in effect */
225#define	PR_MSACCT	0x2000	/* micro-state usage accounting is in effect */
226#define	PR_BPTADJ	0x4000	/* breakpoint trap pc adjustment is in effect */
227#define	PR_ASLWP	0x8000	/* obsolete flag; never set */
228
229/* Reasons for stopping */
230
231#define	PR_REQUESTED	1
232#define	PR_SIGNALLED	2
233#define	PR_SYSENTRY	3
234#define	PR_SYSEXIT	4
235#define	PR_JOBCONTROL	5
236#define	PR_FAULTED	6
237#define	PR_SUSPENDED	7
238#define	PR_CHECKPOINT	8
239
240/* Information for the ps(1) command */
241
242#define	PRFNSZ		16		/* max size of execed filename */
243#define	PRARGSZ		80		/* Number of chars of arguments */
244
245#endif	/* _STRUCTURED_PROC == 0 */
246
247typedef struct prpsinfo {
248	char	pr_state;	/* numeric process state (see pr_sname) */
249	char	pr_sname;	/* printable character representing pr_state */
250	char	pr_zomb;	/* !=0: process terminated but not waited for */
251	char	pr_nice;	/* nice for cpu usage */
252	uint_t	pr_flag;	/* process flags */
253	uid_t	pr_uid;		/* real user id */
254	gid_t	pr_gid;		/* real group id */
255	pid_t	pr_pid;		/* unique process id */
256	pid_t	pr_ppid;	/* process id of parent */
257	pid_t	pr_pgrp;	/* pid of process group leader */
258	pid_t	pr_sid;		/* session id */
259	caddr_t	pr_addr;	/* physical address of process */
260	size_t	pr_size;	/* size of process image in pages */
261	size_t	pr_rssize;	/* resident set size in pages */
262	caddr_t	pr_wchan;	/* wait addr for sleeping process */
263	timestruc_t pr_start;	/* process start time, sec+nsec since epoch */
264	timestruc_t pr_time;	/* usr+sys cpu time for this process */
265	int	pr_pri;		/* priority, high value is high priority */
266	char	pr_oldpri;	/* pre-SVR4, low value is high priority */
267	char	pr_cpu;		/* pre-SVR4, cpu usage for scheduling */
268	o_dev_t	pr_ottydev;	/* short tty device number */
269	dev_t	pr_lttydev;	/* controlling tty device (PRNODEV if none) */
270	char	pr_clname[PRCLSZ];	/* scheduling class name */
271	char	pr_fname[PRFNSZ];	/* last component of execed pathname */
272	char	pr_psargs[PRARGSZ];	/* initial characters of arg list */
273	short	pr_syscall;	/* system call number (if in syscall) */
274	short	pr_fill;
275	timestruc_t pr_ctime;	/* usr+sys cpu time for reaped children */
276	size_t	pr_bysize;	/* size of process image in bytes */
277	size_t	pr_byrssize;	/* resident set size in bytes */
278	int	pr_argc;	/* initial argument count */
279	char	**pr_argv;	/* initial argument vector */
280	char	**pr_envp;	/* initial environment vector */
281	int	pr_wstat;	/* if zombie, the wait() status */
282			/* The following percent numbers are 16-bit binary */
283			/* fractions [0 .. 1] with the binary point to the */
284			/* right of the high-order bit (one == 0x8000) */
285	ushort_t pr_pctcpu;	/* % of recent cpu time, one or all lwps */
286	ushort_t pr_pctmem;	/* % of of system memory used by the process */
287	uid_t	pr_euid;	/* effective user id */
288	gid_t	pr_egid;	/* effective group id */
289	id_t	pr_aslwpid;	/* historical; now always zero */
290	char	pr_dmodel;	/* data model of the process */
291	char	pr_pad[3];
292	int	pr_filler[6];	/* for future expansion */
293} prpsinfo_t;
294
295#if _STRUCTURED_PROC == 0
296
297#if !defined(_STYPES)
298#define	pr_ttydev	pr_lttydev
299#else
300#define	pr_ttydev	pr_ottydev
301#endif
302
303#define	PRNODEV	(dev_t)(-1l)	/* non-existent device */
304
305/*
306 * See <sys/procfs_isa.h> for possible values of pr_dmodel.
307 */
308
309/* Optional actions to take when process continues */
310
311typedef struct prrun {
312	int	pr_flags;	/* Flags */
313	sigset_t pr_trace;	/* Set of signals to be traced */
314	sigset_t pr_sighold;	/* Set of signals to be held */
315	fltset_t pr_fault;	/* Set of faults to be traced */
316	caddr_t	pr_vaddr;	/* Virtual address at which to resume */
317	int	pr_filler[8];	/* Filler area for future expansion */
318} prrun_t;
319
320#define	PRCSIG		0x001	/* Clear current signal */
321#define	PRCFAULT	0x002	/* Clear current fault */
322#define	PRSTRACE	0x004	/* Use traced-signal set in pr_trace */
323#define	PRSHOLD		0x008	/* Use held-signal set in pr_sighold */
324#define	PRSFAULT	0x010	/* Use traced-fault set in pr_fault */
325#define	PRSVADDR	0x020	/* Resume at virtual address in pr_vaddr */
326#define	PRSTEP		0x040	/* Direct the lwp to single-step */
327#define	PRSABORT	0x080	/* Abort syscall */
328#define	PRSTOP		0x100	/* Set directed stop request */
329
330/* Memory-management interface */
331
332typedef struct prmap {
333	caddr_t		pr_vaddr;	/* Virtual address */
334	size_t		pr_size;	/* Size of mapping in bytes */
335	off_t		pr_off;		/* Offset into mapped object, if any */
336	uint_t		pr_mflags;	/* Protection and attribute flags */
337	uint_t		pr_pagesize;	/* pagesize (bytes) for this mapping */
338	long		pr_filler[3];	/* Filler for future expansion */
339} prmap_t;
340
341/* Protection and attribute flags */
342
343#define	MA_READ		0x04	/* Readable by the traced process */
344#define	MA_WRITE	0x02	/* Writable by the traced process */
345#define	MA_EXEC		0x01	/* Executable by the traced process */
346#define	MA_SHARED	0x08	/* Changes are shared by mapped object */
347/*
348 * These are obsolete and unreliable.
349 * They are included here only for historical compatibility.
350 */
351#define	MA_BREAK	0x10	/* Grown by brk(2) */
352#define	MA_STACK	0x20	/* Grown automatically on stack faults */
353
354/* Process credentials */
355
356typedef struct prcred {
357	uid_t	pr_euid;	/* Effective user id */
358	uid_t	pr_ruid;	/* Real user id */
359	uid_t	pr_suid;	/* Saved user id (from exec) */
360	gid_t	pr_egid;	/* Effective group id */
361	gid_t	pr_rgid;	/* Real group id */
362	gid_t	pr_sgid;	/* Saved group id (from exec) */
363	uint_t	pr_ngroups;	/* Number of supplementary groups */
364} prcred_t;
365
366/* Resource usage */
367
368typedef struct prusage {
369	id_t		pr_lwpid;	/* lwp id.  0: process or defunct */
370	int		pr_count;	/* number of contributing lwps */
371	timestruc_t	pr_tstamp;	/* current time stamp */
372	timestruc_t	pr_create;	/* process/lwp creation time stamp */
373	timestruc_t	pr_term;	/* process/lwp termination time stamp */
374	timestruc_t	pr_rtime;	/* total lwp real (elapsed) time */
375	timestruc_t	pr_utime;	/* user level CPU time */
376	timestruc_t	pr_stime;	/* system call CPU time */
377	timestruc_t	pr_ttime;	/* other system trap CPU time */
378	timestruc_t	pr_tftime;	/* text page fault sleep time */
379	timestruc_t	pr_dftime;	/* data page fault sleep time */
380	timestruc_t	pr_kftime;	/* kernel page fault sleep time */
381	timestruc_t	pr_ltime;	/* user lock wait sleep time */
382	timestruc_t	pr_slptime;	/* all other sleep time */
383	timestruc_t	pr_wtime;	/* wait-cpu (latency) time */
384	timestruc_t	pr_stoptime;	/* stopped time */
385	timestruc_t	filltime[6];	/* filler for future expansion */
386	ulong_t		pr_minf;	/* minor page faults */
387	ulong_t		pr_majf;	/* major page faults */
388	ulong_t		pr_nswap;	/* swaps */
389	ulong_t		pr_inblk;	/* input blocks */
390	ulong_t		pr_oublk;	/* output blocks */
391	ulong_t		pr_msnd;	/* messages sent */
392	ulong_t		pr_mrcv;	/* messages received */
393	ulong_t		pr_sigs;	/* signals received */
394	ulong_t		pr_vctx;	/* voluntary context switches */
395	ulong_t		pr_ictx;	/* involuntary context switches */
396	ulong_t		pr_sysc;	/* system calls */
397	ulong_t		pr_ioch;	/* chars read and written */
398	ulong_t		filler[10];	/* filler for future expansion */
399} prusage_t;
400
401/* Page data */
402
403/* page data file header */
404typedef struct prpageheader {
405	timestruc_t	pr_tstamp;	/* real time stamp */
406	ulong_t		pr_nmap;	/* number of address space mappings */
407	ulong_t		pr_npage;	/* total number of pages */
408} prpageheader_t;
409
410/* page data mapping header */
411typedef struct prasmap {
412	caddr_t		pr_vaddr;	/* virtual address */
413	size_t		pr_npage;	/* number of pages in mapping */
414	off_t		pr_off;		/* offset into mapped object, if any */
415	uint_t		pr_mflags;	/* protection and attribute flags */
416	uint_t		pr_pagesize;	/* pagesize (bytes) for this mapping */
417	long		pr_filler[3];	/* filler for future expansion */
418} prasmap_t;
419
420/*
421 * npage bytes (rounded up to a sizeof (long)-byte boundary) follow
422 * each mapping header, containing zero or more of these flags.
423 */
424#define	PG_REFERENCED	0x02		/* page referenced since last read */
425#define	PG_MODIFIED	0x01		/* page modified since last read */
426#define	PG_HWMAPPED	0x04		/* page is present and mapped */
427
428/*
429 * Macros for manipulating sets of flags.
430 * sp must be a pointer to one of sigset_t, fltset_t, or sysset_t.
431 * flag must be a member of the enumeration corresponding to *sp.
432 */
433
434/* turn on all flags in set */
435#define	prfillset(sp) \
436	{ register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
437		while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0xFFFFFFFF; }
438
439/* turn off all flags in set */
440#define	premptyset(sp) \
441	{ register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
442		while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0; }
443
444/* turn on specified flag in set */
445#define	praddset(sp, flag) \
446	((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
447	(((uint32_t *)(sp))[((flag)-1)/32] |= (1UL<<(((flag)-1)%32))) : 0))
448
449/* turn off specified flag in set */
450#define	prdelset(sp, flag) \
451	((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
452	    (((uint32_t *)(sp))[((flag)-1)/32] &= ~(1UL<<(((flag)-1)%32))) : 0))
453
454/* query: != 0 iff flag is turned on in set */
455#define	prismember(sp, flag) \
456	(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) && \
457	    (((uint32_t *)(sp))[((flag)-1)/32] & (1UL<<(((flag)-1)%32))))
458
459#endif	/* _STRUCTURED_PROC == 0 */
460
461#ifdef _SYSCALL32
462
463#if _STRUCTURED_PROC == 0
464
465/*
466 * dev32_t version of PRNODEV
467 */
468#define	PRNODEV32 (dev32_t)(-1)
469
470/*
471 * Kernel view of structures used by _ILP32 programs.
472 */
473
474#endif	/* _STRUCTURED_PROC == 0 */
475
476typedef struct prstatus32 {
477	int32_t	pr_flags;	/* Flags */
478	short	pr_why;		/* Reason for process stop (if stopped) */
479	short	pr_what;	/* More detailed reason */
480	siginfo32_t pr_info;	/* Info associated with signal or fault */
481	short	pr_cursig;	/* Current signal */
482	ushort_t pr_nlwp;	/* Number of lwps in the process */
483	sigset_t pr_sigpend;	/* Set of signals pending to the process */
484	sigset_t pr_sighold;	/* Set of signals held (blocked) by the lwp */
485	struct	sigaltstack32 pr_altstack; /* Alternate signal stack info */
486	struct	sigaction32 pr_action; /* Signal action for current signal */
487	pid32_t	pr_pid;		/* Process id */
488	pid32_t	pr_ppid;	/* Parent process id */
489	pid32_t	pr_pgrp;	/* Process group id */
490	pid32_t	pr_sid;		/* Session id */
491	timestruc32_t pr_utime;	/* Process user cpu time */
492	timestruc32_t pr_stime;	/* Process system cpu time */
493	timestruc32_t pr_cutime; /* Sum of children's user times */
494	timestruc32_t pr_cstime; /* Sum of children's system times */
495	char	pr_clname[PRCLSZ]; /* Scheduling class name */
496	short	pr_syscall;	/* System call number (if in syscall) */
497	short	pr_nsysarg;	/* Number of arguments to this syscall */
498	int32_t	pr_sysarg[PRSYSARGS]; /* Arguments to this syscall */
499	id32_t	pr_who;		/* Specific lwp identifier */
500	sigset_t pr_lwppend;	/* Set of signals pending to the lwp */
501	caddr32_t pr_oldcontext; /* Address of previous ucontext */
502	caddr32_t pr_brkbase;	/* Address of the process heap */
503	size32_t pr_brksize;	/* Size of the process heap, in bytes */
504	caddr32_t pr_stkbase;	/* Address of the process stack */
505	size32_t pr_stksize;	/* Size of the process stack, in bytes */
506	short	pr_processor;	/* processor which last ran this LWP */
507	short	pr_bind;	/* processor LWP bound to or PBIND_NONE */
508	int32_t	pr_instr;	/* Current instruction */
509	prgregset32_t pr_reg;	/* General registers */
510} prstatus32_t;
511
512typedef struct prpsinfo32 {
513	char	pr_state;	/* numeric process state (see pr_sname) */
514	char	pr_sname;	/* printable character representing pr_state */
515	char	pr_zomb;	/* !=0: process terminated but not waited for */
516	char	pr_nice;	/* nice for cpu usage */
517	uint32_t pr_flag;	/* process flags */
518	uid32_t	pr_uid;		/* real user id */
519	gid32_t	pr_gid;		/* real group id */
520	pid32_t	pr_pid;		/* unique process id */
521	pid32_t	pr_ppid;	/* process id of parent */
522	pid32_t	pr_pgrp;	/* pid of process group leader */
523	pid32_t	pr_sid;		/* session id */
524	caddr32_t pr_addr;	/* physical address of process */
525	size32_t pr_size;	/* size of process image in pages */
526	size32_t pr_rssize;	/* resident set size in pages */
527	caddr32_t pr_wchan;	/* wait addr for sleeping process */
528	timestruc32_t pr_start;	/* process start time, sec+nsec since epoch */
529	timestruc32_t pr_time;	/* usr+sys cpu time for this process */
530	int32_t	pr_pri;		/* priority, high value is high priority */
531	char	pr_oldpri;	/* pre-SVR4, low value is high priority */
532	char	pr_cpu;		/* pre-SVR4, cpu usage for scheduling */
533	o_dev_t	pr_ottydev;	/* short tty device number */
534	dev32_t	pr_lttydev;	/* controlling tty device (PRNODEV if none) */
535	char	pr_clname[PRCLSZ];	/* scheduling class name */
536	char	pr_fname[PRFNSZ];	/* last component of execed pathname */
537	char	pr_psargs[PRARGSZ];	/* initial characters of arg list */
538	short	pr_syscall;	/* system call number (if in syscall) */
539	short	pr_fill;
540	timestruc32_t pr_ctime;	/* usr+sys cpu time for reaped children */
541	size32_t pr_bysize;	/* size of process image in bytes */
542	size32_t pr_byrssize;	/* resident set size in bytes */
543	int	pr_argc;	/* initial argument count */
544	caddr32_t pr_argv;	/* initial argument vector */
545	caddr32_t pr_envp;	/* initial environment vector */
546	int	pr_wstat;	/* if zombie, the wait() status */
547	ushort_t pr_pctcpu;	/* % of recent cpu time, one or all lwps */
548	ushort_t pr_pctmem;	/* % of of system memory used by the process */
549	uid32_t	pr_euid;	/* effective user id */
550	gid32_t	pr_egid;	/* effective group id */
551	id32_t	pr_aslwpid;	/* historical; now always zero */
552	char	pr_dmodel;	/* data model of the process */
553	char	pr_pad[3];
554	int32_t	pr_filler[6];	/* for future expansion */
555} prpsinfo32_t;
556
557#if _STRUCTURED_PROC == 0
558
559typedef struct prrun32 {
560	int32_t	pr_flags;	/* Flags */
561	sigset_t pr_trace;	/* Set of signals to be traced */
562	sigset_t pr_sighold;	/* Set of signals to be held */
563	fltset_t pr_fault;	/* Set of faults to be traced */
564	caddr32_t pr_vaddr;	/* Virtual address at which to resume */
565	int32_t	pr_filler[8];	/* Filler area for future expansion */
566} prrun32_t;
567
568typedef struct ioc_prmap32 {
569	caddr32_t	pr_vaddr;	/* Virtual address */
570	size32_t	pr_size;	/* Size of mapping in bytes */
571	off32_t		pr_off;		/* Offset into mapped object, if any */
572	uint32_t	pr_mflags;	/* Protection and attribute flags */
573	uint32_t	pr_pagesize;	/* pagesize (bytes) for this mapping */
574	int32_t		pr_filler[3];	/* Filler for future expansion */
575} ioc_prmap32_t;
576
577typedef struct prusage32 {
578	id32_t		pr_lwpid;	/* lwp id.  0: process or defunct */
579	int32_t		pr_count;	/* number of contributing lwps */
580	timestruc32_t	pr_tstamp;	/* current time stamp */
581	timestruc32_t	pr_create;	/* process/lwp creation time stamp */
582	timestruc32_t	pr_term;	/* process/lwp termination time stamp */
583	timestruc32_t	pr_rtime;	/* total lwp real (elapsed) time */
584	timestruc32_t	pr_utime;	/* user level cpu time */
585	timestruc32_t	pr_stime;	/* system call cpu time */
586	timestruc32_t	pr_ttime;	/* other system trap cpu time */
587	timestruc32_t	pr_tftime;	/* text page fault sleep time */
588	timestruc32_t	pr_dftime;	/* data page fault sleep time */
589	timestruc32_t	pr_kftime;	/* kernel page fault sleep time */
590	timestruc32_t	pr_ltime;	/* user lock wait sleep time */
591	timestruc32_t	pr_slptime;	/* all other sleep time */
592	timestruc32_t	pr_wtime;	/* wait-cpu (latency) time */
593	timestruc32_t	pr_stoptime;	/* stopped time */
594	timestruc32_t	filltime[6];	/* filler for future expansion */
595	uint32_t	pr_minf;	/* minor page faults */
596	uint32_t	pr_majf;	/* major page faults */
597	uint32_t	pr_nswap;	/* swaps */
598	uint32_t	pr_inblk;	/* input blocks */
599	uint32_t	pr_oublk;	/* output blocks */
600	uint32_t	pr_msnd;	/* messages sent */
601	uint32_t	pr_mrcv;	/* messages received */
602	uint32_t	pr_sigs;	/* signals received */
603	uint32_t	pr_vctx;	/* voluntary context switches */
604	uint32_t	pr_ictx;	/* involuntary context switches */
605	uint32_t	pr_sysc;	/* system calls */
606	uint32_t	pr_ioch;	/* chars read and written */
607	uint32_t	filler[10];	/* filler for future expansion */
608} prusage32_t;
609
610typedef struct ioc_prpageheader32 {
611	timestruc32_t	pr_tstamp;	/* real time stamp */
612	uint32_t	pr_nmap;	/* number of address space mappings */
613	uint32_t	pr_npage;	/* total number of pages */
614} ioc_prpageheader32_t;
615
616typedef struct ioc_prasmap32 {
617	caddr32_t	pr_vaddr;	/* virtual address */
618	size32_t	pr_npage;	/* number of pages in mapping */
619	off32_t		pr_off;		/* offset into mapped object, if any */
620	uint32_t	pr_mflags;	/* protection and attribute flags */
621	uint32_t	pr_pagesize;	/* pagesize (bytes) for this mapping */
622	int32_t		pr_filler[3];	/* filler for future expansion */
623} ioc_prasmap32_t;
624
625#endif	/* _STRUCTURED_PROC == 0 */
626
627#endif	/* _SYSCALL32 */
628
629#ifdef	__cplusplus
630}
631#endif
632
633#endif	/* _SYS_OLD_PROCFS_H */
634