10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52685Sakolb * Common Development and Distribution License (the "License"). 62685Sakolb * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 212685Sakolb 220Sstevel@tonic-gate /* 232685Sakolb * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _SYS_PROCFS_H 280Sstevel@tonic-gate #define _SYS_PROCFS_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifdef __cplusplus 330Sstevel@tonic-gate extern "C" { 340Sstevel@tonic-gate #endif 350Sstevel@tonic-gate 360Sstevel@tonic-gate /* 370Sstevel@tonic-gate * This definition is temporary. Structured proc is the preferred API, 380Sstevel@tonic-gate * and the older ioctl-based interface will be removed in a future version 390Sstevel@tonic-gate * of Solaris. Until then, by default, including <sys/procfs.h> will 400Sstevel@tonic-gate * provide the older ioctl-based /proc definitions. To get the structured 410Sstevel@tonic-gate * /proc definitions, either include <procfs.h> or define _STRUCTURED_PROC 420Sstevel@tonic-gate * to be 1 before including <sys/procfs.h>. 430Sstevel@tonic-gate */ 440Sstevel@tonic-gate #ifndef _STRUCTURED_PROC 450Sstevel@tonic-gate #define _STRUCTURED_PROC 0 460Sstevel@tonic-gate #endif 470Sstevel@tonic-gate 480Sstevel@tonic-gate #if !defined(_KERNEL) && _STRUCTURED_PROC == 0 490Sstevel@tonic-gate 500Sstevel@tonic-gate #include <sys/old_procfs.h> 510Sstevel@tonic-gate 520Sstevel@tonic-gate #else /* !defined(_KERNEL) && _STRUCTURED_PROC == 0 */ 530Sstevel@tonic-gate 540Sstevel@tonic-gate #include <sys/feature_tests.h> 550Sstevel@tonic-gate #include <sys/types.h> 560Sstevel@tonic-gate #include <sys/time_impl.h> 570Sstevel@tonic-gate #include <sys/signal.h> 580Sstevel@tonic-gate #include <sys/siginfo.h> 590Sstevel@tonic-gate #include <sys/fault.h> 600Sstevel@tonic-gate #include <sys/syscall.h> 610Sstevel@tonic-gate #include <sys/pset.h> 620Sstevel@tonic-gate #include <sys/procfs_isa.h> 630Sstevel@tonic-gate #include <sys/priv.h> 640Sstevel@tonic-gate 650Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 660Sstevel@tonic-gate #error "Cannot use procfs in the large file compilation environment" 670Sstevel@tonic-gate #endif 680Sstevel@tonic-gate 690Sstevel@tonic-gate /* 700Sstevel@tonic-gate * System call interfaces for /proc. 710Sstevel@tonic-gate */ 720Sstevel@tonic-gate 730Sstevel@tonic-gate /* 740Sstevel@tonic-gate * Control codes (long values) for messages written to ctl and lwpctl files. 750Sstevel@tonic-gate */ 760Sstevel@tonic-gate #define PCNULL 0L /* null request, advance to next message */ 770Sstevel@tonic-gate #define PCSTOP 1L /* direct process or lwp to stop and wait for stop */ 780Sstevel@tonic-gate #define PCDSTOP 2L /* direct process or lwp to stop */ 790Sstevel@tonic-gate #define PCWSTOP 3L /* wait for process or lwp to stop, no timeout */ 800Sstevel@tonic-gate #define PCTWSTOP 4L /* wait for stop, with long millisecond timeout arg */ 810Sstevel@tonic-gate #define PCRUN 5L /* make process/lwp runnable, w/ long flags argument */ 820Sstevel@tonic-gate #define PCCSIG 6L /* clear current signal from lwp */ 830Sstevel@tonic-gate #define PCCFAULT 7L /* clear current fault from lwp */ 840Sstevel@tonic-gate #define PCSSIG 8L /* set current signal from siginfo_t argument */ 850Sstevel@tonic-gate #define PCKILL 9L /* post a signal to process/lwp, long argument */ 860Sstevel@tonic-gate #define PCUNKILL 10L /* delete a pending signal from process/lwp, long arg */ 870Sstevel@tonic-gate #define PCSHOLD 11L /* set lwp signal mask from sigset_t argument */ 880Sstevel@tonic-gate #define PCSTRACE 12L /* set traced signal set from sigset_t argument */ 890Sstevel@tonic-gate #define PCSFAULT 13L /* set traced fault set from fltset_t argument */ 900Sstevel@tonic-gate #define PCSENTRY 14L /* set traced syscall entry set from sysset_t arg */ 910Sstevel@tonic-gate #define PCSEXIT 15L /* set traced syscall exit set from sysset_t arg */ 920Sstevel@tonic-gate #define PCSET 16L /* set modes from long argument */ 930Sstevel@tonic-gate #define PCUNSET 17L /* unset modes from long argument */ 940Sstevel@tonic-gate #define PCSREG 18L /* set lwp general registers from prgregset_t arg */ 950Sstevel@tonic-gate #define PCSFPREG 19L /* set lwp floating-point registers from prfpregset_t */ 960Sstevel@tonic-gate #define PCSXREG 20L /* set lwp extra registers from prxregset_t arg */ 970Sstevel@tonic-gate #define PCNICE 21L /* set nice priority from long argument */ 980Sstevel@tonic-gate #define PCSVADDR 22L /* set %pc virtual address from long argument */ 990Sstevel@tonic-gate #define PCWATCH 23L /* set/unset watched memory area from prwatch_t arg */ 1000Sstevel@tonic-gate #define PCAGENT 24L /* create agent lwp with regs from prgregset_t arg */ 1010Sstevel@tonic-gate #define PCREAD 25L /* read from the address space via priovec_t arg */ 1020Sstevel@tonic-gate #define PCWRITE 26L /* write to the address space via priovec_t arg */ 1030Sstevel@tonic-gate #define PCSCRED 27L /* set process credentials from prcred_t argument */ 1040Sstevel@tonic-gate #define PCSASRS 28L /* set ancillary state registers from asrset_t arg */ 1050Sstevel@tonic-gate #define PCSPRIV 29L /* set process privileges from prpriv_t argument */ 1060Sstevel@tonic-gate #define PCSZONE 30L /* set zoneid from zoneid_t argument */ 1070Sstevel@tonic-gate #define PCSCREDX 31L /* as PCSCRED but with supplemental groups */ 1080Sstevel@tonic-gate /* 1090Sstevel@tonic-gate * PCRUN long operand flags. 1100Sstevel@tonic-gate */ 1110Sstevel@tonic-gate #define PRCSIG 0x01 /* clear current signal, if any */ 1120Sstevel@tonic-gate #define PRCFAULT 0x02 /* clear current fault, if any */ 1130Sstevel@tonic-gate #define PRSTEP 0x04 /* direct the lwp to single-step */ 1140Sstevel@tonic-gate #define PRSABORT 0x08 /* abort syscall, if in syscall */ 1150Sstevel@tonic-gate #define PRSTOP 0x10 /* set directed stop request */ 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate /* 1180Sstevel@tonic-gate * lwp status file. /proc/<pid>/lwp/<lwpid>/lwpstatus 1190Sstevel@tonic-gate */ 1200Sstevel@tonic-gate #define PRCLSZ 8 /* maximum size of scheduling class name */ 1210Sstevel@tonic-gate #define PRSYSARGS 8 /* maximum number of syscall arguments */ 1220Sstevel@tonic-gate typedef struct lwpstatus { 1230Sstevel@tonic-gate int pr_flags; /* flags (see below) */ 1240Sstevel@tonic-gate id_t pr_lwpid; /* specific lwp identifier */ 1250Sstevel@tonic-gate short pr_why; /* reason for lwp stop, if stopped */ 1260Sstevel@tonic-gate short pr_what; /* more detailed reason */ 1270Sstevel@tonic-gate short pr_cursig; /* current signal, if any */ 1280Sstevel@tonic-gate short pr_pad1; 1290Sstevel@tonic-gate siginfo_t pr_info; /* info associated with signal or fault */ 1300Sstevel@tonic-gate sigset_t pr_lwppend; /* set of signals pending to the lwp */ 1310Sstevel@tonic-gate sigset_t pr_lwphold; /* set of signals blocked by the lwp */ 1320Sstevel@tonic-gate struct sigaction pr_action; /* signal action for current signal */ 1330Sstevel@tonic-gate stack_t pr_altstack; /* alternate signal stack info */ 1340Sstevel@tonic-gate uintptr_t pr_oldcontext; /* address of previous ucontext */ 1350Sstevel@tonic-gate short pr_syscall; /* system call number (if in syscall) */ 1360Sstevel@tonic-gate short pr_nsysarg; /* number of arguments to this syscall */ 1370Sstevel@tonic-gate int pr_errno; /* errno for failed syscall, 0 if successful */ 1380Sstevel@tonic-gate long pr_sysarg[PRSYSARGS]; /* arguments to this syscall */ 1390Sstevel@tonic-gate long pr_rval1; /* primary syscall return value */ 1400Sstevel@tonic-gate long pr_rval2; /* second syscall return value, if any */ 1410Sstevel@tonic-gate char pr_clname[PRCLSZ]; /* scheduling class name */ 1420Sstevel@tonic-gate timestruc_t pr_tstamp; /* real-time time stamp of stop */ 1430Sstevel@tonic-gate timestruc_t pr_utime; /* lwp user cpu time */ 1440Sstevel@tonic-gate timestruc_t pr_stime; /* lwp system cpu time */ 1450Sstevel@tonic-gate int pr_filler[11 - 2 * sizeof (timestruc_t) / sizeof (int)]; 1460Sstevel@tonic-gate int pr_errpriv; /* missing privilege */ 1470Sstevel@tonic-gate uintptr_t pr_ustack; /* address of stack boundary data (stack_t) */ 1480Sstevel@tonic-gate ulong_t pr_instr; /* current instruction */ 1490Sstevel@tonic-gate prgregset_t pr_reg; /* general registers */ 1500Sstevel@tonic-gate prfpregset_t pr_fpreg; /* floating-point registers */ 1510Sstevel@tonic-gate } lwpstatus_t; 1520Sstevel@tonic-gate 1530Sstevel@tonic-gate /* 1540Sstevel@tonic-gate * process status file. /proc/<pid>/status 1550Sstevel@tonic-gate */ 1560Sstevel@tonic-gate typedef struct pstatus { 1570Sstevel@tonic-gate int pr_flags; /* flags (see below) */ 1580Sstevel@tonic-gate int pr_nlwp; /* number of active lwps in the process */ 1590Sstevel@tonic-gate pid_t pr_pid; /* process id */ 1600Sstevel@tonic-gate pid_t pr_ppid; /* parent process id */ 1610Sstevel@tonic-gate pid_t pr_pgid; /* process group id */ 1620Sstevel@tonic-gate pid_t pr_sid; /* session id */ 1630Sstevel@tonic-gate id_t pr_aslwpid; /* historical; now always zero */ 1640Sstevel@tonic-gate id_t pr_agentid; /* lwp id of the /proc agent lwp, if any */ 1650Sstevel@tonic-gate sigset_t pr_sigpend; /* set of process pending signals */ 1660Sstevel@tonic-gate uintptr_t pr_brkbase; /* address of the process heap */ 1670Sstevel@tonic-gate size_t pr_brksize; /* size of the process heap, in bytes */ 1680Sstevel@tonic-gate uintptr_t pr_stkbase; /* address of the process stack */ 1690Sstevel@tonic-gate size_t pr_stksize; /* size of the process stack, in bytes */ 1700Sstevel@tonic-gate timestruc_t pr_utime; /* process user cpu time */ 1710Sstevel@tonic-gate timestruc_t pr_stime; /* process system cpu time */ 1720Sstevel@tonic-gate timestruc_t pr_cutime; /* sum of children's user times */ 1730Sstevel@tonic-gate timestruc_t pr_cstime; /* sum of children's system times */ 1740Sstevel@tonic-gate sigset_t pr_sigtrace; /* set of traced signals */ 1750Sstevel@tonic-gate fltset_t pr_flttrace; /* set of traced faults */ 1760Sstevel@tonic-gate sysset_t pr_sysentry; /* set of system calls traced on entry */ 1770Sstevel@tonic-gate sysset_t pr_sysexit; /* set of system calls traced on exit */ 1780Sstevel@tonic-gate char pr_dmodel; /* data model of the process (see below) */ 1790Sstevel@tonic-gate char pr_pad[3]; 1800Sstevel@tonic-gate taskid_t pr_taskid; /* task id */ 1810Sstevel@tonic-gate projid_t pr_projid; /* project id */ 1820Sstevel@tonic-gate int pr_nzomb; /* number of zombie lwps in the process */ 1830Sstevel@tonic-gate zoneid_t pr_zoneid; /* zone id */ 1840Sstevel@tonic-gate int pr_filler[15]; /* reserved for future use */ 1850Sstevel@tonic-gate lwpstatus_t pr_lwp; /* status of the representative lwp */ 1860Sstevel@tonic-gate } pstatus_t; 1870Sstevel@tonic-gate 1880Sstevel@tonic-gate /* 1890Sstevel@tonic-gate * pr_flags (same values appear in both pstatus_t and lwpstatus_t pr_flags). 1900Sstevel@tonic-gate * 1910Sstevel@tonic-gate * These flags do *not* apply to psinfo_t.pr_flag or lwpsinfo_t.pr_flag 1920Sstevel@tonic-gate * (which are both deprecated). 1930Sstevel@tonic-gate */ 1940Sstevel@tonic-gate /* The following flags apply to the specific or representative lwp */ 1950Sstevel@tonic-gate #define PR_STOPPED 0x00000001 /* lwp is stopped */ 1960Sstevel@tonic-gate #define PR_ISTOP 0x00000002 /* lwp is stopped on an event of interest */ 1970Sstevel@tonic-gate #define PR_DSTOP 0x00000004 /* lwp has a stop directive in effect */ 1980Sstevel@tonic-gate #define PR_STEP 0x00000008 /* lwp has a single-step directive in effect */ 1990Sstevel@tonic-gate #define PR_ASLEEP 0x00000010 /* lwp is sleeping in a system call */ 2000Sstevel@tonic-gate #define PR_PCINVAL 0x00000020 /* contents of pr_instr undefined */ 2010Sstevel@tonic-gate #define PR_ASLWP 0x00000040 /* obsolete flag; never set */ 2020Sstevel@tonic-gate #define PR_AGENT 0x00000080 /* this lwp is the /proc agent lwp */ 2030Sstevel@tonic-gate #define PR_DETACH 0x00000100 /* this is a detached lwp */ 2040Sstevel@tonic-gate #define PR_DAEMON 0x00000200 /* this is a daemon lwp */ 2050Sstevel@tonic-gate /* The following flags apply to the process, not to an individual lwp */ 2060Sstevel@tonic-gate #define PR_ISSYS 0x00001000 /* this is a system process */ 2070Sstevel@tonic-gate #define PR_VFORKP 0x00002000 /* process is the parent of a vfork()d child */ 2080Sstevel@tonic-gate #define PR_ORPHAN 0x00004000 /* process's process group is orphaned */ 2090Sstevel@tonic-gate /* The following process flags are modes settable by PCSET/PCUNSET */ 2100Sstevel@tonic-gate #define PR_FORK 0x00100000 /* inherit-on-fork is in effect */ 2110Sstevel@tonic-gate #define PR_RLC 0x00200000 /* run-on-last-close is in effect */ 2120Sstevel@tonic-gate #define PR_KLC 0x00400000 /* kill-on-last-close is in effect */ 2130Sstevel@tonic-gate #define PR_ASYNC 0x00800000 /* asynchronous-stop is in effect */ 2140Sstevel@tonic-gate #define PR_MSACCT 0x01000000 /* micro-state usage accounting is in effect */ 2150Sstevel@tonic-gate #define PR_BPTADJ 0x02000000 /* breakpoint trap pc adjustment is in effect */ 2160Sstevel@tonic-gate #define PR_PTRACE 0x04000000 /* ptrace-compatibility mode is in effect */ 2170Sstevel@tonic-gate #define PR_MSFORK 0x08000000 /* micro-state accounting inherited on fork */ 2180Sstevel@tonic-gate #define PR_IDLE 0x10000000 /* lwp is a cpu's idle thread */ 2190Sstevel@tonic-gate 2200Sstevel@tonic-gate /* 2210Sstevel@tonic-gate * See <sys/procfs_isa.h> for possible values of pr_dmodel. 2220Sstevel@tonic-gate */ 2230Sstevel@tonic-gate 2240Sstevel@tonic-gate /* 2250Sstevel@tonic-gate * Reasons for stopping (pr_why). 2260Sstevel@tonic-gate */ 2270Sstevel@tonic-gate #define PR_REQUESTED 1 2280Sstevel@tonic-gate #define PR_SIGNALLED 2 2290Sstevel@tonic-gate #define PR_SYSENTRY 3 2300Sstevel@tonic-gate #define PR_SYSEXIT 4 2310Sstevel@tonic-gate #define PR_JOBCONTROL 5 2320Sstevel@tonic-gate #define PR_FAULTED 6 2330Sstevel@tonic-gate #define PR_SUSPENDED 7 2340Sstevel@tonic-gate #define PR_CHECKPOINT 8 2350Sstevel@tonic-gate 2360Sstevel@tonic-gate /* 2370Sstevel@tonic-gate * lwp ps(1) information file. /proc/<pid>/lwp/<lwpid>/lwpsinfo 2380Sstevel@tonic-gate */ 2390Sstevel@tonic-gate #define PRFNSZ 16 /* Maximum size of execed filename */ 2400Sstevel@tonic-gate typedef struct lwpsinfo { 2410Sstevel@tonic-gate int pr_flag; /* lwp flags (DEPRECATED; do not use) */ 2420Sstevel@tonic-gate id_t pr_lwpid; /* lwp id */ 2430Sstevel@tonic-gate uintptr_t pr_addr; /* internal address of lwp */ 2440Sstevel@tonic-gate uintptr_t pr_wchan; /* wait addr for sleeping lwp */ 2450Sstevel@tonic-gate char pr_stype; /* synchronization event type */ 2460Sstevel@tonic-gate char pr_state; /* numeric lwp state */ 2470Sstevel@tonic-gate char pr_sname; /* printable character for pr_state */ 2480Sstevel@tonic-gate char pr_nice; /* nice for cpu usage */ 2490Sstevel@tonic-gate short pr_syscall; /* system call number (if in syscall) */ 2500Sstevel@tonic-gate char pr_oldpri; /* pre-SVR4, low value is high priority */ 2510Sstevel@tonic-gate char pr_cpu; /* pre-SVR4, cpu usage for scheduling */ 2520Sstevel@tonic-gate int pr_pri; /* priority, high value is high priority */ 2530Sstevel@tonic-gate /* The following percent number is a 16-bit binary */ 2540Sstevel@tonic-gate /* fraction [0 .. 1] with the binary point to the */ 2550Sstevel@tonic-gate /* right of the high-order bit (1.0 == 0x8000) */ 2560Sstevel@tonic-gate ushort_t pr_pctcpu; /* % of recent cpu time used by this lwp */ 2570Sstevel@tonic-gate ushort_t pr_pad; 2580Sstevel@tonic-gate timestruc_t pr_start; /* lwp start time, from the epoch */ 2590Sstevel@tonic-gate timestruc_t pr_time; /* usr+sys cpu time for this lwp */ 2600Sstevel@tonic-gate char pr_clname[PRCLSZ]; /* scheduling class name */ 2610Sstevel@tonic-gate char pr_name[PRFNSZ]; /* name of system lwp */ 2620Sstevel@tonic-gate processorid_t pr_onpro; /* processor which last ran this lwp */ 2630Sstevel@tonic-gate processorid_t pr_bindpro; /* processor to which lwp is bound */ 2640Sstevel@tonic-gate psetid_t pr_bindpset; /* processor set to which lwp is bound */ 265*2690Sakolb int pr_lgrp; /* lwp home lgroup */ 2662685Sakolb int pr_filler[4]; /* reserved for future use */ 2670Sstevel@tonic-gate } lwpsinfo_t; 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate /* 2700Sstevel@tonic-gate * process ps(1) information file. /proc/<pid>/psinfo 2710Sstevel@tonic-gate */ 2720Sstevel@tonic-gate #define PRARGSZ 80 /* number of chars of arguments */ 2730Sstevel@tonic-gate typedef struct psinfo { 2740Sstevel@tonic-gate int pr_flag; /* process flags (DEPRECATED; do not use) */ 2750Sstevel@tonic-gate int pr_nlwp; /* number of active lwps in the process */ 2760Sstevel@tonic-gate pid_t pr_pid; /* unique process id */ 2770Sstevel@tonic-gate pid_t pr_ppid; /* process id of parent */ 2780Sstevel@tonic-gate pid_t pr_pgid; /* pid of process group leader */ 2790Sstevel@tonic-gate pid_t pr_sid; /* session id */ 2800Sstevel@tonic-gate uid_t pr_uid; /* real user id */ 2810Sstevel@tonic-gate uid_t pr_euid; /* effective user id */ 2820Sstevel@tonic-gate gid_t pr_gid; /* real group id */ 2830Sstevel@tonic-gate gid_t pr_egid; /* effective group id */ 2840Sstevel@tonic-gate uintptr_t pr_addr; /* address of process */ 2850Sstevel@tonic-gate size_t pr_size; /* size of process image in Kbytes */ 2860Sstevel@tonic-gate size_t pr_rssize; /* resident set size in Kbytes */ 2870Sstevel@tonic-gate size_t pr_pad1; 2880Sstevel@tonic-gate dev_t pr_ttydev; /* controlling tty device (or PRNODEV) */ 2890Sstevel@tonic-gate /* The following percent numbers are 16-bit binary */ 2900Sstevel@tonic-gate /* fractions [0 .. 1] with the binary point to the */ 2910Sstevel@tonic-gate /* right of the high-order bit (1.0 == 0x8000) */ 2920Sstevel@tonic-gate ushort_t pr_pctcpu; /* % of recent cpu time used by all lwps */ 2930Sstevel@tonic-gate ushort_t pr_pctmem; /* % of system memory used by process */ 2940Sstevel@tonic-gate timestruc_t pr_start; /* process start time, from the epoch */ 2950Sstevel@tonic-gate timestruc_t pr_time; /* usr+sys cpu time for this process */ 2960Sstevel@tonic-gate timestruc_t pr_ctime; /* usr+sys cpu time for reaped children */ 2970Sstevel@tonic-gate char pr_fname[PRFNSZ]; /* name of execed file */ 2980Sstevel@tonic-gate char pr_psargs[PRARGSZ]; /* initial characters of arg list */ 2990Sstevel@tonic-gate int pr_wstat; /* if zombie, the wait() status */ 3000Sstevel@tonic-gate int pr_argc; /* initial argument count */ 3010Sstevel@tonic-gate uintptr_t pr_argv; /* address of initial argument vector */ 3020Sstevel@tonic-gate uintptr_t pr_envp; /* address of initial environment vector */ 3030Sstevel@tonic-gate char pr_dmodel; /* data model of the process */ 3040Sstevel@tonic-gate char pr_pad2[3]; 3050Sstevel@tonic-gate taskid_t pr_taskid; /* task id */ 3060Sstevel@tonic-gate projid_t pr_projid; /* project id */ 3070Sstevel@tonic-gate int pr_nzomb; /* number of zombie lwps in the process */ 3080Sstevel@tonic-gate poolid_t pr_poolid; /* pool id */ 3090Sstevel@tonic-gate zoneid_t pr_zoneid; /* zone id */ 3100Sstevel@tonic-gate id_t pr_contract; /* process contract */ 3110Sstevel@tonic-gate int pr_filler[1]; /* reserved for future use */ 3120Sstevel@tonic-gate lwpsinfo_t pr_lwp; /* information for representative lwp */ 3130Sstevel@tonic-gate } psinfo_t; 3140Sstevel@tonic-gate 3150Sstevel@tonic-gate #define PRNODEV (dev_t)(-1) /* non-existent device */ 3160Sstevel@tonic-gate 3170Sstevel@tonic-gate /* 3180Sstevel@tonic-gate * Memory-map interface. /proc/<pid>/map /proc/<pid>/rmap 3190Sstevel@tonic-gate */ 3200Sstevel@tonic-gate #define PRMAPSZ 64 3210Sstevel@tonic-gate typedef struct prmap { 3220Sstevel@tonic-gate uintptr_t pr_vaddr; /* virtual address of mapping */ 3230Sstevel@tonic-gate size_t pr_size; /* size of mapping in bytes */ 3240Sstevel@tonic-gate char pr_mapname[PRMAPSZ]; /* name in /proc/<pid>/object */ 3250Sstevel@tonic-gate offset_t pr_offset; /* offset into mapped object, if any */ 3260Sstevel@tonic-gate int pr_mflags; /* protection and attribute flags (see below) */ 3270Sstevel@tonic-gate int pr_pagesize; /* pagesize (bytes) for this mapping */ 3280Sstevel@tonic-gate int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */ 3290Sstevel@tonic-gate int pr_filler[1]; /* filler for future expansion */ 3300Sstevel@tonic-gate } prmap_t; 3310Sstevel@tonic-gate 3320Sstevel@tonic-gate /* 3330Sstevel@tonic-gate * HAT memory-map interface. /proc/<pid>/xmap 3340Sstevel@tonic-gate * 3350Sstevel@tonic-gate * The xmap structure is a Sun private interface. The existence, semantics 3360Sstevel@tonic-gate * and contents of the xmap structure are subject to arbitrary change. 3370Sstevel@tonic-gate */ 3380Sstevel@tonic-gate typedef struct prxmap { 3390Sstevel@tonic-gate uintptr_t pr_vaddr; /* virtual address of mapping */ 3400Sstevel@tonic-gate size_t pr_size; /* size of mapping in bytes */ 3410Sstevel@tonic-gate char pr_mapname[PRMAPSZ]; /* name in /proc/<pid>/object */ 3420Sstevel@tonic-gate offset_t pr_offset; /* offset into mapped object, if any */ 3430Sstevel@tonic-gate int pr_mflags; /* protection and attribute flags (see below) */ 3440Sstevel@tonic-gate int pr_pagesize; /* pagesize (bytes) for this mapping */ 3450Sstevel@tonic-gate int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */ 3460Sstevel@tonic-gate dev_t pr_dev; /* st_dev from stat64() of mapped object, or PRNODEV */ 3470Sstevel@tonic-gate uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */ 3480Sstevel@tonic-gate ulong_t pr_rss; /* pages of resident memory */ 3490Sstevel@tonic-gate ulong_t pr_anon; /* pages of resident anonymous memory */ 3500Sstevel@tonic-gate ulong_t pr_locked; /* pages of locked memory */ 3510Sstevel@tonic-gate int pr_hatpagesize; /* pagesize of the hat mapping */ 3520Sstevel@tonic-gate ulong_t pr_filler[8]; /* filler for future expansion */ 3530Sstevel@tonic-gate } prxmap_t; 3540Sstevel@tonic-gate 3550Sstevel@tonic-gate 3560Sstevel@tonic-gate /* Protection and attribute flags */ 3570Sstevel@tonic-gate #define MA_READ 0x04 /* readable by the traced process */ 3580Sstevel@tonic-gate #define MA_WRITE 0x02 /* writable by the traced process */ 3590Sstevel@tonic-gate #define MA_EXEC 0x01 /* executable by the traced process */ 3600Sstevel@tonic-gate #define MA_SHARED 0x08 /* changes are shared by mapped object */ 3610Sstevel@tonic-gate #define MA_ANON 0x40 /* anonymous memory (e.g. /dev/zero) */ 3620Sstevel@tonic-gate #define MA_ISM 0x80 /* intimate shared mem (shared MMU resources) */ 3630Sstevel@tonic-gate #define MA_NORESERVE 0x100 /* mapped with MAP_NORESERVE */ 3640Sstevel@tonic-gate #define MA_SHM 0x200 /* System V shared memory */ 3650Sstevel@tonic-gate #define MA_RESERVED1 0x400 /* reserved for future use */ 3660Sstevel@tonic-gate 3670Sstevel@tonic-gate /* 3680Sstevel@tonic-gate * These are obsolete and unreliable. 3690Sstevel@tonic-gate * They are included here only for historical compatibility. 3700Sstevel@tonic-gate */ 3710Sstevel@tonic-gate #define MA_BREAK 0x10 /* grown by brk(2) */ 3720Sstevel@tonic-gate #define MA_STACK 0x20 /* grown automatically on stack faults */ 3730Sstevel@tonic-gate 3740Sstevel@tonic-gate /* 3750Sstevel@tonic-gate * Process credentials. PCSCRED and /proc/<pid>/cred 3760Sstevel@tonic-gate */ 3770Sstevel@tonic-gate typedef struct prcred { 3780Sstevel@tonic-gate uid_t pr_euid; /* effective user id */ 3790Sstevel@tonic-gate uid_t pr_ruid; /* real user id */ 3800Sstevel@tonic-gate uid_t pr_suid; /* saved user id (from exec) */ 3810Sstevel@tonic-gate gid_t pr_egid; /* effective group id */ 3820Sstevel@tonic-gate gid_t pr_rgid; /* real group id */ 3830Sstevel@tonic-gate gid_t pr_sgid; /* saved group id (from exec) */ 3840Sstevel@tonic-gate int pr_ngroups; /* number of supplementary groups */ 3850Sstevel@tonic-gate gid_t pr_groups[1]; /* array of supplementary groups */ 3860Sstevel@tonic-gate } prcred_t; 3870Sstevel@tonic-gate 3880Sstevel@tonic-gate /* 3890Sstevel@tonic-gate * Process privileges. PCSPRIV and /proc/<pid>/priv 3900Sstevel@tonic-gate */ 3910Sstevel@tonic-gate typedef struct prpriv { 3920Sstevel@tonic-gate uint32_t pr_nsets; /* number of privilege set */ 3930Sstevel@tonic-gate uint32_t pr_setsize; /* size of privilege set */ 3940Sstevel@tonic-gate uint32_t pr_infosize; /* size of supplementary data */ 3950Sstevel@tonic-gate priv_chunk_t pr_sets[1]; /* array of sets */ 3960Sstevel@tonic-gate } prpriv_t; 3970Sstevel@tonic-gate 3980Sstevel@tonic-gate /* 3990Sstevel@tonic-gate * Watchpoint interface. PCWATCH and /proc/<pid>/watch 4000Sstevel@tonic-gate */ 4010Sstevel@tonic-gate typedef struct prwatch { 4020Sstevel@tonic-gate uintptr_t pr_vaddr; /* virtual address of watched area */ 4030Sstevel@tonic-gate size_t pr_size; /* size of watched area in bytes */ 4040Sstevel@tonic-gate int pr_wflags; /* watch type flags */ 4050Sstevel@tonic-gate int pr_pad; 4060Sstevel@tonic-gate } prwatch_t; 4070Sstevel@tonic-gate 4080Sstevel@tonic-gate /* pr_wflags */ 4090Sstevel@tonic-gate #define WA_READ 0x04 /* trap on read access */ 4100Sstevel@tonic-gate #define WA_WRITE 0x02 /* trap on write access */ 4110Sstevel@tonic-gate #define WA_EXEC 0x01 /* trap on execute access */ 4120Sstevel@tonic-gate #define WA_TRAPAFTER 0x08 /* trap after instruction completes */ 4130Sstevel@tonic-gate 4140Sstevel@tonic-gate /* 4150Sstevel@tonic-gate * PCREAD/PCWRITE I/O interface. 4160Sstevel@tonic-gate */ 4170Sstevel@tonic-gate typedef struct priovec { 4180Sstevel@tonic-gate void *pio_base; /* buffer in controlling process */ 4190Sstevel@tonic-gate size_t pio_len; /* size of read/write request */ 4200Sstevel@tonic-gate off_t pio_offset; /* virtual address in target process */ 4210Sstevel@tonic-gate } priovec_t; 4220Sstevel@tonic-gate 4230Sstevel@tonic-gate /* 4240Sstevel@tonic-gate * Resource usage. /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage 4250Sstevel@tonic-gate */ 4260Sstevel@tonic-gate typedef struct prusage { 4270Sstevel@tonic-gate id_t pr_lwpid; /* lwp id. 0: process or defunct */ 4280Sstevel@tonic-gate int pr_count; /* number of contributing lwps */ 4290Sstevel@tonic-gate timestruc_t pr_tstamp; /* current time stamp */ 4300Sstevel@tonic-gate timestruc_t pr_create; /* process/lwp creation time stamp */ 4310Sstevel@tonic-gate timestruc_t pr_term; /* process/lwp termination time stamp */ 4320Sstevel@tonic-gate timestruc_t pr_rtime; /* total lwp real (elapsed) time */ 4330Sstevel@tonic-gate timestruc_t pr_utime; /* user level cpu time */ 4340Sstevel@tonic-gate timestruc_t pr_stime; /* system call cpu time */ 4350Sstevel@tonic-gate timestruc_t pr_ttime; /* other system trap cpu time */ 4360Sstevel@tonic-gate timestruc_t pr_tftime; /* text page fault sleep time */ 4370Sstevel@tonic-gate timestruc_t pr_dftime; /* data page fault sleep time */ 4380Sstevel@tonic-gate timestruc_t pr_kftime; /* kernel page fault sleep time */ 4390Sstevel@tonic-gate timestruc_t pr_ltime; /* user lock wait sleep time */ 4400Sstevel@tonic-gate timestruc_t pr_slptime; /* all other sleep time */ 4410Sstevel@tonic-gate timestruc_t pr_wtime; /* wait-cpu (latency) time */ 4420Sstevel@tonic-gate timestruc_t pr_stoptime; /* stopped time */ 4430Sstevel@tonic-gate timestruc_t filltime[6]; /* filler for future expansion */ 4440Sstevel@tonic-gate ulong_t pr_minf; /* minor page faults */ 4450Sstevel@tonic-gate ulong_t pr_majf; /* major page faults */ 4460Sstevel@tonic-gate ulong_t pr_nswap; /* swaps */ 4470Sstevel@tonic-gate ulong_t pr_inblk; /* input blocks */ 4480Sstevel@tonic-gate ulong_t pr_oublk; /* output blocks */ 4490Sstevel@tonic-gate ulong_t pr_msnd; /* messages sent */ 4500Sstevel@tonic-gate ulong_t pr_mrcv; /* messages received */ 4510Sstevel@tonic-gate ulong_t pr_sigs; /* signals received */ 4520Sstevel@tonic-gate ulong_t pr_vctx; /* voluntary context switches */ 4530Sstevel@tonic-gate ulong_t pr_ictx; /* involuntary context switches */ 4540Sstevel@tonic-gate ulong_t pr_sysc; /* system calls */ 4550Sstevel@tonic-gate ulong_t pr_ioch; /* chars read and written */ 4560Sstevel@tonic-gate ulong_t filler[10]; /* filler for future expansion */ 4570Sstevel@tonic-gate } prusage_t; 4580Sstevel@tonic-gate 4590Sstevel@tonic-gate /* 4600Sstevel@tonic-gate * Page data file. /proc/<pid>/pagedata 4610Sstevel@tonic-gate */ 4620Sstevel@tonic-gate 4630Sstevel@tonic-gate /* page data file header */ 4640Sstevel@tonic-gate typedef struct prpageheader { 4650Sstevel@tonic-gate timestruc_t pr_tstamp; /* real time stamp */ 4660Sstevel@tonic-gate long pr_nmap; /* number of address space mappings */ 4670Sstevel@tonic-gate long pr_npage; /* total number of pages */ 4680Sstevel@tonic-gate } prpageheader_t; 4690Sstevel@tonic-gate 4700Sstevel@tonic-gate /* page data mapping header */ 4710Sstevel@tonic-gate typedef struct prasmap { 4720Sstevel@tonic-gate uintptr_t pr_vaddr; /* virtual address of mapping */ 4730Sstevel@tonic-gate size_t pr_npage; /* number of pages in mapping */ 4740Sstevel@tonic-gate char pr_mapname[PRMAPSZ]; /* name in /proc/<pid>/object */ 4750Sstevel@tonic-gate offset_t pr_offset; /* offset into mapped object, if any */ 4760Sstevel@tonic-gate int pr_mflags; /* protection and attribute flags */ 4770Sstevel@tonic-gate int pr_pagesize; /* pagesize (bytes) for this mapping */ 4780Sstevel@tonic-gate int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */ 4790Sstevel@tonic-gate int pr_filler[1]; /* filler for future expansion */ 4800Sstevel@tonic-gate } prasmap_t; 4810Sstevel@tonic-gate 4820Sstevel@tonic-gate /* 4830Sstevel@tonic-gate * pr_npage bytes (plus 0-7 null bytes to round up to an 8-byte boundary) 4840Sstevel@tonic-gate * follow each mapping header, each containing zero or more of these flags. 4850Sstevel@tonic-gate */ 4860Sstevel@tonic-gate #define PG_REFERENCED 0x02 /* page referenced since last read */ 4870Sstevel@tonic-gate #define PG_MODIFIED 0x01 /* page modified since last read */ 4880Sstevel@tonic-gate #define PG_HWMAPPED 0x04 /* page is present and mapped */ 4890Sstevel@tonic-gate 4900Sstevel@tonic-gate /* 4910Sstevel@tonic-gate * Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage 4920Sstevel@tonic-gate */ 4930Sstevel@tonic-gate typedef struct prheader { 4940Sstevel@tonic-gate long pr_nent; /* number of entries */ 4950Sstevel@tonic-gate long pr_entsize; /* size of each entry, in bytes */ 4960Sstevel@tonic-gate } prheader_t; 4970Sstevel@tonic-gate 4980Sstevel@tonic-gate /* 4990Sstevel@tonic-gate * Macros for manipulating sets of flags. 5000Sstevel@tonic-gate * sp must be a pointer to one of sigset_t, fltset_t, or sysset_t. 5010Sstevel@tonic-gate * flag must be a member of the enumeration corresponding to *sp. 5020Sstevel@tonic-gate */ 5030Sstevel@tonic-gate 5040Sstevel@tonic-gate /* turn on all flags in set */ 5050Sstevel@tonic-gate #define prfillset(sp) \ 5060Sstevel@tonic-gate { register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \ 5070Sstevel@tonic-gate while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0xFFFFFFFF; } 5080Sstevel@tonic-gate 5090Sstevel@tonic-gate /* turn off all flags in set */ 5100Sstevel@tonic-gate #define premptyset(sp) \ 5110Sstevel@tonic-gate { register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \ 5120Sstevel@tonic-gate while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0; } 5130Sstevel@tonic-gate 5140Sstevel@tonic-gate /* turn on specified flag in set */ 5150Sstevel@tonic-gate #define praddset(sp, flag) \ 5160Sstevel@tonic-gate ((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \ 5170Sstevel@tonic-gate (((uint32_t *)(sp))[((flag)-1)/32] |= (1U<<(((flag)-1)%32))) : 0)) 5180Sstevel@tonic-gate 5190Sstevel@tonic-gate /* turn off specified flag in set */ 5200Sstevel@tonic-gate #define prdelset(sp, flag) \ 5210Sstevel@tonic-gate ((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \ 5220Sstevel@tonic-gate (((uint32_t *)(sp))[((flag)-1)/32] &= ~(1U<<(((flag)-1)%32))) : 0)) 5230Sstevel@tonic-gate 5240Sstevel@tonic-gate /* query: != 0 iff flag is turned on in set */ 5250Sstevel@tonic-gate #define prismember(sp, flag) \ 5260Sstevel@tonic-gate (((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) && \ 5270Sstevel@tonic-gate (((uint32_t *)(sp))[((flag)-1)/32] & (1U<<(((flag)-1)%32)))) 5280Sstevel@tonic-gate 5290Sstevel@tonic-gate #if defined(_SYSCALL32) 5300Sstevel@tonic-gate 5310Sstevel@tonic-gate /* 5320Sstevel@tonic-gate * dev32_t version of PRNODEV 5330Sstevel@tonic-gate */ 5340Sstevel@tonic-gate #define PRNODEV32 (dev32_t)(-1) 5350Sstevel@tonic-gate 5360Sstevel@tonic-gate /* 5370Sstevel@tonic-gate * Kernel view of /proc structures for _ILP32 programs. 5380Sstevel@tonic-gate */ 5390Sstevel@tonic-gate 5400Sstevel@tonic-gate /* 5410Sstevel@tonic-gate * _ILP32 lwp status file. /proc/<pid>/lwp/<lwpid>/lwpstatus 5420Sstevel@tonic-gate */ 5430Sstevel@tonic-gate typedef struct lwpstatus32 { 5440Sstevel@tonic-gate int pr_flags; /* flags */ 5450Sstevel@tonic-gate id32_t pr_lwpid; /* specific lwp identifier */ 5460Sstevel@tonic-gate short pr_why; /* reason for lwp stop, if stopped */ 5470Sstevel@tonic-gate short pr_what; /* more detailed reason */ 5480Sstevel@tonic-gate short pr_cursig; /* current signal, if any */ 5490Sstevel@tonic-gate short pr_pad1; 5500Sstevel@tonic-gate siginfo32_t pr_info; /* info associated with signal or fault */ 5510Sstevel@tonic-gate sigset_t pr_lwppend; /* set of signals pending to the lwp */ 5520Sstevel@tonic-gate sigset_t pr_lwphold; /* set of signals blocked by the lwp */ 5530Sstevel@tonic-gate struct sigaction32 pr_action; /* signal action for current signal */ 5540Sstevel@tonic-gate stack32_t pr_altstack; /* alternate signal stack info */ 5550Sstevel@tonic-gate caddr32_t pr_oldcontext; /* address of previous ucontext */ 5560Sstevel@tonic-gate short pr_syscall; /* system call number (if in syscall) */ 5570Sstevel@tonic-gate short pr_nsysarg; /* number of arguments to this syscall */ 5580Sstevel@tonic-gate int pr_errno; /* errno for failed syscall, 0 if successful */ 5590Sstevel@tonic-gate int32_t pr_sysarg[PRSYSARGS]; /* arguments to this syscall */ 5600Sstevel@tonic-gate int32_t pr_rval1; /* primary syscall return value */ 5610Sstevel@tonic-gate int32_t pr_rval2; /* second syscall return value, if any */ 5620Sstevel@tonic-gate char pr_clname[PRCLSZ]; /* scheduling class name */ 5630Sstevel@tonic-gate timestruc32_t pr_tstamp; /* real-time time stamp of stop */ 5640Sstevel@tonic-gate timestruc32_t pr_utime; /* lwp user cpu time */ 5650Sstevel@tonic-gate timestruc32_t pr_stime; /* lwp system cpu time */ 5660Sstevel@tonic-gate int pr_filler[11 - 2 * sizeof (timestruc32_t) / sizeof (int)]; 5670Sstevel@tonic-gate int pr_errpriv; /* missing privilege */ 5680Sstevel@tonic-gate caddr32_t pr_ustack; /* address of stack boundary data (stack32_t) */ 5690Sstevel@tonic-gate uint32_t pr_instr; /* current instruction */ 5700Sstevel@tonic-gate prgregset32_t pr_reg; /* general registers */ 5710Sstevel@tonic-gate prfpregset32_t pr_fpreg; /* floating-point registers */ 5720Sstevel@tonic-gate } lwpstatus32_t; 5730Sstevel@tonic-gate 5740Sstevel@tonic-gate /* 5750Sstevel@tonic-gate * _ILP32 process status file. /proc/<pid>/status 5760Sstevel@tonic-gate */ 5770Sstevel@tonic-gate typedef struct pstatus32 { 5780Sstevel@tonic-gate int pr_flags; /* flags */ 5790Sstevel@tonic-gate int pr_nlwp; /* number of active lwps in the process */ 5800Sstevel@tonic-gate pid32_t pr_pid; /* process id */ 5810Sstevel@tonic-gate pid32_t pr_ppid; /* parent process id */ 5820Sstevel@tonic-gate pid32_t pr_pgid; /* process group id */ 5830Sstevel@tonic-gate pid32_t pr_sid; /* session id */ 5840Sstevel@tonic-gate id32_t pr_aslwpid; /* historical; now always zero */ 5850Sstevel@tonic-gate id32_t pr_agentid; /* lwp id of the /proc agent lwp, if any */ 5860Sstevel@tonic-gate sigset_t pr_sigpend; /* set of process pending signals */ 5870Sstevel@tonic-gate caddr32_t pr_brkbase; /* address of the process heap */ 5880Sstevel@tonic-gate size32_t pr_brksize; /* size of the process heap, in bytes */ 5890Sstevel@tonic-gate caddr32_t pr_stkbase; /* address of the process stack */ 5900Sstevel@tonic-gate size32_t pr_stksize; /* size of the process stack, in bytes */ 5910Sstevel@tonic-gate timestruc32_t pr_utime; /* process user cpu time */ 5920Sstevel@tonic-gate timestruc32_t pr_stime; /* process system cpu time */ 5930Sstevel@tonic-gate timestruc32_t pr_cutime; /* sum of children's user times */ 5940Sstevel@tonic-gate timestruc32_t pr_cstime; /* sum of children's system times */ 5950Sstevel@tonic-gate sigset_t pr_sigtrace; /* set of traced signals */ 5960Sstevel@tonic-gate fltset_t pr_flttrace; /* set of traced faults */ 5970Sstevel@tonic-gate sysset_t pr_sysentry; /* set of system calls traced on entry */ 5980Sstevel@tonic-gate sysset_t pr_sysexit; /* set of system calls traced on exit */ 5990Sstevel@tonic-gate char pr_dmodel; /* data model of the process */ 6000Sstevel@tonic-gate char pr_pad[3]; 6010Sstevel@tonic-gate id32_t pr_taskid; /* task id */ 6020Sstevel@tonic-gate id32_t pr_projid; /* project id */ 6030Sstevel@tonic-gate int pr_nzomb; /* number of zombie lwps in the process */ 6040Sstevel@tonic-gate id32_t pr_zoneid; /* zone id */ 6050Sstevel@tonic-gate int pr_filler[15]; /* reserved for future use */ 6060Sstevel@tonic-gate lwpstatus32_t pr_lwp; /* status of the representative lwp */ 6070Sstevel@tonic-gate } pstatus32_t; 6080Sstevel@tonic-gate 6090Sstevel@tonic-gate /* 6100Sstevel@tonic-gate * _ILP32 lwp ps(1) information file. /proc/<pid>/lwp/<lwpid>/lwpsinfo 6110Sstevel@tonic-gate */ 6120Sstevel@tonic-gate typedef struct lwpsinfo32 { 6130Sstevel@tonic-gate int pr_flag; /* lwp flags */ 6140Sstevel@tonic-gate id32_t pr_lwpid; /* lwp id */ 6150Sstevel@tonic-gate caddr32_t pr_addr; /* internal address of lwp */ 6160Sstevel@tonic-gate caddr32_t pr_wchan; /* wait addr for sleeping lwp */ 6170Sstevel@tonic-gate char pr_stype; /* synchronization event type */ 6180Sstevel@tonic-gate char pr_state; /* numeric lwp state */ 6190Sstevel@tonic-gate char pr_sname; /* printable character for pr_state */ 6200Sstevel@tonic-gate char pr_nice; /* nice for cpu usage */ 6210Sstevel@tonic-gate short pr_syscall; /* system call number (if in syscall) */ 6220Sstevel@tonic-gate char pr_oldpri; /* pre-SVR4, low value is high priority */ 6230Sstevel@tonic-gate char pr_cpu; /* pre-SVR4, cpu usage for scheduling */ 6240Sstevel@tonic-gate int pr_pri; /* priority, high value is high priority */ 6250Sstevel@tonic-gate /* The following percent number is a 16-bit binary */ 6260Sstevel@tonic-gate /* fraction [0 .. 1] with the binary point to the */ 6270Sstevel@tonic-gate /* right of the high-order bit (1.0 == 0x8000) */ 6280Sstevel@tonic-gate ushort_t pr_pctcpu; /* % of recent cpu time used by this lwp */ 6290Sstevel@tonic-gate ushort_t pr_pad; 6300Sstevel@tonic-gate timestruc32_t pr_start; /* lwp start time, from the epoch */ 6310Sstevel@tonic-gate timestruc32_t pr_time; /* usr+sys cpu time for this lwp */ 6320Sstevel@tonic-gate char pr_clname[PRCLSZ]; /* scheduling class name */ 6330Sstevel@tonic-gate char pr_name[PRFNSZ]; /* name of system lwp */ 6340Sstevel@tonic-gate processorid_t pr_onpro; /* processor which last ran this lwp */ 6350Sstevel@tonic-gate processorid_t pr_bindpro; /* processor to which lwp is bound */ 6360Sstevel@tonic-gate psetid_t pr_bindpset; /* processor set to which lwp is bound */ 637*2690Sakolb int pr_lgrp; /* lwp home lgroup */ 6382685Sakolb int pr_filler[4]; /* reserved for future use */ 6390Sstevel@tonic-gate } lwpsinfo32_t; 6400Sstevel@tonic-gate 6410Sstevel@tonic-gate /* 6420Sstevel@tonic-gate * _ILP32 process ps(1) information file. /proc/<pid>/psinfo 6430Sstevel@tonic-gate */ 6440Sstevel@tonic-gate typedef struct psinfo32 { 6450Sstevel@tonic-gate int pr_flag; /* process flags */ 6460Sstevel@tonic-gate int pr_nlwp; /* number of active lwps in the process */ 6470Sstevel@tonic-gate pid32_t pr_pid; /* unique process id */ 6480Sstevel@tonic-gate pid32_t pr_ppid; /* process id of parent */ 6490Sstevel@tonic-gate pid32_t pr_pgid; /* pid of process group leader */ 6500Sstevel@tonic-gate pid32_t pr_sid; /* session id */ 6510Sstevel@tonic-gate uid32_t pr_uid; /* real user id */ 6520Sstevel@tonic-gate uid32_t pr_euid; /* effective user id */ 6530Sstevel@tonic-gate gid32_t pr_gid; /* real group id */ 6540Sstevel@tonic-gate gid32_t pr_egid; /* effective group id */ 6550Sstevel@tonic-gate caddr32_t pr_addr; /* address of process */ 6560Sstevel@tonic-gate size32_t pr_size; /* size of process image in Kbytes */ 6570Sstevel@tonic-gate size32_t pr_rssize; /* resident set size in Kbytes */ 6580Sstevel@tonic-gate size32_t pr_pad1; 6590Sstevel@tonic-gate dev32_t pr_ttydev; /* controlling tty device (or PRNODEV) */ 6600Sstevel@tonic-gate ushort_t pr_pctcpu; /* % of recent cpu time used by all lwps */ 6610Sstevel@tonic-gate ushort_t pr_pctmem; /* % of system memory used by process */ 6620Sstevel@tonic-gate timestruc32_t pr_start; /* process start time, from the epoch */ 6630Sstevel@tonic-gate timestruc32_t pr_time; /* usr+sys cpu time for this process */ 6640Sstevel@tonic-gate timestruc32_t pr_ctime; /* usr+sys cpu time for reaped children */ 6650Sstevel@tonic-gate char pr_fname[PRFNSZ]; /* name of execed file */ 6660Sstevel@tonic-gate char pr_psargs[PRARGSZ]; /* initial characters of arg list */ 6670Sstevel@tonic-gate int pr_wstat; /* if zombie, the wait() status */ 6680Sstevel@tonic-gate int pr_argc; /* initial argument count */ 6690Sstevel@tonic-gate caddr32_t pr_argv; /* address of initial argument vector */ 6700Sstevel@tonic-gate caddr32_t pr_envp; /* address of initial environment vector */ 6710Sstevel@tonic-gate char pr_dmodel; /* data model of the process */ 6720Sstevel@tonic-gate char pr_pad2[3]; 6730Sstevel@tonic-gate id32_t pr_taskid; /* task id */ 6740Sstevel@tonic-gate id32_t pr_projid; /* project id */ 6750Sstevel@tonic-gate int pr_nzomb; /* number of zombie lwps in the process */ 6760Sstevel@tonic-gate id32_t pr_poolid; /* pool id */ 6770Sstevel@tonic-gate id32_t pr_zoneid; /* zone id */ 6780Sstevel@tonic-gate id32_t pr_contract; /* process contract */ 6790Sstevel@tonic-gate int pr_filler[1]; /* reserved for future use */ 6800Sstevel@tonic-gate lwpsinfo32_t pr_lwp; /* information for representative lwp */ 6810Sstevel@tonic-gate } psinfo32_t; 6820Sstevel@tonic-gate 6830Sstevel@tonic-gate /* 6840Sstevel@tonic-gate * _ILP32 Memory-management interface. /proc/<pid>/map /proc/<pid>/rmap 6850Sstevel@tonic-gate */ 6860Sstevel@tonic-gate typedef struct prmap32 { 6870Sstevel@tonic-gate caddr32_t pr_vaddr; /* virtual address of mapping */ 6880Sstevel@tonic-gate size32_t pr_size; /* size of mapping in bytes */ 6890Sstevel@tonic-gate char pr_mapname[64]; /* name in /proc/<pid>/object */ 6900Sstevel@tonic-gate offset_t pr_offset; /* offset into mapped object, if any */ 6910Sstevel@tonic-gate int pr_mflags; /* protection and attribute flags */ 6920Sstevel@tonic-gate int pr_pagesize; /* pagesize (bytes) for this mapping */ 6930Sstevel@tonic-gate int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */ 6940Sstevel@tonic-gate int pr_filler[1]; /* filler for future expansion */ 6950Sstevel@tonic-gate } prmap32_t; 6960Sstevel@tonic-gate 6970Sstevel@tonic-gate /* 6980Sstevel@tonic-gate * _ILP32 HAT memory-map interface. /proc/<pid>/xmap 6990Sstevel@tonic-gate * 7000Sstevel@tonic-gate * The xmap structure is a Sun private interface. The existence, semantics 7010Sstevel@tonic-gate * and contents of the xmap structure are subject to arbitrary change. 7020Sstevel@tonic-gate */ 7030Sstevel@tonic-gate typedef struct prxmap32 { 7040Sstevel@tonic-gate caddr32_t pr_vaddr; /* virtual address of mapping */ 7050Sstevel@tonic-gate size32_t pr_size; /* size of mapping in bytes */ 7060Sstevel@tonic-gate char pr_mapname[PRMAPSZ]; /* name in /proc/<pid>/object */ 7070Sstevel@tonic-gate offset_t pr_offset; /* offset into mapped object, if any */ 7080Sstevel@tonic-gate int pr_mflags; /* protection and attribute flags (see below) */ 7090Sstevel@tonic-gate int pr_pagesize; /* pagesize (bytes) for this mapping */ 7100Sstevel@tonic-gate int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */ 7110Sstevel@tonic-gate dev32_t pr_dev; /* st_dev from stat64() of mapped object, or PRNODEV */ 7120Sstevel@tonic-gate uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */ 7130Sstevel@tonic-gate uint32_t pr_rss; /* pages of resident memory */ 7140Sstevel@tonic-gate uint32_t pr_anon; /* pages of resident anonymous memory */ 7150Sstevel@tonic-gate uint32_t pr_locked; /* pages of locked memory */ 7160Sstevel@tonic-gate int pr_hatpagesize; /* pagesize of the hat mapping */ 7170Sstevel@tonic-gate uint32_t pr_filler[7]; /* filler for future expansion */ 7180Sstevel@tonic-gate } prxmap32_t; 7190Sstevel@tonic-gate 7200Sstevel@tonic-gate /* 7210Sstevel@tonic-gate * _ILP32 Process credentials. PCSCRED and /proc/<pid>/cred 7220Sstevel@tonic-gate */ 7230Sstevel@tonic-gate typedef struct prcred32 { 7240Sstevel@tonic-gate uid32_t pr_euid; /* effective user id */ 7250Sstevel@tonic-gate uid32_t pr_ruid; /* real user id */ 7260Sstevel@tonic-gate uid32_t pr_suid; /* saved user id (from exec) */ 7270Sstevel@tonic-gate gid32_t pr_egid; /* effective group id */ 7280Sstevel@tonic-gate gid32_t pr_rgid; /* real group id */ 7290Sstevel@tonic-gate gid32_t pr_sgid; /* saved group id (from exec) */ 7300Sstevel@tonic-gate int pr_ngroups; /* number of supplementary groups */ 7310Sstevel@tonic-gate gid32_t pr_groups[1]; /* array of supplementary groups */ 7320Sstevel@tonic-gate } prcred32_t; 7330Sstevel@tonic-gate 7340Sstevel@tonic-gate /* 7350Sstevel@tonic-gate * _ILP32 Watchpoint interface. PCWATCH and /proc/<pid>/watch 7360Sstevel@tonic-gate */ 7370Sstevel@tonic-gate typedef struct prwatch32 { 7380Sstevel@tonic-gate caddr32_t pr_vaddr; /* virtual address of watched area */ 7390Sstevel@tonic-gate size32_t pr_size; /* size of watched area in bytes */ 7400Sstevel@tonic-gate int pr_wflags; /* watch type flags */ 7410Sstevel@tonic-gate int pr_pad; 7420Sstevel@tonic-gate } prwatch32_t; 7430Sstevel@tonic-gate 7440Sstevel@tonic-gate /* 7450Sstevel@tonic-gate * _ILP32 PCREAD/PCWRITE I/O interface. 7460Sstevel@tonic-gate */ 7470Sstevel@tonic-gate typedef struct priovec32 { 7480Sstevel@tonic-gate caddr32_t pio_base; /* buffer in controlling process */ 7490Sstevel@tonic-gate size32_t pio_len; /* size of read/write request */ 7500Sstevel@tonic-gate off32_t pio_offset; /* virtual address in target process */ 7510Sstevel@tonic-gate } priovec32_t; 7520Sstevel@tonic-gate 7530Sstevel@tonic-gate /* 7540Sstevel@tonic-gate * _ILP32 Resource usage. /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage 7550Sstevel@tonic-gate */ 7560Sstevel@tonic-gate typedef struct prusage32 { 7570Sstevel@tonic-gate id32_t pr_lwpid; /* lwp id. 0: process or defunct */ 7580Sstevel@tonic-gate int32_t pr_count; /* number of contributing lwps */ 7590Sstevel@tonic-gate timestruc32_t pr_tstamp; /* current time stamp */ 7600Sstevel@tonic-gate timestruc32_t pr_create; /* process/lwp creation time stamp */ 7610Sstevel@tonic-gate timestruc32_t pr_term; /* process/lwp termination time stamp */ 7620Sstevel@tonic-gate timestruc32_t pr_rtime; /* total lwp real (elapsed) time */ 7630Sstevel@tonic-gate timestruc32_t pr_utime; /* user level cpu time */ 7640Sstevel@tonic-gate timestruc32_t pr_stime; /* system call cpu time */ 7650Sstevel@tonic-gate timestruc32_t pr_ttime; /* other system trap cpu time */ 7660Sstevel@tonic-gate timestruc32_t pr_tftime; /* text page fault sleep time */ 7670Sstevel@tonic-gate timestruc32_t pr_dftime; /* data page fault sleep time */ 7680Sstevel@tonic-gate timestruc32_t pr_kftime; /* kernel page fault sleep time */ 7690Sstevel@tonic-gate timestruc32_t pr_ltime; /* user lock wait sleep time */ 7700Sstevel@tonic-gate timestruc32_t pr_slptime; /* all other sleep time */ 7710Sstevel@tonic-gate timestruc32_t pr_wtime; /* wait-cpu (latency) time */ 7720Sstevel@tonic-gate timestruc32_t pr_stoptime; /* stopped time */ 7730Sstevel@tonic-gate timestruc32_t filltime[6]; /* filler for future expansion */ 7740Sstevel@tonic-gate uint32_t pr_minf; /* minor page faults */ 7750Sstevel@tonic-gate uint32_t pr_majf; /* major page faults */ 7760Sstevel@tonic-gate uint32_t pr_nswap; /* swaps */ 7770Sstevel@tonic-gate uint32_t pr_inblk; /* input blocks */ 7780Sstevel@tonic-gate uint32_t pr_oublk; /* output blocks */ 7790Sstevel@tonic-gate uint32_t pr_msnd; /* messages sent */ 7800Sstevel@tonic-gate uint32_t pr_mrcv; /* messages received */ 7810Sstevel@tonic-gate uint32_t pr_sigs; /* signals received */ 7820Sstevel@tonic-gate uint32_t pr_vctx; /* voluntary context switches */ 7830Sstevel@tonic-gate uint32_t pr_ictx; /* involuntary context switches */ 7840Sstevel@tonic-gate uint32_t pr_sysc; /* system calls */ 7850Sstevel@tonic-gate uint32_t pr_ioch; /* chars read and written */ 7860Sstevel@tonic-gate uint32_t filler[10]; /* filler for future expansion */ 7870Sstevel@tonic-gate } prusage32_t; 7880Sstevel@tonic-gate 7890Sstevel@tonic-gate /* 7900Sstevel@tonic-gate * _ILP32 Page data file. /proc/<pid>/pagedata 7910Sstevel@tonic-gate */ 7920Sstevel@tonic-gate 7930Sstevel@tonic-gate /* _ILP32 page data file header */ 7940Sstevel@tonic-gate typedef struct prpageheader32 { 7950Sstevel@tonic-gate timestruc32_t pr_tstamp; /* real time stamp */ 7960Sstevel@tonic-gate int32_t pr_nmap; /* number of address space mappings */ 7970Sstevel@tonic-gate int32_t pr_npage; /* total number of pages */ 7980Sstevel@tonic-gate } prpageheader32_t; 7990Sstevel@tonic-gate 8000Sstevel@tonic-gate /* _ILP32 page data mapping header */ 8010Sstevel@tonic-gate typedef struct prasmap32 { 8020Sstevel@tonic-gate caddr32_t pr_vaddr; /* virtual address of mapping */ 8030Sstevel@tonic-gate size32_t pr_npage; /* number of pages in mapping */ 8040Sstevel@tonic-gate char pr_mapname[64]; /* name in /proc/<pid>/object */ 8050Sstevel@tonic-gate offset_t pr_offset; /* offset into mapped object, if any */ 8060Sstevel@tonic-gate int pr_mflags; /* protection and attribute flags */ 8070Sstevel@tonic-gate int pr_pagesize; /* pagesize (bytes) for this mapping */ 8080Sstevel@tonic-gate int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */ 8090Sstevel@tonic-gate int pr_filler[1]; /* filler for future expansion */ 8100Sstevel@tonic-gate } prasmap32_t; 8110Sstevel@tonic-gate 8120Sstevel@tonic-gate /* 8130Sstevel@tonic-gate * _ILP32 Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage 8140Sstevel@tonic-gate */ 8150Sstevel@tonic-gate typedef struct prheader32 { 8160Sstevel@tonic-gate int32_t pr_nent; /* number of entries */ 8170Sstevel@tonic-gate int32_t pr_entsize; /* size of each entry, in bytes */ 8180Sstevel@tonic-gate } prheader32_t; 8190Sstevel@tonic-gate 8200Sstevel@tonic-gate #endif /* _SYSCALL32 */ 8210Sstevel@tonic-gate 8220Sstevel@tonic-gate #endif /* !_KERNEL && _STRUCTURED_PROC == 0 */ 8230Sstevel@tonic-gate 8240Sstevel@tonic-gate #ifdef __cplusplus 8250Sstevel@tonic-gate } 8260Sstevel@tonic-gate #endif 8270Sstevel@tonic-gate 8280Sstevel@tonic-gate #endif /* _SYS_PROCFS_H */ 829