xref: /illumos-gate/usr/src/uts/common/sys/procfs.h (revision 350ffdd5)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5c6402783Sakolb  * Common Development and Distribution License (the "License").
6c6402783Sakolb  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21c6402783Sakolb 
227c478bd9Sstevel@tonic-gate /*
23c6402783Sakolb  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
2634bdffbfSGarrett D'Amore /*
2734bdffbfSGarrett D'Amore  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
28ab618543SJohn Levon  * Copyright 2018 Joyent, Inc.
29a02120c4SAndy Fiddaman  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
3034bdffbfSGarrett D'Amore  */
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifndef _SYS_PROCFS_H
337c478bd9Sstevel@tonic-gate #define	_SYS_PROCFS_H
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
407c478bd9Sstevel@tonic-gate  * This definition is temporary.  Structured proc is the preferred API,
417c478bd9Sstevel@tonic-gate  * and the older ioctl-based interface will be removed in a future version
427c478bd9Sstevel@tonic-gate  * of Solaris.  Until then, by default, including <sys/procfs.h> will
437c478bd9Sstevel@tonic-gate  * provide the older ioctl-based /proc definitions.  To get the structured
447c478bd9Sstevel@tonic-gate  * /proc definitions, either include <procfs.h> or define _STRUCTURED_PROC
457c478bd9Sstevel@tonic-gate  * to be 1 before including <sys/procfs.h>.
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate #ifndef	_STRUCTURED_PROC
487c478bd9Sstevel@tonic-gate #define	_STRUCTURED_PROC	0
497c478bd9Sstevel@tonic-gate #endif
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) && _STRUCTURED_PROC == 0
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate #include <sys/old_procfs.h>
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #else	/* !defined(_KERNEL) && _STRUCTURED_PROC == 0 */
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
587c478bd9Sstevel@tonic-gate #include <sys/types.h>
597c478bd9Sstevel@tonic-gate #include <sys/time_impl.h>
607c478bd9Sstevel@tonic-gate #include <sys/signal.h>
617c478bd9Sstevel@tonic-gate #include <sys/siginfo.h>
627c478bd9Sstevel@tonic-gate #include <sys/fault.h>
637c478bd9Sstevel@tonic-gate #include <sys/syscall.h>
647c478bd9Sstevel@tonic-gate #include <sys/pset.h>
657c478bd9Sstevel@tonic-gate #include <sys/procfs_isa.h>
667c478bd9Sstevel@tonic-gate #include <sys/priv.h>
6734bdffbfSGarrett D'Amore #include <sys/stat.h>
6834bdffbfSGarrett D'Amore #include <sys/param.h>
69d2a70789SRichard Lowe #include <sys/secflags.h>
70ab618543SJohn Levon #include <sys/thread.h>
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate /*
737c478bd9Sstevel@tonic-gate  * System call interfaces for /proc.
747c478bd9Sstevel@tonic-gate  */
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate /*
777c478bd9Sstevel@tonic-gate  * Control codes (long values) for messages written to ctl and lwpctl files.
787c478bd9Sstevel@tonic-gate  */
797c478bd9Sstevel@tonic-gate #define	PCNULL   0L	/* null request, advance to next message */
807c478bd9Sstevel@tonic-gate #define	PCSTOP   1L	/* direct process or lwp to stop and wait for stop */
817c478bd9Sstevel@tonic-gate #define	PCDSTOP  2L	/* direct process or lwp to stop */
827c478bd9Sstevel@tonic-gate #define	PCWSTOP  3L	/* wait for process or lwp to stop, no timeout */
837c478bd9Sstevel@tonic-gate #define	PCTWSTOP 4L	/* wait for stop, with long millisecond timeout arg */
847c478bd9Sstevel@tonic-gate #define	PCRUN    5L	/* make process/lwp runnable, w/ long flags argument */
857c478bd9Sstevel@tonic-gate #define	PCCSIG   6L	/* clear current signal from lwp */
867c478bd9Sstevel@tonic-gate #define	PCCFAULT 7L	/* clear current fault from lwp */
877c478bd9Sstevel@tonic-gate #define	PCSSIG   8L	/* set current signal from siginfo_t argument */
887c478bd9Sstevel@tonic-gate #define	PCKILL   9L	/* post a signal to process/lwp, long argument */
897c478bd9Sstevel@tonic-gate #define	PCUNKILL 10L	/* delete a pending signal from process/lwp, long arg */
907c478bd9Sstevel@tonic-gate #define	PCSHOLD  11L	/* set lwp signal mask from sigset_t argument */
917c478bd9Sstevel@tonic-gate #define	PCSTRACE 12L	/* set traced signal set from sigset_t argument */
927c478bd9Sstevel@tonic-gate #define	PCSFAULT 13L	/* set traced fault set from fltset_t argument */
937c478bd9Sstevel@tonic-gate #define	PCSENTRY 14L	/* set traced syscall entry set from sysset_t arg */
947c478bd9Sstevel@tonic-gate #define	PCSEXIT  15L	/* set traced syscall exit set from sysset_t arg */
957c478bd9Sstevel@tonic-gate #define	PCSET    16L	/* set modes from long argument */
967c478bd9Sstevel@tonic-gate #define	PCUNSET  17L	/* unset modes from long argument */
977c478bd9Sstevel@tonic-gate #define	PCSREG   18L	/* set lwp general registers from prgregset_t arg */
987c478bd9Sstevel@tonic-gate #define	PCSFPREG 19L	/* set lwp floating-point registers from prfpregset_t */
997c478bd9Sstevel@tonic-gate #define	PCSXREG  20L	/* set lwp extra registers from prxregset_t arg */
1007c478bd9Sstevel@tonic-gate #define	PCNICE   21L	/* set nice priority from long argument */
1017c478bd9Sstevel@tonic-gate #define	PCSVADDR 22L	/* set %pc virtual address from long argument */
1027c478bd9Sstevel@tonic-gate #define	PCWATCH  23L	/* set/unset watched memory area from prwatch_t arg */
1037c478bd9Sstevel@tonic-gate #define	PCAGENT  24L	/* create agent lwp with regs from prgregset_t arg */
1047c478bd9Sstevel@tonic-gate #define	PCREAD   25L	/* read from the address space via priovec_t arg */
1057c478bd9Sstevel@tonic-gate #define	PCWRITE  26L	/* write to the address space via priovec_t arg */
1067c478bd9Sstevel@tonic-gate #define	PCSCRED  27L	/* set process credentials from prcred_t argument */
1077c478bd9Sstevel@tonic-gate #define	PCSASRS  28L	/* set ancillary state registers from asrset_t arg */
1087c478bd9Sstevel@tonic-gate #define	PCSPRIV  29L	/* set process privileges from prpriv_t argument */
1097c478bd9Sstevel@tonic-gate #define	PCSZONE  30L	/* set zoneid from zoneid_t argument */
1107c478bd9Sstevel@tonic-gate #define	PCSCREDX 31L	/* as PCSCRED but with supplemental groups */
1117c478bd9Sstevel@tonic-gate /*
1127c478bd9Sstevel@tonic-gate  * PCRUN long operand flags.
1137c478bd9Sstevel@tonic-gate  */
1147c478bd9Sstevel@tonic-gate #define	PRCSIG		0x01	/* clear current signal, if any */
1157c478bd9Sstevel@tonic-gate #define	PRCFAULT	0x02	/* clear current fault, if any */
1167c478bd9Sstevel@tonic-gate #define	PRSTEP		0x04	/* direct the lwp to single-step */
1177c478bd9Sstevel@tonic-gate #define	PRSABORT	0x08	/* abort syscall, if in syscall */
1187c478bd9Sstevel@tonic-gate #define	PRSTOP		0x10	/* set directed stop request */
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate /*
1217c478bd9Sstevel@tonic-gate  * lwp status file.  /proc/<pid>/lwp/<lwpid>/lwpstatus
1227c478bd9Sstevel@tonic-gate  */
1237c478bd9Sstevel@tonic-gate #define	PRCLSZ		8	/* maximum size of scheduling class name */
1247c478bd9Sstevel@tonic-gate #define	PRSYSARGS	8	/* maximum number of syscall arguments */
1257c478bd9Sstevel@tonic-gate typedef struct lwpstatus {
1267c478bd9Sstevel@tonic-gate 	int	pr_flags;	/* flags (see below) */
1277c478bd9Sstevel@tonic-gate 	id_t	pr_lwpid;	/* specific lwp identifier */
1287c478bd9Sstevel@tonic-gate 	short	pr_why;		/* reason for lwp stop, if stopped */
1297c478bd9Sstevel@tonic-gate 	short	pr_what;	/* more detailed reason */
1307c478bd9Sstevel@tonic-gate 	short	pr_cursig;	/* current signal, if any */
1317c478bd9Sstevel@tonic-gate 	short	pr_pad1;
1327c478bd9Sstevel@tonic-gate 	siginfo_t pr_info;	/* info associated with signal or fault */
1337c478bd9Sstevel@tonic-gate 	sigset_t pr_lwppend;	/* set of signals pending to the lwp */
1347c478bd9Sstevel@tonic-gate 	sigset_t pr_lwphold;	/* set of signals blocked by the lwp */
1357c478bd9Sstevel@tonic-gate 	struct sigaction pr_action;	/* signal action for current signal */
1367c478bd9Sstevel@tonic-gate 	stack_t	pr_altstack;	/* alternate signal stack info */
1377c478bd9Sstevel@tonic-gate 	uintptr_t pr_oldcontext;	/* address of previous ucontext */
1387c478bd9Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
1397c478bd9Sstevel@tonic-gate 	short	pr_nsysarg;	/* number of arguments to this syscall */
1407c478bd9Sstevel@tonic-gate 	int	pr_errno;	/* errno for failed syscall, 0 if successful */
1417c478bd9Sstevel@tonic-gate 	long	pr_sysarg[PRSYSARGS];	/* arguments to this syscall */
1427c478bd9Sstevel@tonic-gate 	long	pr_rval1;	/* primary syscall return value */
1437c478bd9Sstevel@tonic-gate 	long	pr_rval2;	/* second syscall return value, if any */
1447c478bd9Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
1457c478bd9Sstevel@tonic-gate 	timestruc_t pr_tstamp;	/* real-time time stamp of stop */
1467c478bd9Sstevel@tonic-gate 	timestruc_t pr_utime;	/* lwp user cpu time */
1477c478bd9Sstevel@tonic-gate 	timestruc_t pr_stime;	/* lwp system cpu time */
1487c478bd9Sstevel@tonic-gate 	int	pr_filler[11 - 2 * sizeof (timestruc_t) / sizeof (int)];
1497c478bd9Sstevel@tonic-gate 	int	pr_errpriv;	/* missing privilege */
1507c478bd9Sstevel@tonic-gate 	uintptr_t pr_ustack;	/* address of stack boundary data (stack_t) */
1517c478bd9Sstevel@tonic-gate 	ulong_t	pr_instr;	/* current instruction */
1527c478bd9Sstevel@tonic-gate 	prgregset_t pr_reg;	/* general registers */
1537c478bd9Sstevel@tonic-gate 	prfpregset_t pr_fpreg;	/* floating-point registers */
1547c478bd9Sstevel@tonic-gate } lwpstatus_t;
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate /*
1577c478bd9Sstevel@tonic-gate  * process status file.  /proc/<pid>/status
1587c478bd9Sstevel@tonic-gate  */
1597c478bd9Sstevel@tonic-gate typedef struct pstatus {
1607c478bd9Sstevel@tonic-gate 	int	pr_flags;	/* flags (see below) */
1617c478bd9Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
1627c478bd9Sstevel@tonic-gate 	pid_t	pr_pid;		/* process id */
1637c478bd9Sstevel@tonic-gate 	pid_t	pr_ppid;	/* parent process id */
1647c478bd9Sstevel@tonic-gate 	pid_t	pr_pgid;	/* process group id */
1657c478bd9Sstevel@tonic-gate 	pid_t	pr_sid;		/* session id */
1667c478bd9Sstevel@tonic-gate 	id_t	pr_aslwpid;	/* historical; now always zero */
1677c478bd9Sstevel@tonic-gate 	id_t	pr_agentid;	/* lwp id of the /proc agent lwp, if any */
1687c478bd9Sstevel@tonic-gate 	sigset_t pr_sigpend;	/* set of process pending signals */
1697c478bd9Sstevel@tonic-gate 	uintptr_t pr_brkbase;	/* address of the process heap */
1707c478bd9Sstevel@tonic-gate 	size_t	pr_brksize;	/* size of the process heap, in bytes */
1717c478bd9Sstevel@tonic-gate 	uintptr_t pr_stkbase;	/* address of the process stack */
1727c478bd9Sstevel@tonic-gate 	size_t	pr_stksize;	/* size of the process stack, in bytes */
1737c478bd9Sstevel@tonic-gate 	timestruc_t pr_utime;	/* process user cpu time */
1747c478bd9Sstevel@tonic-gate 	timestruc_t pr_stime;	/* process system cpu time */
1757c478bd9Sstevel@tonic-gate 	timestruc_t pr_cutime;	/* sum of children's user times */
1767c478bd9Sstevel@tonic-gate 	timestruc_t pr_cstime;	/* sum of children's system times */
1777c478bd9Sstevel@tonic-gate 	sigset_t pr_sigtrace;	/* set of traced signals */
1787c478bd9Sstevel@tonic-gate 	fltset_t pr_flttrace;	/* set of traced faults */
1797c478bd9Sstevel@tonic-gate 	sysset_t pr_sysentry;	/* set of system calls traced on entry */
1807c478bd9Sstevel@tonic-gate 	sysset_t pr_sysexit;	/* set of system calls traced on exit */
1817c478bd9Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process (see below) */
1827c478bd9Sstevel@tonic-gate 	char	pr_pad[3];
1837c478bd9Sstevel@tonic-gate 	taskid_t pr_taskid;	/* task id */
1847c478bd9Sstevel@tonic-gate 	projid_t pr_projid;	/* project id */
1857c478bd9Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
1867c478bd9Sstevel@tonic-gate 	zoneid_t pr_zoneid;	/* zone id */
1877c478bd9Sstevel@tonic-gate 	int	pr_filler[15];	/* reserved for future use */
1887c478bd9Sstevel@tonic-gate 	lwpstatus_t pr_lwp;	/* status of the representative lwp */
1897c478bd9Sstevel@tonic-gate } pstatus_t;
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate /*
1927c478bd9Sstevel@tonic-gate  * pr_flags (same values appear in both pstatus_t and lwpstatus_t pr_flags).
1937c478bd9Sstevel@tonic-gate  *
1947c478bd9Sstevel@tonic-gate  * These flags do *not* apply to psinfo_t.pr_flag or lwpsinfo_t.pr_flag
1957c478bd9Sstevel@tonic-gate  * (which are both deprecated).
1967c478bd9Sstevel@tonic-gate  */
1977c478bd9Sstevel@tonic-gate /* The following flags apply to the specific or representative lwp */
1987c478bd9Sstevel@tonic-gate #define	PR_STOPPED 0x00000001	/* lwp is stopped */
1997c478bd9Sstevel@tonic-gate #define	PR_ISTOP   0x00000002	/* lwp is stopped on an event of interest */
2007c478bd9Sstevel@tonic-gate #define	PR_DSTOP   0x00000004	/* lwp has a stop directive in effect */
2017c478bd9Sstevel@tonic-gate #define	PR_STEP	   0x00000008	/* lwp has a single-step directive in effect */
2027c478bd9Sstevel@tonic-gate #define	PR_ASLEEP  0x00000010	/* lwp is sleeping in a system call */
2037c478bd9Sstevel@tonic-gate #define	PR_PCINVAL 0x00000020	/* contents of pr_instr undefined */
2047c478bd9Sstevel@tonic-gate #define	PR_ASLWP   0x00000040	/* obsolete flag; never set */
2057c478bd9Sstevel@tonic-gate #define	PR_AGENT   0x00000080	/* this lwp is the /proc agent lwp */
2067c478bd9Sstevel@tonic-gate #define	PR_DETACH  0x00000100	/* this is a detached lwp */
2077c478bd9Sstevel@tonic-gate #define	PR_DAEMON  0x00000200	/* this is a daemon lwp */
208657b1f3dSraf #define	PR_IDLE    0x00000400	/* lwp is a cpu's idle thread */
2097c478bd9Sstevel@tonic-gate /* The following flags apply to the process, not to an individual lwp */
2107c478bd9Sstevel@tonic-gate #define	PR_ISSYS   0x00001000	/* this is a system process */
2117c478bd9Sstevel@tonic-gate #define	PR_VFORKP  0x00002000	/* process is the parent of a vfork()d child */
2127c478bd9Sstevel@tonic-gate #define	PR_ORPHAN  0x00004000	/* process's process group is orphaned */
213657b1f3dSraf #define	PR_NOSIGCHLD 0x00008000	/* process will not generate SIGCHLD on exit */
214657b1f3dSraf #define	PR_WAITPID 0x00010000	/* only waitid(P_PID, pid) can reap the child */
2157c478bd9Sstevel@tonic-gate /* The following process flags are modes settable by PCSET/PCUNSET */
2167c478bd9Sstevel@tonic-gate #define	PR_FORK	   0x00100000	/* inherit-on-fork is in effect */
2177c478bd9Sstevel@tonic-gate #define	PR_RLC	   0x00200000	/* run-on-last-close is in effect */
2187c478bd9Sstevel@tonic-gate #define	PR_KLC	   0x00400000	/* kill-on-last-close is in effect */
2197c478bd9Sstevel@tonic-gate #define	PR_ASYNC   0x00800000	/* asynchronous-stop is in effect */
2207c478bd9Sstevel@tonic-gate #define	PR_MSACCT  0x01000000	/* micro-state usage accounting is in effect */
2217c478bd9Sstevel@tonic-gate #define	PR_BPTADJ  0x02000000	/* breakpoint trap pc adjustment is in effect */
2227c478bd9Sstevel@tonic-gate #define	PR_PTRACE  0x04000000	/* ptrace-compatibility mode is in effect */
2237c478bd9Sstevel@tonic-gate #define	PR_MSFORK  0x08000000	/* micro-state accounting inherited on fork */
2247c478bd9Sstevel@tonic-gate 
2257c478bd9Sstevel@tonic-gate /*
2267c478bd9Sstevel@tonic-gate  * See <sys/procfs_isa.h> for possible values of pr_dmodel.
2277c478bd9Sstevel@tonic-gate  */
2287c478bd9Sstevel@tonic-gate 
2297c478bd9Sstevel@tonic-gate /*
2307c478bd9Sstevel@tonic-gate  * Reasons for stopping (pr_why).
2317c478bd9Sstevel@tonic-gate  */
2327c478bd9Sstevel@tonic-gate #define	PR_REQUESTED	1
2337c478bd9Sstevel@tonic-gate #define	PR_SIGNALLED	2
2347c478bd9Sstevel@tonic-gate #define	PR_SYSENTRY	3
2357c478bd9Sstevel@tonic-gate #define	PR_SYSEXIT	4
2367c478bd9Sstevel@tonic-gate #define	PR_JOBCONTROL	5
2377c478bd9Sstevel@tonic-gate #define	PR_FAULTED	6
2387c478bd9Sstevel@tonic-gate #define	PR_SUSPENDED	7
2397c478bd9Sstevel@tonic-gate #define	PR_CHECKPOINT	8
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate /*
2427c478bd9Sstevel@tonic-gate  * lwp ps(1) information file.  /proc/<pid>/lwp/<lwpid>/lwpsinfo
2437c478bd9Sstevel@tonic-gate  */
2447c478bd9Sstevel@tonic-gate #define	PRFNSZ		16	/* Maximum size of execed filename */
2457c478bd9Sstevel@tonic-gate typedef struct lwpsinfo {
2467c478bd9Sstevel@tonic-gate 	int	pr_flag;	/* lwp flags (DEPRECATED; do not use) */
2477c478bd9Sstevel@tonic-gate 	id_t	pr_lwpid;	/* lwp id */
2487c478bd9Sstevel@tonic-gate 	uintptr_t pr_addr;	/* internal address of lwp */
2497c478bd9Sstevel@tonic-gate 	uintptr_t pr_wchan;	/* wait addr for sleeping lwp */
2507c478bd9Sstevel@tonic-gate 	char	pr_stype;	/* synchronization event type */
2517c478bd9Sstevel@tonic-gate 	char	pr_state;	/* numeric lwp state */
2527c478bd9Sstevel@tonic-gate 	char	pr_sname;	/* printable character for pr_state */
2537c478bd9Sstevel@tonic-gate 	char	pr_nice;	/* nice for cpu usage */
2547c478bd9Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
2557c478bd9Sstevel@tonic-gate 	char	pr_oldpri;	/* pre-SVR4, low value is high priority */
2567c478bd9Sstevel@tonic-gate 	char	pr_cpu;		/* pre-SVR4, cpu usage for scheduling */
2577c478bd9Sstevel@tonic-gate 	int	pr_pri;		/* priority, high value is high priority */
2587c478bd9Sstevel@tonic-gate 			/* The following percent number is a 16-bit binary */
2597c478bd9Sstevel@tonic-gate 			/* fraction [0 .. 1] with the binary point to the */
2607c478bd9Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
2617c478bd9Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by this lwp */
2627c478bd9Sstevel@tonic-gate 	ushort_t pr_pad;
2637c478bd9Sstevel@tonic-gate 	timestruc_t pr_start;	/* lwp start time, from the epoch */
2647c478bd9Sstevel@tonic-gate 	timestruc_t pr_time;	/* usr+sys cpu time for this lwp */
2657c478bd9Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
2667c478bd9Sstevel@tonic-gate 	char	pr_name[PRFNSZ];	/* name of system lwp */
2677c478bd9Sstevel@tonic-gate 	processorid_t pr_onpro;		/* processor which last ran this lwp */
2687c478bd9Sstevel@tonic-gate 	processorid_t pr_bindpro;	/* processor to which lwp is bound */
2697c478bd9Sstevel@tonic-gate 	psetid_t pr_bindpset;	/* processor set to which lwp is bound */
270a3c951f0Sakolb 	int	pr_lgrp;	/* lwp home lgroup */
271c6402783Sakolb 	int	pr_filler[4];	/* reserved for future use */
2727c478bd9Sstevel@tonic-gate } lwpsinfo_t;
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate /*
2757c478bd9Sstevel@tonic-gate  * process ps(1) information file.  /proc/<pid>/psinfo
2767c478bd9Sstevel@tonic-gate  */
2777c478bd9Sstevel@tonic-gate #define	PRARGSZ		80	/* number of chars of arguments */
2787c478bd9Sstevel@tonic-gate typedef struct psinfo {
2797c478bd9Sstevel@tonic-gate 	int	pr_flag;	/* process flags (DEPRECATED; do not use) */
2807c478bd9Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
2817c478bd9Sstevel@tonic-gate 	pid_t	pr_pid;		/* unique process id */
2827c478bd9Sstevel@tonic-gate 	pid_t	pr_ppid;	/* process id of parent */
2837c478bd9Sstevel@tonic-gate 	pid_t	pr_pgid;	/* pid of process group leader */
2847c478bd9Sstevel@tonic-gate 	pid_t	pr_sid;		/* session id */
2857c478bd9Sstevel@tonic-gate 	uid_t	pr_uid;		/* real user id */
2867c478bd9Sstevel@tonic-gate 	uid_t	pr_euid;	/* effective user id */
2877c478bd9Sstevel@tonic-gate 	gid_t	pr_gid;		/* real group id */
2887c478bd9Sstevel@tonic-gate 	gid_t	pr_egid;	/* effective group id */
2897c478bd9Sstevel@tonic-gate 	uintptr_t pr_addr;	/* address of process */
2907c478bd9Sstevel@tonic-gate 	size_t	pr_size;	/* size of process image in Kbytes */
2917c478bd9Sstevel@tonic-gate 	size_t	pr_rssize;	/* resident set size in Kbytes */
2927c478bd9Sstevel@tonic-gate 	size_t	pr_pad1;
2937c478bd9Sstevel@tonic-gate 	dev_t	pr_ttydev;	/* controlling tty device (or PRNODEV) */
2947c478bd9Sstevel@tonic-gate 			/* The following percent numbers are 16-bit binary */
2957c478bd9Sstevel@tonic-gate 			/* fractions [0 .. 1] with the binary point to the */
2967c478bd9Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
2977c478bd9Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by all lwps */
2987c478bd9Sstevel@tonic-gate 	ushort_t pr_pctmem;	/* % of system memory used by process */
2997c478bd9Sstevel@tonic-gate 	timestruc_t pr_start;	/* process start time, from the epoch */
3007c478bd9Sstevel@tonic-gate 	timestruc_t pr_time;	/* usr+sys cpu time for this process */
3017c478bd9Sstevel@tonic-gate 	timestruc_t pr_ctime;	/* usr+sys cpu time for reaped children */
3027c478bd9Sstevel@tonic-gate 	char	pr_fname[PRFNSZ];	/* name of execed file */
3037c478bd9Sstevel@tonic-gate 	char	pr_psargs[PRARGSZ];	/* initial characters of arg list */
3047c478bd9Sstevel@tonic-gate 	int	pr_wstat;	/* if zombie, the wait() status */
3057c478bd9Sstevel@tonic-gate 	int	pr_argc;	/* initial argument count */
3067c478bd9Sstevel@tonic-gate 	uintptr_t pr_argv;	/* address of initial argument vector */
3077c478bd9Sstevel@tonic-gate 	uintptr_t pr_envp;	/* address of initial environment vector */
3087c478bd9Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
3097c478bd9Sstevel@tonic-gate 	char	pr_pad2[3];
3107c478bd9Sstevel@tonic-gate 	taskid_t pr_taskid;	/* task id */
3117c478bd9Sstevel@tonic-gate 	projid_t pr_projid;	/* project id */
3127c478bd9Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
3137c478bd9Sstevel@tonic-gate 	poolid_t pr_poolid;	/* pool id */
3147c478bd9Sstevel@tonic-gate 	zoneid_t pr_zoneid;	/* zone id */
3157c478bd9Sstevel@tonic-gate 	id_t	pr_contract;	/* process contract */
3167c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* reserved for future use */
3177c478bd9Sstevel@tonic-gate 	lwpsinfo_t pr_lwp;	/* information for representative lwp */
3187c478bd9Sstevel@tonic-gate } psinfo_t;
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate #define	PRNODEV	(dev_t)(-1)	/* non-existent device */
3217c478bd9Sstevel@tonic-gate 
3227c478bd9Sstevel@tonic-gate /*
3237c478bd9Sstevel@tonic-gate  * Memory-map interface.  /proc/<pid>/map /proc/<pid>/rmap
3247c478bd9Sstevel@tonic-gate  */
3257c478bd9Sstevel@tonic-gate #define	PRMAPSZ	64
3267c478bd9Sstevel@tonic-gate typedef struct prmap {
3277c478bd9Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
3287c478bd9Sstevel@tonic-gate 	size_t	pr_size;	/* size of mapping in bytes */
3297c478bd9Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
3307c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
3317c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
3327c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
3337c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
3347c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
3357c478bd9Sstevel@tonic-gate } prmap_t;
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate /*
3387c478bd9Sstevel@tonic-gate  * HAT memory-map interface.  /proc/<pid>/xmap
3397c478bd9Sstevel@tonic-gate  */
3407c478bd9Sstevel@tonic-gate typedef struct prxmap {
3417c478bd9Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
3427c478bd9Sstevel@tonic-gate 	size_t	pr_size;	/* size of mapping in bytes */
3437c478bd9Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
3447c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
3457c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
3467c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
3477c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
3487c478bd9Sstevel@tonic-gate 	dev_t	pr_dev;	/* st_dev from stat64() of mapped object, or PRNODEV */
3497c478bd9Sstevel@tonic-gate 	uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */
350f4471a27Selowe 	size_t	pr_rss;		/* pages of resident memory */
351f4471a27Selowe 	size_t	pr_anon;	/* pages of resident anonymous memory */
352f4471a27Selowe 	size_t	pr_locked;	/* pages of locked memory */
353f4471a27Selowe 	size_t	pr_pad;		/* currently unused */
354f4471a27Selowe 	uint64_t pr_hatpagesize; /* pagesize of the hat mapping */
355f4471a27Selowe #ifdef	_ILP32
356f4471a27Selowe 	ulong_t	pr_filler[6];	/* filler for future expansion */
357f4471a27Selowe #else
358f4471a27Selowe 	ulong_t pr_filler[7];	/* filler for future expansion */
359f4471a27Selowe #endif
3607c478bd9Sstevel@tonic-gate } prxmap_t;
3617c478bd9Sstevel@tonic-gate 
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate /* Protection and attribute flags */
3647c478bd9Sstevel@tonic-gate #define	MA_READ		0x04	/* readable by the traced process */
3657c478bd9Sstevel@tonic-gate #define	MA_WRITE	0x02	/* writable by the traced process */
3667c478bd9Sstevel@tonic-gate #define	MA_EXEC		0x01	/* executable by the traced process */
3677c478bd9Sstevel@tonic-gate #define	MA_SHARED	0x08	/* changes are shared by mapped object */
3687c478bd9Sstevel@tonic-gate #define	MA_ANON		0x40	/* anonymous memory (e.g. /dev/zero) */
3697c478bd9Sstevel@tonic-gate #define	MA_ISM		0x80	/* intimate shared mem (shared MMU resources) */
3707c478bd9Sstevel@tonic-gate #define	MA_NORESERVE	0x100	/* mapped with MAP_NORESERVE */
3717c478bd9Sstevel@tonic-gate #define	MA_SHM		0x200	/* System V shared memory */
3727c478bd9Sstevel@tonic-gate #define	MA_RESERVED1	0x400	/* reserved for future use */
3737c478bd9Sstevel@tonic-gate 
3747c478bd9Sstevel@tonic-gate /*
3757c478bd9Sstevel@tonic-gate  * These are obsolete and unreliable.
3767c478bd9Sstevel@tonic-gate  * They are included here only for historical compatibility.
3777c478bd9Sstevel@tonic-gate  */
3787c478bd9Sstevel@tonic-gate #define	MA_BREAK	0x10	/* grown by brk(2) */
3797c478bd9Sstevel@tonic-gate #define	MA_STACK	0x20	/* grown automatically on stack faults */
3807c478bd9Sstevel@tonic-gate 
3817c478bd9Sstevel@tonic-gate /*
3827c478bd9Sstevel@tonic-gate  * Process credentials.  PCSCRED and /proc/<pid>/cred
3837c478bd9Sstevel@tonic-gate  */
3847c478bd9Sstevel@tonic-gate typedef struct prcred {
3857c478bd9Sstevel@tonic-gate 	uid_t	pr_euid;	/* effective user id */
3867c478bd9Sstevel@tonic-gate 	uid_t	pr_ruid;	/* real user id */
3877c478bd9Sstevel@tonic-gate 	uid_t	pr_suid;	/* saved user id (from exec) */
3887c478bd9Sstevel@tonic-gate 	gid_t	pr_egid;	/* effective group id */
3897c478bd9Sstevel@tonic-gate 	gid_t	pr_rgid;	/* real group id */
3907c478bd9Sstevel@tonic-gate 	gid_t	pr_sgid;	/* saved group id (from exec) */
3917c478bd9Sstevel@tonic-gate 	int	pr_ngroups;	/* number of supplementary groups */
3927c478bd9Sstevel@tonic-gate 	gid_t	pr_groups[1];	/* array of supplementary groups */
3937c478bd9Sstevel@tonic-gate } prcred_t;
3947c478bd9Sstevel@tonic-gate 
3957c478bd9Sstevel@tonic-gate /*
3967c478bd9Sstevel@tonic-gate  * Process privileges.  PCSPRIV and /proc/<pid>/priv
3977c478bd9Sstevel@tonic-gate  */
3987c478bd9Sstevel@tonic-gate typedef struct prpriv {
3997c478bd9Sstevel@tonic-gate 	uint32_t	pr_nsets;		/* number of privilege set */
4007c478bd9Sstevel@tonic-gate 	uint32_t	pr_setsize;		/* size of privilege set */
4017c478bd9Sstevel@tonic-gate 	uint32_t	pr_infosize;		/* size of supplementary data */
4027c478bd9Sstevel@tonic-gate 	priv_chunk_t	pr_sets[1];		/* array of sets */
4037c478bd9Sstevel@tonic-gate } prpriv_t;
4047c478bd9Sstevel@tonic-gate 
405d2a70789SRichard Lowe #define	PRSECFLAGS_VERSION_1		1
406d2a70789SRichard Lowe #define	PRSECFLAGS_VERSION_CURRENT	PRSECFLAGS_VERSION_1
407d2a70789SRichard Lowe typedef struct prsecflags {
408d2a70789SRichard Lowe 	uint32_t pr_version;
409d2a70789SRichard Lowe 	char pr_pad[4];
410d2a70789SRichard Lowe 	secflagset_t pr_effective;
411d2a70789SRichard Lowe 	secflagset_t pr_inherit;
412d2a70789SRichard Lowe 	secflagset_t pr_lower;
413d2a70789SRichard Lowe 	secflagset_t pr_upper;
414d2a70789SRichard Lowe } prsecflags_t;
415d2a70789SRichard Lowe 
4167c478bd9Sstevel@tonic-gate /*
4177c478bd9Sstevel@tonic-gate  * Watchpoint interface.  PCWATCH and /proc/<pid>/watch
4187c478bd9Sstevel@tonic-gate  */
4197c478bd9Sstevel@tonic-gate typedef struct prwatch {
4207c478bd9Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of watched area */
4217c478bd9Sstevel@tonic-gate 	size_t	pr_size;	/* size of watched area in bytes */
4227c478bd9Sstevel@tonic-gate 	int	pr_wflags;	/* watch type flags */
4237c478bd9Sstevel@tonic-gate 	int	pr_pad;
4247c478bd9Sstevel@tonic-gate } prwatch_t;
4257c478bd9Sstevel@tonic-gate 
4267c478bd9Sstevel@tonic-gate /* pr_wflags */
4277c478bd9Sstevel@tonic-gate #define	WA_READ		0x04	/* trap on read access */
4287c478bd9Sstevel@tonic-gate #define	WA_WRITE	0x02	/* trap on write access */
4297c478bd9Sstevel@tonic-gate #define	WA_EXEC		0x01	/* trap on execute access */
4307c478bd9Sstevel@tonic-gate #define	WA_TRAPAFTER	0x08	/* trap after instruction completes */
4317c478bd9Sstevel@tonic-gate 
4327c478bd9Sstevel@tonic-gate /*
4337c478bd9Sstevel@tonic-gate  * PCREAD/PCWRITE I/O interface.
4347c478bd9Sstevel@tonic-gate  */
4357c478bd9Sstevel@tonic-gate typedef struct priovec {
4367c478bd9Sstevel@tonic-gate 	void	*pio_base;	/* buffer in controlling process */
4377c478bd9Sstevel@tonic-gate 	size_t	pio_len;	/* size of read/write request */
4387c478bd9Sstevel@tonic-gate 	off_t	pio_offset;	/* virtual address in target process */
4397c478bd9Sstevel@tonic-gate } priovec_t;
4407c478bd9Sstevel@tonic-gate 
4417c478bd9Sstevel@tonic-gate /*
4427c478bd9Sstevel@tonic-gate  * Resource usage.  /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage
4437c478bd9Sstevel@tonic-gate  */
4447c478bd9Sstevel@tonic-gate typedef struct prusage {
4457c478bd9Sstevel@tonic-gate 	id_t		pr_lwpid;	/* lwp id.  0: process or defunct */
4467c478bd9Sstevel@tonic-gate 	int		pr_count;	/* number of contributing lwps */
4477c478bd9Sstevel@tonic-gate 	timestruc_t	pr_tstamp;	/* current time stamp */
4487c478bd9Sstevel@tonic-gate 	timestruc_t	pr_create;	/* process/lwp creation time stamp */
4497c478bd9Sstevel@tonic-gate 	timestruc_t	pr_term;	/* process/lwp termination time stamp */
4507c478bd9Sstevel@tonic-gate 	timestruc_t	pr_rtime;	/* total lwp real (elapsed) time */
4517c478bd9Sstevel@tonic-gate 	timestruc_t	pr_utime;	/* user level cpu time */
4527c478bd9Sstevel@tonic-gate 	timestruc_t	pr_stime;	/* system call cpu time */
4537c478bd9Sstevel@tonic-gate 	timestruc_t	pr_ttime;	/* other system trap cpu time */
4547c478bd9Sstevel@tonic-gate 	timestruc_t	pr_tftime;	/* text page fault sleep time */
4557c478bd9Sstevel@tonic-gate 	timestruc_t	pr_dftime;	/* data page fault sleep time */
4567c478bd9Sstevel@tonic-gate 	timestruc_t	pr_kftime;	/* kernel page fault sleep time */
4577c478bd9Sstevel@tonic-gate 	timestruc_t	pr_ltime;	/* user lock wait sleep time */
4587c478bd9Sstevel@tonic-gate 	timestruc_t	pr_slptime;	/* all other sleep time */
4597c478bd9Sstevel@tonic-gate 	timestruc_t	pr_wtime;	/* wait-cpu (latency) time */
4607c478bd9Sstevel@tonic-gate 	timestruc_t	pr_stoptime;	/* stopped time */
4617c478bd9Sstevel@tonic-gate 	timestruc_t	filltime[6];	/* filler for future expansion */
4627c478bd9Sstevel@tonic-gate 	ulong_t		pr_minf;	/* minor page faults */
4637c478bd9Sstevel@tonic-gate 	ulong_t		pr_majf;	/* major page faults */
4647c478bd9Sstevel@tonic-gate 	ulong_t		pr_nswap;	/* swaps */
4657c478bd9Sstevel@tonic-gate 	ulong_t		pr_inblk;	/* input blocks */
4667c478bd9Sstevel@tonic-gate 	ulong_t		pr_oublk;	/* output blocks */
4677c478bd9Sstevel@tonic-gate 	ulong_t		pr_msnd;	/* messages sent */
4687c478bd9Sstevel@tonic-gate 	ulong_t		pr_mrcv;	/* messages received */
4697c478bd9Sstevel@tonic-gate 	ulong_t		pr_sigs;	/* signals received */
4707c478bd9Sstevel@tonic-gate 	ulong_t		pr_vctx;	/* voluntary context switches */
4717c478bd9Sstevel@tonic-gate 	ulong_t		pr_ictx;	/* involuntary context switches */
4727c478bd9Sstevel@tonic-gate 	ulong_t		pr_sysc;	/* system calls */
4737c478bd9Sstevel@tonic-gate 	ulong_t		pr_ioch;	/* chars read and written */
4747c478bd9Sstevel@tonic-gate 	ulong_t		filler[10];	/* filler for future expansion */
4757c478bd9Sstevel@tonic-gate } prusage_t;
4767c478bd9Sstevel@tonic-gate 
4777c478bd9Sstevel@tonic-gate /*
4787c478bd9Sstevel@tonic-gate  * Page data file.  /proc/<pid>/pagedata
4797c478bd9Sstevel@tonic-gate  */
4807c478bd9Sstevel@tonic-gate 
4817c478bd9Sstevel@tonic-gate /* page data file header */
4827c478bd9Sstevel@tonic-gate typedef struct prpageheader {
4837c478bd9Sstevel@tonic-gate 	timestruc_t	pr_tstamp;	/* real time stamp */
4847c478bd9Sstevel@tonic-gate 	long		pr_nmap;	/* number of address space mappings */
4857c478bd9Sstevel@tonic-gate 	long		pr_npage;	/* total number of pages */
4867c478bd9Sstevel@tonic-gate } prpageheader_t;
4877c478bd9Sstevel@tonic-gate 
4887c478bd9Sstevel@tonic-gate /* page data mapping header */
4897c478bd9Sstevel@tonic-gate typedef struct prasmap {
4907c478bd9Sstevel@tonic-gate 	uintptr_t pr_vaddr;	/* virtual address of mapping */
4917c478bd9Sstevel@tonic-gate 	size_t	pr_npage;	/* number of pages in mapping */
4927c478bd9Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
4937c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
4947c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
4957c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
4967c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
4977c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
4987c478bd9Sstevel@tonic-gate } prasmap_t;
4997c478bd9Sstevel@tonic-gate 
5007c478bd9Sstevel@tonic-gate /*
5017c478bd9Sstevel@tonic-gate  * pr_npage bytes (plus 0-7 null bytes to round up to an 8-byte boundary)
5027c478bd9Sstevel@tonic-gate  * follow each mapping header, each containing zero or more of these flags.
5037c478bd9Sstevel@tonic-gate  */
5047c478bd9Sstevel@tonic-gate #define	PG_REFERENCED	0x02		/* page referenced since last read */
5057c478bd9Sstevel@tonic-gate #define	PG_MODIFIED	0x01		/* page modified since last read */
5067c478bd9Sstevel@tonic-gate #define	PG_HWMAPPED	0x04		/* page is present and mapped */
5077c478bd9Sstevel@tonic-gate 
5087c478bd9Sstevel@tonic-gate /*
509a02120c4SAndy Fiddaman  * Open file information; used in core files.  Note that we'd like to use
51034bdffbfSGarrett D'Amore  * the stat or stat64 structure, but both of these structures are unfortunately
51134bdffbfSGarrett D'Amore  * not consistent between 32 and 64 bit modes.  To keep our lives simpler, we
51234bdffbfSGarrett D'Amore  * just define our own structure with types that are not sensitive to this
51334bdffbfSGarrett D'Amore  * difference.  Also, it turns out that pfiles omits a lot of info from the
51434bdffbfSGarrett D'Amore  * struct stat (e.g. times, device sizes, etc.) so we don't bother adding those
51534bdffbfSGarrett D'Amore  * here.
51634bdffbfSGarrett D'Amore  */
517a02120c4SAndy Fiddaman typedef struct prfdinfo_core {
51834bdffbfSGarrett D'Amore 	int		pr_fd;
51934bdffbfSGarrett D'Amore 	mode_t		pr_mode;
52034bdffbfSGarrett D'Amore 
52134bdffbfSGarrett D'Amore 	uid_t		pr_uid;
52234bdffbfSGarrett D'Amore 	gid_t		pr_gid;
52334bdffbfSGarrett D'Amore 
52434bdffbfSGarrett D'Amore 	major_t		pr_major;	/* think stat.st_dev */
52534bdffbfSGarrett D'Amore 	minor_t		pr_minor;
52634bdffbfSGarrett D'Amore 
52734bdffbfSGarrett D'Amore 	major_t		pr_rmajor;	/* think stat.st_rdev */
52834bdffbfSGarrett D'Amore 	minor_t		pr_rminor;
52934bdffbfSGarrett D'Amore 
53034bdffbfSGarrett D'Amore 	ino64_t		pr_ino;
53134bdffbfSGarrett D'Amore 	off64_t		pr_offset;
53234bdffbfSGarrett D'Amore 	off64_t		pr_size;
53334bdffbfSGarrett D'Amore 
53434bdffbfSGarrett D'Amore 	int		pr_fileflags;	/* fcntl(F_GETXFL), etc */
53534bdffbfSGarrett D'Amore 	int		pr_fdflags;	/* fcntl(F_GETFD), etc. */
53634bdffbfSGarrett D'Amore 
53734bdffbfSGarrett D'Amore 	char		pr_path[MAXPATHLEN];
538a02120c4SAndy Fiddaman } prfdinfo_core_t;
539a02120c4SAndy Fiddaman 
540a02120c4SAndy Fiddaman /*
541a02120c4SAndy Fiddaman  * Open file information; used in /proc/<pid>/fdinfo/nn files.
542a02120c4SAndy Fiddaman  * This differs from prfdinfo_core_t above as it exposes more information
543a02120c4SAndy Fiddaman  * and is variable length, with the last element, pr_misc, pointing to an
544a02120c4SAndy Fiddaman  * array of miscellaneous data items.
545a02120c4SAndy Fiddaman  */
546a02120c4SAndy Fiddaman 
547a02120c4SAndy Fiddaman typedef struct prfdinfo {
548a02120c4SAndy Fiddaman 	int		pr_fd;		/* file descriptor number */
549a02120c4SAndy Fiddaman 	mode_t		pr_mode;	/* (see st_mode in stat(2)) */
550a02120c4SAndy Fiddaman 	ino64_t		pr_ino;		/* inode number */
551a02120c4SAndy Fiddaman 	off64_t		pr_size;	/* file size */
552a02120c4SAndy Fiddaman 	off64_t		pr_offset;	/* current offset of file descriptor */
553a02120c4SAndy Fiddaman 	uid_t		pr_uid;		/* owner's user id */
554a02120c4SAndy Fiddaman 	gid_t		pr_gid;		/* owner's group id */
555a02120c4SAndy Fiddaman 	major_t		pr_major;	/* major number of device */
556a02120c4SAndy Fiddaman 	minor_t		pr_minor;	/* minor number of device */
557a02120c4SAndy Fiddaman 	major_t		pr_rmajor;	/* major number (if special file) */
558a02120c4SAndy Fiddaman 	minor_t		pr_rminor;	/* minor number (if special file) */
559a02120c4SAndy Fiddaman 	int		pr_fileflags;	/* (see F_GETXFL in fcntl(2)) */
560a02120c4SAndy Fiddaman 	int		pr_fdflags;	/* (see F_GETFD in fcntl(2)) */
561a02120c4SAndy Fiddaman 	short		pr_locktype;	/* (see F_GETLK in fcntl(2)) */
562a02120c4SAndy Fiddaman 	pid_t		pr_lockpid;	/* process holding file lock */
563a02120c4SAndy Fiddaman 					/* (see F_GETLK) */
564a02120c4SAndy Fiddaman 	int		pr_locksysid;	/* sysid of locking process */
565a02120c4SAndy Fiddaman 					/* (see F_GETLK) */
566a02120c4SAndy Fiddaman 	pid_t		pr_peerpid;	/* peer process (socket, door) */
567a02120c4SAndy Fiddaman 	int		pr_filler[25];	/* reserved for future use */
568a02120c4SAndy Fiddaman 	char		pr_peername[PRFNSZ];	/* peer process name */
569a02120c4SAndy Fiddaman #if	__STDC_VERSION__ >= 199901L
570a02120c4SAndy Fiddaman 	uint8_t		pr_misc[];	/* self describing structures */
571a02120c4SAndy Fiddaman #else
572a02120c4SAndy Fiddaman 	uint8_t		pr_misc[1];	/* self describing structures */
573a02120c4SAndy Fiddaman #endif
57434bdffbfSGarrett D'Amore } prfdinfo_t;
57534bdffbfSGarrett D'Amore 
576a02120c4SAndy Fiddaman /* pr_misc item size is rounded up to maintain alignment */
577a02120c4SAndy Fiddaman #define	PRFDINFO_ROUNDUP(num) P2ROUNDUP((num), 4)
578a02120c4SAndy Fiddaman 
579a02120c4SAndy Fiddaman typedef struct pr_misc_header {
580a02120c4SAndy Fiddaman 	uint_t		pr_misc_size;
581a02120c4SAndy Fiddaman 	uint_t		pr_misc_type;
582a02120c4SAndy Fiddaman } pr_misc_header_t;
583a02120c4SAndy Fiddaman 
584a02120c4SAndy Fiddaman /*
585a02120c4SAndy Fiddaman  * The gaps in this enumeration are present to maintain compatibility with
586a02120c4SAndy Fiddaman  * the values used in Solaris. Any future illumos-specific additions to this
587a02120c4SAndy Fiddaman  * list should use the PR_ILLUMOS_ prefix, be placed after PR_MISC_TYPES_MAX
588a02120c4SAndy Fiddaman  * and start from a number sufficiently large enough to leave space for any
589a02120c4SAndy Fiddaman  * future additions in Solaris.
590a02120c4SAndy Fiddaman  */
591a02120c4SAndy Fiddaman 
592a02120c4SAndy Fiddaman enum PR_MISC_TYPES {
593a02120c4SAndy Fiddaman 	PR_PATHNAME,
594a02120c4SAndy Fiddaman 	PR_SOCKETNAME,
595a02120c4SAndy Fiddaman 	PR_PEERSOCKNAME,
596a02120c4SAndy Fiddaman 	PR_SOCKOPTS_BOOL_OPTS,
597a02120c4SAndy Fiddaman 	PR_SOCKOPT_LINGER,
598a02120c4SAndy Fiddaman 	PR_SOCKOPT_SNDBUF,
599a02120c4SAndy Fiddaman 	PR_SOCKOPT_RCVBUF,
600a02120c4SAndy Fiddaman 	PR_SOCKOPT_IP_NEXTHOP,
601a02120c4SAndy Fiddaman 	PR_SOCKOPT_IPV6_NEXTHOP,
602a02120c4SAndy Fiddaman 	PR_SOCKOPT_TYPE,
603a02120c4SAndy Fiddaman 	PR_SOCKOPT_TCP_CONGESTION = 11,
604a02120c4SAndy Fiddaman 	PR_SOCKFILTERS_PRIV = 14,
605a02120c4SAndy Fiddaman 	PR_MISC_TYPES_MAX
606a02120c4SAndy Fiddaman };
607a02120c4SAndy Fiddaman 
608a02120c4SAndy Fiddaman typedef struct prsockopts_bool_opts {
609a02120c4SAndy Fiddaman 	unsigned int prsock_bool_opts;
610a02120c4SAndy Fiddaman } prsockopts_bool_opts_t;
611a02120c4SAndy Fiddaman 
612a02120c4SAndy Fiddaman #define	PR_SO_DEBUG		(1 << 0)
613a02120c4SAndy Fiddaman #define	PR_SO_REUSEADDR		(1 << 1)
614a02120c4SAndy Fiddaman #define	PR_SO_REUSEPORT		(1 << 2)
615a02120c4SAndy Fiddaman #define	PR_SO_KEEPALIVE		(1 << 3)
616a02120c4SAndy Fiddaman #define	PR_SO_DONTROUTE		(1 << 4)
617a02120c4SAndy Fiddaman #define	PR_SO_BROADCAST		(1 << 5)
618a02120c4SAndy Fiddaman #define	PR_SO_OOBINLINE		(1 << 7)
619a02120c4SAndy Fiddaman #define	PR_SO_DGRAM_ERRIND	(1 << 8)
620a02120c4SAndy Fiddaman #define	PR_SO_ALLZONES		(1 << 9)
621a02120c4SAndy Fiddaman #define	PR_SO_MAC_EXEMPT	(1 << 10)
622a02120c4SAndy Fiddaman #define	PR_SO_EXCLBIND		(1 << 11)
623a02120c4SAndy Fiddaman #define	PR_SO_PASSIVE_CONNECT	(1 << 12)
624a02120c4SAndy Fiddaman #define	PR_SO_ACCEPTCONN	(1 << 13)
625a02120c4SAndy Fiddaman #define	PR_UDP_NAT_T_ENDPOINT	(1 << 14)
626a02120c4SAndy Fiddaman #define	PR_SO_VRRP		(1 << 15)
627a02120c4SAndy Fiddaman #define	PR_SO_MAC_IMPLICIT	(1 << 16)
628a02120c4SAndy Fiddaman 
62934bdffbfSGarrett D'Amore /*
630ab618543SJohn Levon  * Representation of LWP name in core files.  In /proc, we use a simple char
631ab618543SJohn Levon  * array, but in core files we need to make it easy to correlate the note back
632ab618543SJohn Levon  * to the right LWP.  For simplicity, we'll use 32/64 consistent types.
633ab618543SJohn Levon  */
634ab618543SJohn Levon typedef struct prlwpname {
635ab618543SJohn Levon 	uint64_t pr_lwpid;
636ab618543SJohn Levon 	char pr_lwpname[THREAD_NAME_MAX];
637ab618543SJohn Levon } prlwpname_t;
638ab618543SJohn Levon 
639ab618543SJohn Levon /*
6407c478bd9Sstevel@tonic-gate  * Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
6417c478bd9Sstevel@tonic-gate  */
6427c478bd9Sstevel@tonic-gate typedef struct prheader {
6437c478bd9Sstevel@tonic-gate 	long	pr_nent;	/* number of entries */
6447c478bd9Sstevel@tonic-gate 	long	pr_entsize;	/* size of each entry, in bytes */
6457c478bd9Sstevel@tonic-gate } prheader_t;
6467c478bd9Sstevel@tonic-gate 
6477c478bd9Sstevel@tonic-gate /*
6487c478bd9Sstevel@tonic-gate  * Macros for manipulating sets of flags.
6497c478bd9Sstevel@tonic-gate  * sp must be a pointer to one of sigset_t, fltset_t, or sysset_t.
6507c478bd9Sstevel@tonic-gate  * flag must be a member of the enumeration corresponding to *sp.
6517c478bd9Sstevel@tonic-gate  */
6527c478bd9Sstevel@tonic-gate 
6537c478bd9Sstevel@tonic-gate /* turn on all flags in set */
6547c478bd9Sstevel@tonic-gate #define	prfillset(sp) \
6557c478bd9Sstevel@tonic-gate 	{ register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
6567c478bd9Sstevel@tonic-gate 		while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0xFFFFFFFF; }
6577c478bd9Sstevel@tonic-gate 
6587c478bd9Sstevel@tonic-gate /* turn off all flags in set */
6597c478bd9Sstevel@tonic-gate #define	premptyset(sp) \
6607c478bd9Sstevel@tonic-gate 	{ register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
6617c478bd9Sstevel@tonic-gate 		while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0; }
6627c478bd9Sstevel@tonic-gate 
6637c478bd9Sstevel@tonic-gate /* turn on specified flag in set */
6647c478bd9Sstevel@tonic-gate #define	praddset(sp, flag) \
6657c478bd9Sstevel@tonic-gate 	((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
6667c478bd9Sstevel@tonic-gate 	(((uint32_t *)(sp))[((flag)-1)/32] |= (1U<<(((flag)-1)%32))) : 0))
6677c478bd9Sstevel@tonic-gate 
6687c478bd9Sstevel@tonic-gate /* turn off specified flag in set */
6697c478bd9Sstevel@tonic-gate #define	prdelset(sp, flag) \
6707c478bd9Sstevel@tonic-gate 	((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
6717c478bd9Sstevel@tonic-gate 	    (((uint32_t *)(sp))[((flag)-1)/32] &= ~(1U<<(((flag)-1)%32))) : 0))
6727c478bd9Sstevel@tonic-gate 
6737c478bd9Sstevel@tonic-gate /* query: != 0 iff flag is turned on in set */
6747c478bd9Sstevel@tonic-gate #define	prismember(sp, flag) \
6757c478bd9Sstevel@tonic-gate 	(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) && \
6767c478bd9Sstevel@tonic-gate 	    (((uint32_t *)(sp))[((flag)-1)/32] & (1U<<(((flag)-1)%32))))
6777c478bd9Sstevel@tonic-gate 
678*350ffdd5SRobert Mustacchi /*
679*350ffdd5SRobert Mustacchi  * Core file upanic NT_UPANIC structure.
680*350ffdd5SRobert Mustacchi  */
681*350ffdd5SRobert Mustacchi #define	PRUPANIC_VERSION_1		1
682*350ffdd5SRobert Mustacchi #define	PRUPANIC_VERSION_CURRENT	PRUPANIC_VERSION_1
683*350ffdd5SRobert Mustacchi #define	PRUPANIC_FLAG_MSG_VALID	0x01
684*350ffdd5SRobert Mustacchi #define	PRUPANIC_FLAG_MSG_ERROR	0x02
685*350ffdd5SRobert Mustacchi #define	PRUPANIC_FLAG_MSG_TRUNC	0x04
686*350ffdd5SRobert Mustacchi #define	PRUPANIC_BUFLEN		1024
687*350ffdd5SRobert Mustacchi typedef struct prupanic {
688*350ffdd5SRobert Mustacchi 	uint32_t pru_version;
689*350ffdd5SRobert Mustacchi 	uint32_t pru_flags;
690*350ffdd5SRobert Mustacchi 	uint8_t pru_data[PRUPANIC_BUFLEN];
691*350ffdd5SRobert Mustacchi } prupanic_t;
692*350ffdd5SRobert Mustacchi 
6937c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
6947c478bd9Sstevel@tonic-gate 
6957c478bd9Sstevel@tonic-gate /*
6967c478bd9Sstevel@tonic-gate  * dev32_t version of PRNODEV
6977c478bd9Sstevel@tonic-gate  */
6987c478bd9Sstevel@tonic-gate #define	PRNODEV32 (dev32_t)(-1)
6997c478bd9Sstevel@tonic-gate 
7007c478bd9Sstevel@tonic-gate /*
7017c478bd9Sstevel@tonic-gate  * Kernel view of /proc structures for _ILP32 programs.
7027c478bd9Sstevel@tonic-gate  */
7037c478bd9Sstevel@tonic-gate 
7047c478bd9Sstevel@tonic-gate /*
7057c478bd9Sstevel@tonic-gate  * _ILP32 lwp status file.  /proc/<pid>/lwp/<lwpid>/lwpstatus
7067c478bd9Sstevel@tonic-gate  */
7077c478bd9Sstevel@tonic-gate typedef struct lwpstatus32 {
7087c478bd9Sstevel@tonic-gate 	int	pr_flags;	/* flags */
7097c478bd9Sstevel@tonic-gate 	id32_t	pr_lwpid;	/* specific lwp identifier */
7107c478bd9Sstevel@tonic-gate 	short	pr_why;		/* reason for lwp stop, if stopped */
7117c478bd9Sstevel@tonic-gate 	short	pr_what;	/* more detailed reason */
7127c478bd9Sstevel@tonic-gate 	short	pr_cursig;	/* current signal, if any */
7137c478bd9Sstevel@tonic-gate 	short	pr_pad1;
7147c478bd9Sstevel@tonic-gate 	siginfo32_t pr_info;	/* info associated with signal or fault */
7157c478bd9Sstevel@tonic-gate 	sigset_t pr_lwppend;	/* set of signals pending to the lwp */
7167c478bd9Sstevel@tonic-gate 	sigset_t pr_lwphold;	/* set of signals blocked by the lwp */
7177c478bd9Sstevel@tonic-gate 	struct sigaction32 pr_action;	/* signal action for current signal */
7187c478bd9Sstevel@tonic-gate 	stack32_t pr_altstack;	/* alternate signal stack info */
7197c478bd9Sstevel@tonic-gate 	caddr32_t pr_oldcontext;	/* address of previous ucontext */
7207c478bd9Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
7217c478bd9Sstevel@tonic-gate 	short	pr_nsysarg;	/* number of arguments to this syscall */
7227c478bd9Sstevel@tonic-gate 	int	pr_errno;	/* errno for failed syscall, 0 if successful */
7237c478bd9Sstevel@tonic-gate 	int32_t	pr_sysarg[PRSYSARGS];	/* arguments to this syscall */
7247c478bd9Sstevel@tonic-gate 	int32_t	pr_rval1;	/* primary syscall return value */
7257c478bd9Sstevel@tonic-gate 	int32_t	pr_rval2;	/* second syscall return value, if any */
7267c478bd9Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
7277c478bd9Sstevel@tonic-gate 	timestruc32_t pr_tstamp;	/* real-time time stamp of stop */
7287c478bd9Sstevel@tonic-gate 	timestruc32_t pr_utime;	/* lwp user cpu time */
7297c478bd9Sstevel@tonic-gate 	timestruc32_t pr_stime;	/* lwp system cpu time */
7307c478bd9Sstevel@tonic-gate 	int	pr_filler[11 - 2 * sizeof (timestruc32_t) / sizeof (int)];
7317c478bd9Sstevel@tonic-gate 	int	pr_errpriv;	/* missing privilege */
7327c478bd9Sstevel@tonic-gate 	caddr32_t pr_ustack;	/* address of stack boundary data (stack32_t) */
7337c478bd9Sstevel@tonic-gate 	uint32_t pr_instr;	/* current instruction */
7347c478bd9Sstevel@tonic-gate 	prgregset32_t pr_reg;	/* general registers */
7357c478bd9Sstevel@tonic-gate 	prfpregset32_t pr_fpreg; /* floating-point registers */
7367c478bd9Sstevel@tonic-gate } lwpstatus32_t;
7377c478bd9Sstevel@tonic-gate 
7387c478bd9Sstevel@tonic-gate /*
7397c478bd9Sstevel@tonic-gate  * _ILP32 process status file.  /proc/<pid>/status
7407c478bd9Sstevel@tonic-gate  */
7417c478bd9Sstevel@tonic-gate typedef struct pstatus32 {
7427c478bd9Sstevel@tonic-gate 	int	pr_flags;	/* flags */
7437c478bd9Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
7447c478bd9Sstevel@tonic-gate 	pid32_t	pr_pid;		/* process id */
7457c478bd9Sstevel@tonic-gate 	pid32_t	pr_ppid;	/* parent process id */
7467c478bd9Sstevel@tonic-gate 	pid32_t	pr_pgid;	/* process group id */
7477c478bd9Sstevel@tonic-gate 	pid32_t	pr_sid;		/* session id */
7487c478bd9Sstevel@tonic-gate 	id32_t	pr_aslwpid;	/* historical; now always zero */
7497c478bd9Sstevel@tonic-gate 	id32_t	pr_agentid;	/* lwp id of the /proc agent lwp, if any */
7507c478bd9Sstevel@tonic-gate 	sigset_t pr_sigpend;	/* set of process pending signals */
7517c478bd9Sstevel@tonic-gate 	caddr32_t pr_brkbase;	/* address of the process heap */
7527c478bd9Sstevel@tonic-gate 	size32_t pr_brksize;	/* size of the process heap, in bytes */
7537c478bd9Sstevel@tonic-gate 	caddr32_t pr_stkbase;	/* address of the process stack */
7547c478bd9Sstevel@tonic-gate 	size32_t pr_stksize;	/* size of the process stack, in bytes */
7557c478bd9Sstevel@tonic-gate 	timestruc32_t pr_utime;	/* process user cpu time */
7567c478bd9Sstevel@tonic-gate 	timestruc32_t pr_stime;	/* process system cpu time */
7577c478bd9Sstevel@tonic-gate 	timestruc32_t pr_cutime;	/* sum of children's user times */
7587c478bd9Sstevel@tonic-gate 	timestruc32_t pr_cstime;	/* sum of children's system times */
7597c478bd9Sstevel@tonic-gate 	sigset_t pr_sigtrace;	/* set of traced signals */
7607c478bd9Sstevel@tonic-gate 	fltset_t pr_flttrace;	/* set of traced faults */
7617c478bd9Sstevel@tonic-gate 	sysset_t pr_sysentry;	/* set of system calls traced on entry */
7627c478bd9Sstevel@tonic-gate 	sysset_t pr_sysexit;	/* set of system calls traced on exit */
7637c478bd9Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
7647c478bd9Sstevel@tonic-gate 	char	pr_pad[3];
7657c478bd9Sstevel@tonic-gate 	id32_t	pr_taskid;	/* task id */
7667c478bd9Sstevel@tonic-gate 	id32_t	pr_projid;	/* project id */
7677c478bd9Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
7687c478bd9Sstevel@tonic-gate 	id32_t	pr_zoneid;	/* zone id */
7697c478bd9Sstevel@tonic-gate 	int	pr_filler[15];	/* reserved for future use */
7707c478bd9Sstevel@tonic-gate 	lwpstatus32_t pr_lwp;	/* status of the representative lwp */
7717c478bd9Sstevel@tonic-gate } pstatus32_t;
7727c478bd9Sstevel@tonic-gate 
7737c478bd9Sstevel@tonic-gate /*
7747c478bd9Sstevel@tonic-gate  * _ILP32 lwp ps(1) information file.  /proc/<pid>/lwp/<lwpid>/lwpsinfo
7757c478bd9Sstevel@tonic-gate  */
7767c478bd9Sstevel@tonic-gate typedef struct lwpsinfo32 {
7777c478bd9Sstevel@tonic-gate 	int	pr_flag;	/* lwp flags */
7787c478bd9Sstevel@tonic-gate 	id32_t	pr_lwpid;	/* lwp id */
7797c478bd9Sstevel@tonic-gate 	caddr32_t pr_addr;	/* internal address of lwp */
7807c478bd9Sstevel@tonic-gate 	caddr32_t pr_wchan;	/* wait addr for sleeping lwp */
7817c478bd9Sstevel@tonic-gate 	char	pr_stype;	/* synchronization event type */
7827c478bd9Sstevel@tonic-gate 	char	pr_state;	/* numeric lwp state */
7837c478bd9Sstevel@tonic-gate 	char	pr_sname;	/* printable character for pr_state */
7847c478bd9Sstevel@tonic-gate 	char	pr_nice;	/* nice for cpu usage */
7857c478bd9Sstevel@tonic-gate 	short	pr_syscall;	/* system call number (if in syscall) */
7867c478bd9Sstevel@tonic-gate 	char	pr_oldpri;	/* pre-SVR4, low value is high priority */
7877c478bd9Sstevel@tonic-gate 	char	pr_cpu;		/* pre-SVR4, cpu usage for scheduling */
7887c478bd9Sstevel@tonic-gate 	int	pr_pri;		/* priority, high value is high priority */
7897c478bd9Sstevel@tonic-gate 			/* The following percent number is a 16-bit binary */
7907c478bd9Sstevel@tonic-gate 			/* fraction [0 .. 1] with the binary point to the */
7917c478bd9Sstevel@tonic-gate 			/* right of the high-order bit (1.0 == 0x8000) */
7927c478bd9Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by this lwp */
7937c478bd9Sstevel@tonic-gate 	ushort_t pr_pad;
7947c478bd9Sstevel@tonic-gate 	timestruc32_t pr_start;	/* lwp start time, from the epoch */
7957c478bd9Sstevel@tonic-gate 	timestruc32_t pr_time;	/* usr+sys cpu time for this lwp */
7967c478bd9Sstevel@tonic-gate 	char	pr_clname[PRCLSZ];	/* scheduling class name */
7977c478bd9Sstevel@tonic-gate 	char	pr_name[PRFNSZ];	/* name of system lwp */
7987c478bd9Sstevel@tonic-gate 	processorid_t pr_onpro;		/* processor which last ran this lwp */
7997c478bd9Sstevel@tonic-gate 	processorid_t pr_bindpro;	/* processor to which lwp is bound */
8007c478bd9Sstevel@tonic-gate 	psetid_t pr_bindpset;	/* processor set to which lwp is bound */
801a3c951f0Sakolb 	int	pr_lgrp;	/* lwp home lgroup */
802c6402783Sakolb 	int	pr_filler[4];	/* reserved for future use */
8037c478bd9Sstevel@tonic-gate } lwpsinfo32_t;
8047c478bd9Sstevel@tonic-gate 
8057c478bd9Sstevel@tonic-gate /*
8067c478bd9Sstevel@tonic-gate  * _ILP32 process ps(1) information file.  /proc/<pid>/psinfo
8077c478bd9Sstevel@tonic-gate  */
8087c478bd9Sstevel@tonic-gate typedef struct psinfo32 {
8097c478bd9Sstevel@tonic-gate 	int	pr_flag;	/* process flags */
8107c478bd9Sstevel@tonic-gate 	int	pr_nlwp;	/* number of active lwps in the process */
8117c478bd9Sstevel@tonic-gate 	pid32_t	pr_pid;		/* unique process id */
8127c478bd9Sstevel@tonic-gate 	pid32_t	pr_ppid;	/* process id of parent */
8137c478bd9Sstevel@tonic-gate 	pid32_t	pr_pgid;	/* pid of process group leader */
8147c478bd9Sstevel@tonic-gate 	pid32_t	pr_sid;		/* session id */
8157c478bd9Sstevel@tonic-gate 	uid32_t	pr_uid;		/* real user id */
8167c478bd9Sstevel@tonic-gate 	uid32_t	pr_euid;	/* effective user id */
8177c478bd9Sstevel@tonic-gate 	gid32_t	pr_gid;		/* real group id */
8187c478bd9Sstevel@tonic-gate 	gid32_t	pr_egid;	/* effective group id */
8197c478bd9Sstevel@tonic-gate 	caddr32_t pr_addr;	/* address of process */
8207c478bd9Sstevel@tonic-gate 	size32_t pr_size;	/* size of process image in Kbytes */
8217c478bd9Sstevel@tonic-gate 	size32_t pr_rssize;	/* resident set size in Kbytes */
8227c478bd9Sstevel@tonic-gate 	size32_t pr_pad1;
8237c478bd9Sstevel@tonic-gate 	dev32_t	pr_ttydev;	/* controlling tty device (or PRNODEV) */
8247c478bd9Sstevel@tonic-gate 	ushort_t pr_pctcpu;	/* % of recent cpu time used by all lwps */
8257c478bd9Sstevel@tonic-gate 	ushort_t pr_pctmem;	/* % of system memory used by process */
8267c478bd9Sstevel@tonic-gate 	timestruc32_t pr_start;	/* process start time, from the epoch */
8277c478bd9Sstevel@tonic-gate 	timestruc32_t pr_time;	/* usr+sys cpu time for this process */
8287c478bd9Sstevel@tonic-gate 	timestruc32_t pr_ctime;	/* usr+sys cpu time for reaped children */
8297c478bd9Sstevel@tonic-gate 	char	pr_fname[PRFNSZ];	/* name of execed file */
8307c478bd9Sstevel@tonic-gate 	char	pr_psargs[PRARGSZ];	/* initial characters of arg list */
8317c478bd9Sstevel@tonic-gate 	int	pr_wstat;	/* if zombie, the wait() status */
8327c478bd9Sstevel@tonic-gate 	int	pr_argc;	/* initial argument count */
8337c478bd9Sstevel@tonic-gate 	caddr32_t pr_argv;	/* address of initial argument vector */
8347c478bd9Sstevel@tonic-gate 	caddr32_t pr_envp;	/* address of initial environment vector */
8357c478bd9Sstevel@tonic-gate 	char	pr_dmodel;	/* data model of the process */
8367c478bd9Sstevel@tonic-gate 	char	pr_pad2[3];
8377c478bd9Sstevel@tonic-gate 	id32_t	pr_taskid;	/* task id */
8387c478bd9Sstevel@tonic-gate 	id32_t	pr_projid;	/* project id */
8397c478bd9Sstevel@tonic-gate 	int	pr_nzomb;	/* number of zombie lwps in the process */
8407c478bd9Sstevel@tonic-gate 	id32_t	pr_poolid;	/* pool id */
8417c478bd9Sstevel@tonic-gate 	id32_t	pr_zoneid;	/* zone id */
8427c478bd9Sstevel@tonic-gate 	id32_t	pr_contract;	/* process contract */
8437c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* reserved for future use */
8447c478bd9Sstevel@tonic-gate 	lwpsinfo32_t pr_lwp;	/* information for representative lwp */
8457c478bd9Sstevel@tonic-gate } psinfo32_t;
8467c478bd9Sstevel@tonic-gate 
8477c478bd9Sstevel@tonic-gate /*
8487c478bd9Sstevel@tonic-gate  * _ILP32 Memory-management interface.  /proc/<pid>/map /proc/<pid>/rmap
8497c478bd9Sstevel@tonic-gate  */
8507c478bd9Sstevel@tonic-gate typedef struct prmap32 {
8517c478bd9Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
8527c478bd9Sstevel@tonic-gate 	size32_t pr_size;	/* size of mapping in bytes */
8537c478bd9Sstevel@tonic-gate 	char	pr_mapname[64];	/* name in /proc/<pid>/object */
8547c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
8557c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
8567c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
8577c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
8587c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
8597c478bd9Sstevel@tonic-gate } prmap32_t;
8607c478bd9Sstevel@tonic-gate 
8617c478bd9Sstevel@tonic-gate /*
8627c478bd9Sstevel@tonic-gate  * _ILP32 HAT memory-map interface.  /proc/<pid>/xmap
8637c478bd9Sstevel@tonic-gate  */
8647c478bd9Sstevel@tonic-gate typedef struct prxmap32 {
8657c478bd9Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
8667c478bd9Sstevel@tonic-gate 	size32_t pr_size;	/* size of mapping in bytes */
8677c478bd9Sstevel@tonic-gate 	char	pr_mapname[PRMAPSZ];	/* name in /proc/<pid>/object */
8687c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
8697c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags (see below) */
8707c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
8717c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
8727c478bd9Sstevel@tonic-gate 	dev32_t	pr_dev;  /* st_dev from stat64() of mapped object, or PRNODEV */
8737c478bd9Sstevel@tonic-gate 	uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */
8747c478bd9Sstevel@tonic-gate 	uint32_t pr_rss;	/* pages of resident memory */
8757c478bd9Sstevel@tonic-gate 	uint32_t pr_anon;	/* pages of resident anonymous memory */
8767c478bd9Sstevel@tonic-gate 	uint32_t pr_locked;	/* pages of locked memory */
877f4471a27Selowe 	uint32_t pr_pad;	/* currently unused */
878f4471a27Selowe 	uint64_t pr_hatpagesize; /* pagesize of the hat mapping */
879f4471a27Selowe 	uint32_t pr_filler[6];	/* filler for future expansion */
8807c478bd9Sstevel@tonic-gate } prxmap32_t;
8817c478bd9Sstevel@tonic-gate 
8827c478bd9Sstevel@tonic-gate /*
8837c478bd9Sstevel@tonic-gate  * _ILP32 Process credentials.  PCSCRED and /proc/<pid>/cred
8847c478bd9Sstevel@tonic-gate  */
8857c478bd9Sstevel@tonic-gate typedef struct prcred32 {
8867c478bd9Sstevel@tonic-gate 	uid32_t	pr_euid;	/* effective user id */
8877c478bd9Sstevel@tonic-gate 	uid32_t	pr_ruid;	/* real user id */
8887c478bd9Sstevel@tonic-gate 	uid32_t	pr_suid;	/* saved user id (from exec) */
8897c478bd9Sstevel@tonic-gate 	gid32_t	pr_egid;	/* effective group id */
8907c478bd9Sstevel@tonic-gate 	gid32_t	pr_rgid;	/* real group id */
8917c478bd9Sstevel@tonic-gate 	gid32_t	pr_sgid;	/* saved group id (from exec) */
8927c478bd9Sstevel@tonic-gate 	int	pr_ngroups;	/* number of supplementary groups */
8937c478bd9Sstevel@tonic-gate 	gid32_t	pr_groups[1];	/* array of supplementary groups */
8947c478bd9Sstevel@tonic-gate } prcred32_t;
8957c478bd9Sstevel@tonic-gate 
8967c478bd9Sstevel@tonic-gate /*
8977c478bd9Sstevel@tonic-gate  * _ILP32 Watchpoint interface.  PCWATCH and /proc/<pid>/watch
8987c478bd9Sstevel@tonic-gate  */
8997c478bd9Sstevel@tonic-gate typedef struct prwatch32 {
9007c478bd9Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of watched area */
9017c478bd9Sstevel@tonic-gate 	size32_t pr_size;	/* size of watched area in bytes */
9027c478bd9Sstevel@tonic-gate 	int	pr_wflags;	/* watch type flags */
9037c478bd9Sstevel@tonic-gate 	int	pr_pad;
9047c478bd9Sstevel@tonic-gate } prwatch32_t;
9057c478bd9Sstevel@tonic-gate 
9067c478bd9Sstevel@tonic-gate /*
9077c478bd9Sstevel@tonic-gate  * _ILP32 PCREAD/PCWRITE I/O interface.
9087c478bd9Sstevel@tonic-gate  */
9097c478bd9Sstevel@tonic-gate typedef struct priovec32 {
9107c478bd9Sstevel@tonic-gate 	caddr32_t pio_base;	/* buffer in controlling process */
9117c478bd9Sstevel@tonic-gate 	size32_t pio_len;	/* size of read/write request */
9127c478bd9Sstevel@tonic-gate 	off32_t	pio_offset;	/* virtual address in target process */
9137c478bd9Sstevel@tonic-gate } priovec32_t;
9147c478bd9Sstevel@tonic-gate 
9157c478bd9Sstevel@tonic-gate /*
9167c478bd9Sstevel@tonic-gate  * _ILP32 Resource usage.  /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage
9177c478bd9Sstevel@tonic-gate  */
9187c478bd9Sstevel@tonic-gate typedef struct prusage32 {
9197c478bd9Sstevel@tonic-gate 	id32_t		pr_lwpid;	/* lwp id.  0: process or defunct */
9207c478bd9Sstevel@tonic-gate 	int32_t		pr_count;	/* number of contributing lwps */
9217c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_tstamp;	/* current time stamp */
9227c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_create;	/* process/lwp creation time stamp */
9237c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_term;	/* process/lwp termination time stamp */
9247c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_rtime;	/* total lwp real (elapsed) time */
9257c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_utime;	/* user level cpu time */
9267c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_stime;	/* system call cpu time */
9277c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_ttime;	/* other system trap cpu time */
9287c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_tftime;	/* text page fault sleep time */
9297c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_dftime;	/* data page fault sleep time */
9307c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_kftime;	/* kernel page fault sleep time */
9317c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_ltime;	/* user lock wait sleep time */
9327c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_slptime;	/* all other sleep time */
9337c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_wtime;	/* wait-cpu (latency) time */
9347c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_stoptime;	/* stopped time */
9357c478bd9Sstevel@tonic-gate 	timestruc32_t	filltime[6];	/* filler for future expansion */
9367c478bd9Sstevel@tonic-gate 	uint32_t	pr_minf;	/* minor page faults */
9377c478bd9Sstevel@tonic-gate 	uint32_t	pr_majf;	/* major page faults */
9387c478bd9Sstevel@tonic-gate 	uint32_t	pr_nswap;	/* swaps */
9397c478bd9Sstevel@tonic-gate 	uint32_t	pr_inblk;	/* input blocks */
9407c478bd9Sstevel@tonic-gate 	uint32_t	pr_oublk;	/* output blocks */
9417c478bd9Sstevel@tonic-gate 	uint32_t	pr_msnd;	/* messages sent */
9427c478bd9Sstevel@tonic-gate 	uint32_t	pr_mrcv;	/* messages received */
9437c478bd9Sstevel@tonic-gate 	uint32_t	pr_sigs;	/* signals received */
9447c478bd9Sstevel@tonic-gate 	uint32_t	pr_vctx;	/* voluntary context switches */
9457c478bd9Sstevel@tonic-gate 	uint32_t	pr_ictx;	/* involuntary context switches */
9467c478bd9Sstevel@tonic-gate 	uint32_t	pr_sysc;	/* system calls */
9477c478bd9Sstevel@tonic-gate 	uint32_t	pr_ioch;	/* chars read and written */
9487c478bd9Sstevel@tonic-gate 	uint32_t	filler[10];	/* filler for future expansion */
9497c478bd9Sstevel@tonic-gate } prusage32_t;
9507c478bd9Sstevel@tonic-gate 
9517c478bd9Sstevel@tonic-gate /*
9527c478bd9Sstevel@tonic-gate  * _ILP32 Page data file.  /proc/<pid>/pagedata
9537c478bd9Sstevel@tonic-gate  */
9547c478bd9Sstevel@tonic-gate 
9557c478bd9Sstevel@tonic-gate /* _ILP32 page data file header */
9567c478bd9Sstevel@tonic-gate typedef struct prpageheader32 {
9577c478bd9Sstevel@tonic-gate 	timestruc32_t	pr_tstamp;	/* real time stamp */
9587c478bd9Sstevel@tonic-gate 	int32_t		pr_nmap;	/* number of address space mappings */
9597c478bd9Sstevel@tonic-gate 	int32_t		pr_npage;	/* total number of pages */
9607c478bd9Sstevel@tonic-gate } prpageheader32_t;
9617c478bd9Sstevel@tonic-gate 
9627c478bd9Sstevel@tonic-gate /* _ILP32 page data mapping header */
9637c478bd9Sstevel@tonic-gate typedef struct prasmap32 {
9647c478bd9Sstevel@tonic-gate 	caddr32_t pr_vaddr;	/* virtual address of mapping */
9657c478bd9Sstevel@tonic-gate 	size32_t pr_npage;	/* number of pages in mapping */
9667c478bd9Sstevel@tonic-gate 	char	pr_mapname[64];	/* name in /proc/<pid>/object */
9677c478bd9Sstevel@tonic-gate 	offset_t pr_offset;	/* offset into mapped object, if any */
9687c478bd9Sstevel@tonic-gate 	int	pr_mflags;	/* protection and attribute flags */
9697c478bd9Sstevel@tonic-gate 	int	pr_pagesize;	/* pagesize (bytes) for this mapping */
9707c478bd9Sstevel@tonic-gate 	int	pr_shmid;	/* SysV shmid, -1 if not SysV shared memory */
9717c478bd9Sstevel@tonic-gate 	int	pr_filler[1];	/* filler for future expansion */
9727c478bd9Sstevel@tonic-gate } prasmap32_t;
9737c478bd9Sstevel@tonic-gate 
9747c478bd9Sstevel@tonic-gate /*
9757c478bd9Sstevel@tonic-gate  * _ILP32 Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
9767c478bd9Sstevel@tonic-gate  */
9777c478bd9Sstevel@tonic-gate typedef struct prheader32 {
9787c478bd9Sstevel@tonic-gate 	int32_t	pr_nent;	/* number of entries */
9797c478bd9Sstevel@tonic-gate 	int32_t	pr_entsize;	/* size of each entry, in bytes */
9807c478bd9Sstevel@tonic-gate } prheader32_t;
9817c478bd9Sstevel@tonic-gate 
9827c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
9837c478bd9Sstevel@tonic-gate 
9847c478bd9Sstevel@tonic-gate #endif	/* !_KERNEL && _STRUCTURED_PROC == 0 */
9857c478bd9Sstevel@tonic-gate 
9867c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
9877c478bd9Sstevel@tonic-gate }
9887c478bd9Sstevel@tonic-gate #endif
9897c478bd9Sstevel@tonic-gate 
9907c478bd9Sstevel@tonic-gate #endif	/* _SYS_PROCFS_H */
991