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 52789Sfrankho * Common Development and Distribution License (the "License"). 62789Sfrankho * 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 */ 210Sstevel@tonic-gate /* 22*4123Sdm120769 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 270Sstevel@tonic-gate /* All Rights Reserved */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifndef _SYS_PROC_PRDATA_H 310Sstevel@tonic-gate #define _SYS_PROC_PRDATA_H 320Sstevel@tonic-gate 330Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 340Sstevel@tonic-gate 350Sstevel@tonic-gate #include <sys/isa_defs.h> 360Sstevel@tonic-gate #include <sys/proc.h> 370Sstevel@tonic-gate #include <sys/vnode.h> 380Sstevel@tonic-gate #include <sys/prsystm.h> 390Sstevel@tonic-gate #include <sys/model.h> 400Sstevel@tonic-gate #include <sys/poll.h> 412789Sfrankho #include <sys/list.h> 420Sstevel@tonic-gate 430Sstevel@tonic-gate #ifdef __cplusplus 440Sstevel@tonic-gate extern "C" { 450Sstevel@tonic-gate #endif 460Sstevel@tonic-gate 470Sstevel@tonic-gate /* 480Sstevel@tonic-gate * Test for thread being stopped, not on an event of interest, 490Sstevel@tonic-gate * but with a directed stop in effect. 500Sstevel@tonic-gate */ 510Sstevel@tonic-gate #define DSTOPPED(t) \ 520Sstevel@tonic-gate ((t)->t_state == TS_STOPPED && \ 530Sstevel@tonic-gate ((t)->t_proc_flag & TP_PRSTOP)) 540Sstevel@tonic-gate 550Sstevel@tonic-gate #define round4(r) (((r) + 3) & (~3)) 560Sstevel@tonic-gate #define round8(r) (((r) + 7) & (~7)) 570Sstevel@tonic-gate #define round16(r) (((r) + 15) & (~15)) 580Sstevel@tonic-gate #define roundlong(r) (((r) + sizeof (long) - 1) & (~(sizeof (long) - 1))) 590Sstevel@tonic-gate 600Sstevel@tonic-gate #define PNSIZ 10 /* max size of /proc name entries */ 610Sstevel@tonic-gate #define PLNSIZ 10 /* max size of /proc lwp name entries */ 620Sstevel@tonic-gate 630Sstevel@tonic-gate /* 640Sstevel@tonic-gate * Common file object to which all /proc vnodes for a specific process 650Sstevel@tonic-gate * or lwp refer. One for the process, one for each lwp. 660Sstevel@tonic-gate */ 670Sstevel@tonic-gate typedef struct prcommon { 680Sstevel@tonic-gate kmutex_t prc_mutex; /* to wait for the proc/lwp to stop */ 690Sstevel@tonic-gate kcondvar_t prc_wait; /* to wait for the proc/lwp to stop */ 700Sstevel@tonic-gate ushort_t prc_flags; /* flags */ 710Sstevel@tonic-gate uint_t prc_writers; /* number of write opens of prnodes */ 720Sstevel@tonic-gate uint_t prc_selfopens; /* number of write opens by self */ 730Sstevel@tonic-gate pid_t prc_pid; /* process id */ 740Sstevel@tonic-gate model_t prc_datamodel; /* data model of the process */ 750Sstevel@tonic-gate proc_t *prc_proc; /* process being traced */ 760Sstevel@tonic-gate kthread_t *prc_thread; /* thread (lwp) being traced */ 770Sstevel@tonic-gate int prc_slot; /* procdir slot number */ 780Sstevel@tonic-gate id_t prc_tid; /* thread (lwp) id */ 790Sstevel@tonic-gate int prc_tslot; /* lwpdir slot number, -1 if reaped */ 800Sstevel@tonic-gate int prc_refcnt; /* this structure's reference count */ 810Sstevel@tonic-gate struct pollhead prc_pollhead; /* list of all pollers */ 820Sstevel@tonic-gate } prcommon_t; 830Sstevel@tonic-gate 840Sstevel@tonic-gate /* prc_flags */ 850Sstevel@tonic-gate #define PRC_DESTROY 0x01 /* process or lwp is being destroyed */ 860Sstevel@tonic-gate #define PRC_LWP 0x02 /* structure refers to an lwp */ 870Sstevel@tonic-gate #define PRC_SYS 0x04 /* process is a system process */ 880Sstevel@tonic-gate #define PRC_POLL 0x08 /* poll() in progress on this process/lwp */ 890Sstevel@tonic-gate #define PRC_EXCL 0x10 /* exclusive access granted (old /proc) */ 900Sstevel@tonic-gate 910Sstevel@tonic-gate /* 920Sstevel@tonic-gate * Macros for mapping between i-numbers and pids. 930Sstevel@tonic-gate */ 940Sstevel@tonic-gate #define pmkino(tslot, pslot, nodetype) \ 950Sstevel@tonic-gate (((((ino_t)(tslot) << nproc_highbit) | \ 960Sstevel@tonic-gate (ino_t)(pslot)) << 6) | \ 970Sstevel@tonic-gate (nodetype) + 2) 980Sstevel@tonic-gate 990Sstevel@tonic-gate /* for old /proc interface */ 1000Sstevel@tonic-gate #define PRBIAS 64 1010Sstevel@tonic-gate #define ptoi(n) ((int)(((n) + PRBIAS))) /* pid to i-number */ 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate /* 1040Sstevel@tonic-gate * Node types for /proc files (directories and files contained therein). 1050Sstevel@tonic-gate */ 1060Sstevel@tonic-gate typedef enum prnodetype { 1070Sstevel@tonic-gate PR_PROCDIR, /* /proc */ 1080Sstevel@tonic-gate PR_SELF, /* /proc/self */ 1090Sstevel@tonic-gate PR_PIDDIR, /* /proc/<pid> */ 1100Sstevel@tonic-gate PR_AS, /* /proc/<pid>/as */ 1110Sstevel@tonic-gate PR_CTL, /* /proc/<pid>/ctl */ 1120Sstevel@tonic-gate PR_STATUS, /* /proc/<pid>/status */ 1130Sstevel@tonic-gate PR_LSTATUS, /* /proc/<pid>/lstatus */ 1140Sstevel@tonic-gate PR_PSINFO, /* /proc/<pid>/psinfo */ 1150Sstevel@tonic-gate PR_LPSINFO, /* /proc/<pid>/lpsinfo */ 1160Sstevel@tonic-gate PR_MAP, /* /proc/<pid>/map */ 1170Sstevel@tonic-gate PR_RMAP, /* /proc/<pid>/rmap */ 1180Sstevel@tonic-gate PR_XMAP, /* /proc/<pid>/xmap */ 1190Sstevel@tonic-gate PR_CRED, /* /proc/<pid>/cred */ 1200Sstevel@tonic-gate PR_SIGACT, /* /proc/<pid>/sigact */ 1210Sstevel@tonic-gate PR_AUXV, /* /proc/<pid>/auxv */ 1220Sstevel@tonic-gate #if defined(__i386) || defined(__amd64) 1230Sstevel@tonic-gate PR_LDT, /* /proc/<pid>/ldt */ 1240Sstevel@tonic-gate #endif 1250Sstevel@tonic-gate PR_USAGE, /* /proc/<pid>/usage */ 1260Sstevel@tonic-gate PR_LUSAGE, /* /proc/<pid>/lusage */ 1270Sstevel@tonic-gate PR_PAGEDATA, /* /proc/<pid>/pagedata */ 1280Sstevel@tonic-gate PR_WATCH, /* /proc/<pid>/watch */ 1290Sstevel@tonic-gate PR_CURDIR, /* /proc/<pid>/cwd */ 1300Sstevel@tonic-gate PR_ROOTDIR, /* /proc/<pid>/root */ 1310Sstevel@tonic-gate PR_FDDIR, /* /proc/<pid>/fd */ 1320Sstevel@tonic-gate PR_FD, /* /proc/<pid>/fd/nn */ 1330Sstevel@tonic-gate PR_OBJECTDIR, /* /proc/<pid>/object */ 1340Sstevel@tonic-gate PR_OBJECT, /* /proc/<pid>/object/xxx */ 1350Sstevel@tonic-gate PR_LWPDIR, /* /proc/<pid>/lwp */ 1360Sstevel@tonic-gate PR_LWPIDDIR, /* /proc/<pid>/lwp/<lwpid> */ 1370Sstevel@tonic-gate PR_LWPCTL, /* /proc/<pid>/lwp/<lwpid>/lwpctl */ 1380Sstevel@tonic-gate PR_LWPSTATUS, /* /proc/<pid>/lwp/<lwpid>/lwpstatus */ 1390Sstevel@tonic-gate PR_LWPSINFO, /* /proc/<pid>/lwp/<lwpid>/lwpsinfo */ 1400Sstevel@tonic-gate PR_LWPUSAGE, /* /proc/<pid>/lwp/<lwpid>/lwpusage */ 1410Sstevel@tonic-gate PR_XREGS, /* /proc/<pid>/lwp/<lwpid>/xregs */ 1420Sstevel@tonic-gate PR_TMPLDIR, /* /proc/<pid>/lwp/<lwpid>/templates */ 1430Sstevel@tonic-gate PR_TMPL, /* /proc/<pid>/lwp/<lwpid>/templates/<id> */ 1440Sstevel@tonic-gate #if defined(__sparc) 1450Sstevel@tonic-gate PR_GWINDOWS, /* /proc/<pid>/lwp/<lwpid>/gwindows */ 1460Sstevel@tonic-gate PR_ASRS, /* /proc/<pid>/lwp/<lwpid>/asrs */ 1470Sstevel@tonic-gate #endif 1480Sstevel@tonic-gate PR_PRIV, /* /proc/<pid>/priv */ 1490Sstevel@tonic-gate PR_PATHDIR, /* /proc/<pid>/path */ 1500Sstevel@tonic-gate PR_PATH, /* /proc/<pid>/path/xxx */ 1510Sstevel@tonic-gate PR_CTDIR, /* /proc/<pid>/contracts */ 1520Sstevel@tonic-gate PR_CT, /* /proc/<pid>/contracts/<ctid> */ 1530Sstevel@tonic-gate PR_PIDFILE, /* old process file */ 1540Sstevel@tonic-gate PR_LWPIDFILE, /* old lwp file */ 1550Sstevel@tonic-gate PR_OPAGEDATA, /* old page data file */ 1560Sstevel@tonic-gate PR_NFILES /* number of /proc node types */ 1570Sstevel@tonic-gate } prnodetype_t; 1580Sstevel@tonic-gate 1590Sstevel@tonic-gate typedef struct prnode { 1600Sstevel@tonic-gate vnode_t *pr_next; /* list of all vnodes for process */ 1610Sstevel@tonic-gate uint_t pr_flags; /* private flags */ 1620Sstevel@tonic-gate kmutex_t pr_mutex; /* locks pr_files and child pr_flags */ 1630Sstevel@tonic-gate prnodetype_t pr_type; /* node type */ 1640Sstevel@tonic-gate mode_t pr_mode; /* file mode */ 1650Sstevel@tonic-gate ino_t pr_ino; /* node id (for stat(2)) */ 1660Sstevel@tonic-gate uint_t pr_hatid; /* hat layer id for page data files */ 1670Sstevel@tonic-gate prcommon_t *pr_common; /* common data structure */ 1680Sstevel@tonic-gate prcommon_t *pr_pcommon; /* process common data structure */ 1690Sstevel@tonic-gate vnode_t *pr_parent; /* parent directory */ 1700Sstevel@tonic-gate vnode_t **pr_files; /* contained files array (directory) */ 1710Sstevel@tonic-gate uint_t pr_index; /* position within parent */ 1720Sstevel@tonic-gate vnode_t *pr_pidfile; /* substitute vnode for old /proc */ 1730Sstevel@tonic-gate vnode_t *pr_realvp; /* real vnode, file in object,fd dirs */ 1740Sstevel@tonic-gate proc_t *pr_owner; /* the process that created this node */ 1750Sstevel@tonic-gate vnode_t *pr_vnode; /* pointer to vnode */ 1760Sstevel@tonic-gate struct contract *pr_contract; /* contract pointer */ 1770Sstevel@tonic-gate int pr_cttype; /* active template type */ 1780Sstevel@tonic-gate } prnode_t; 1790Sstevel@tonic-gate 1800Sstevel@tonic-gate /* 1810Sstevel@tonic-gate * Values for pr_flags. 1820Sstevel@tonic-gate */ 1830Sstevel@tonic-gate #define PR_INVAL 0x01 /* vnode is invalidated */ 1840Sstevel@tonic-gate #define PR_ISSELF 0x02 /* vnode is a self-open */ 1850Sstevel@tonic-gate #define PR_AOUT 0x04 /* vnode is for an a.out path */ 1860Sstevel@tonic-gate 1870Sstevel@tonic-gate /* 1880Sstevel@tonic-gate * Conversion macros. 1890Sstevel@tonic-gate */ 1900Sstevel@tonic-gate #define VTOP(vp) ((struct prnode *)(vp)->v_data) 1910Sstevel@tonic-gate #define PTOV(pnp) ((pnp)->pr_vnode) 1920Sstevel@tonic-gate 1930Sstevel@tonic-gate /* 1940Sstevel@tonic-gate * Flags to prlock(). 1950Sstevel@tonic-gate */ 1960Sstevel@tonic-gate #define ZNO 0 /* Fail on encountering a zombie process. */ 1970Sstevel@tonic-gate #define ZYES 1 /* Allow zombies. */ 1980Sstevel@tonic-gate 1990Sstevel@tonic-gate /* 2000Sstevel@tonic-gate * Assign one set to another (possible different sizes). 2010Sstevel@tonic-gate * 2020Sstevel@tonic-gate * Assigning to a smaller set causes members to be lost. 2030Sstevel@tonic-gate * Assigning to a larger set causes extra members to be cleared. 2040Sstevel@tonic-gate */ 2050Sstevel@tonic-gate #define prassignset(ap, sp) \ 2060Sstevel@tonic-gate { \ 2070Sstevel@tonic-gate register int _i_ = sizeof (*(ap))/sizeof (uint32_t); \ 2080Sstevel@tonic-gate while (--_i_ >= 0) \ 2090Sstevel@tonic-gate ((uint32_t *)(ap))[_i_] = \ 2100Sstevel@tonic-gate (_i_ >= sizeof (*(sp))/sizeof (uint32_t)) ? \ 2110Sstevel@tonic-gate 0 : ((uint32_t *)(sp))[_i_]; \ 2120Sstevel@tonic-gate } 2130Sstevel@tonic-gate 2140Sstevel@tonic-gate /* 2150Sstevel@tonic-gate * Determine whether or not a set (of arbitrary size) is empty. 2160Sstevel@tonic-gate */ 2170Sstevel@tonic-gate #define prisempty(sp) \ 2180Sstevel@tonic-gate setisempty((uint32_t *)(sp), \ 2190Sstevel@tonic-gate (uint_t)(sizeof (*(sp)) / sizeof (uint32_t))) 2200Sstevel@tonic-gate 2210Sstevel@tonic-gate /* 2220Sstevel@tonic-gate * Resource usage with times as hrtime_t rather than timestruc_t. 2230Sstevel@tonic-gate * Each member exactly matches the corresponding member in prusage_t. 2240Sstevel@tonic-gate * This is for convenience of internal computation. 2250Sstevel@tonic-gate */ 2260Sstevel@tonic-gate typedef struct prhusage { 2270Sstevel@tonic-gate id_t pr_lwpid; /* lwp id. 0: process or defunct */ 2280Sstevel@tonic-gate int pr_count; /* number of contributing lwps */ 2290Sstevel@tonic-gate hrtime_t pr_tstamp; /* current time stamp */ 2300Sstevel@tonic-gate hrtime_t pr_create; /* process/lwp creation time stamp */ 2310Sstevel@tonic-gate hrtime_t pr_term; /* process/lwp termination time stamp */ 2320Sstevel@tonic-gate hrtime_t pr_rtime; /* total lwp real (elapsed) time */ 2330Sstevel@tonic-gate hrtime_t pr_utime; /* user level CPU time */ 2340Sstevel@tonic-gate hrtime_t pr_stime; /* system call CPU time */ 2350Sstevel@tonic-gate hrtime_t pr_ttime; /* other system trap CPU time */ 2360Sstevel@tonic-gate hrtime_t pr_tftime; /* text page fault sleep time */ 2370Sstevel@tonic-gate hrtime_t pr_dftime; /* data page fault sleep time */ 2380Sstevel@tonic-gate hrtime_t pr_kftime; /* kernel page fault sleep time */ 2390Sstevel@tonic-gate hrtime_t pr_ltime; /* user lock wait sleep time */ 2400Sstevel@tonic-gate hrtime_t pr_slptime; /* all other sleep time */ 2410Sstevel@tonic-gate hrtime_t pr_wtime; /* wait-cpu (latency) time */ 2420Sstevel@tonic-gate hrtime_t pr_stoptime; /* stopped time */ 2430Sstevel@tonic-gate hrtime_t filltime[6]; /* filler for future expansion */ 2440Sstevel@tonic-gate uint64_t pr_minf; /* minor page faults */ 2450Sstevel@tonic-gate uint64_t pr_majf; /* major page faults */ 2460Sstevel@tonic-gate uint64_t pr_nswap; /* swaps */ 2470Sstevel@tonic-gate uint64_t pr_inblk; /* input blocks */ 2480Sstevel@tonic-gate uint64_t pr_oublk; /* output blocks */ 2490Sstevel@tonic-gate uint64_t pr_msnd; /* messages sent */ 2500Sstevel@tonic-gate uint64_t pr_mrcv; /* messages received */ 2510Sstevel@tonic-gate uint64_t pr_sigs; /* signals received */ 2520Sstevel@tonic-gate uint64_t pr_vctx; /* voluntary context switches */ 2530Sstevel@tonic-gate uint64_t pr_ictx; /* involuntary context switches */ 2540Sstevel@tonic-gate uint64_t pr_sysc; /* system calls */ 2550Sstevel@tonic-gate uint64_t pr_ioch; /* chars read and written */ 2560Sstevel@tonic-gate uint64_t filler[10]; /* filler for future expansion */ 2570Sstevel@tonic-gate } prhusage_t; 2580Sstevel@tonic-gate 2590Sstevel@tonic-gate #if defined(_KERNEL) 2600Sstevel@tonic-gate 2610Sstevel@tonic-gate /* Exclude system processes from this test */ 2620Sstevel@tonic-gate #define PROCESS_NOT_32BIT(p) \ 2630Sstevel@tonic-gate (!((p)->p_flag & SSYS) && (p)->p_as != &kas && \ 2640Sstevel@tonic-gate (p)->p_model != DATAMODEL_ILP32) 2650Sstevel@tonic-gate 2660Sstevel@tonic-gate extern int prnwatch; /* number of supported watchpoints */ 2670Sstevel@tonic-gate extern int nproc_highbit; /* highbit(v.v_nproc) */ 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate extern struct vnodeops *prvnodeops; 2700Sstevel@tonic-gate 2712789Sfrankho /* 2722789Sfrankho * Generic chained copyout buffers for procfs use. 2732789Sfrankho * In order to prevent procfs from making huge oversize kmem_alloc calls, 2742789Sfrankho * a list of smaller buffers can be concatenated and copied to userspace in 2752789Sfrankho * sequence. 2762789Sfrankho * 2772789Sfrankho * The implementation is opaque. 2782789Sfrankho * 2792789Sfrankho * A user of this will perform the following steps: 2802789Sfrankho * 2812789Sfrankho * list_t listhead; 2822789Sfrankho * struct my *mp; 2832789Sfrankho * 2842789Sfrankho * pr_iol_initlist(&listhead, sizeof (*mp), n); 2852789Sfrankho * while (whatever) { 2862789Sfrankho * mp = pr_iol_newbuf(&listhead, sizeof (*mp); 2872789Sfrankho * ... 2882789Sfrankho * error = ... 2892789Sfrankho * } 2902789Sfrankho * 2912789Sfrankho * When done, depending on whether copyout() or uiomove() is supposed to 2922789Sfrankho * be used for transferring the buffered data to userspace, call either: 2932789Sfrankho * 2942789Sfrankho * error = pr_iol_copyout_and_free(&listhead, &cmaddr, error); 2952789Sfrankho * 2962789Sfrankho * or else: 2972789Sfrankho * 2982789Sfrankho * error = pr_iol_uiomove_and_free(&listhead, uiop, error); 2992789Sfrankho * 3002789Sfrankho * These two functions will in any case kmem_free() all list items, but 3012789Sfrankho * if an error occurred before they will not perform the copyout/uiomove. 3022789Sfrankho * If copyout/uiomove are done, the passed target address / uio_t 3032789Sfrankho * are updated. The error returned will either be the one passed in, or 3042789Sfrankho * the error that occurred during copyout/uiomove. 3052789Sfrankho */ 3062789Sfrankho 3072789Sfrankho extern void pr_iol_initlist(list_t *head, size_t itemsize, int nitems); 3082789Sfrankho extern void * pr_iol_newbuf(list_t *head, size_t itemsize); 3092789Sfrankho extern int pr_iol_copyout_and_free(list_t *head, caddr_t *tgt, int errin); 3102789Sfrankho extern int pr_iol_uiomove_and_free(list_t *head, uio_t *uiop, int errin); 3112789Sfrankho 3120Sstevel@tonic-gate #if defined(_SYSCALL32_IMPL) 3130Sstevel@tonic-gate 3140Sstevel@tonic-gate extern int prwritectl32(vnode_t *, struct uio *, cred_t *); 3150Sstevel@tonic-gate extern void prgetaction32(proc_t *, user_t *, uint_t, struct sigaction32 *); 3160Sstevel@tonic-gate extern void prcvtusage32(struct prhusage *, prusage32_t *); 3170Sstevel@tonic-gate 3180Sstevel@tonic-gate #endif /* _SYSCALL32_IMPL */ 3190Sstevel@tonic-gate 3200Sstevel@tonic-gate /* kludge to support old /proc interface */ 3210Sstevel@tonic-gate #if !defined(_SYS_OLD_PROCFS_H) 3222789Sfrankho extern int prgetmap(proc_t *, int, list_t *); 3232789Sfrankho extern int prgetxmap(proc_t *, list_t *); 3240Sstevel@tonic-gate #if defined(_SYSCALL32_IMPL) 3252789Sfrankho extern int prgetmap32(proc_t *, int, list_t *); 3262789Sfrankho extern int prgetxmap32(proc_t *, list_t *); 3270Sstevel@tonic-gate #endif /* _SYSCALL32_IMPL */ 3280Sstevel@tonic-gate #endif /* !_SYS_OLD_PROCFS_H */ 3290Sstevel@tonic-gate 3300Sstevel@tonic-gate extern proc_t *pr_p_lock(prnode_t *); 3310Sstevel@tonic-gate extern kthread_t *pr_thread(prnode_t *); 3320Sstevel@tonic-gate extern void pr_stop(prnode_t *); 3330Sstevel@tonic-gate extern int pr_wait_stop(prnode_t *, time_t); 3340Sstevel@tonic-gate extern int pr_setrun(prnode_t *, ulong_t); 335*4123Sdm120769 extern int pr_wait(prcommon_t *, timestruc_t *, int); 3360Sstevel@tonic-gate extern void pr_wait_die(prnode_t *); 3370Sstevel@tonic-gate extern int pr_setsig(prnode_t *, siginfo_t *); 3380Sstevel@tonic-gate extern int pr_kill(prnode_t *, int, cred_t *); 3390Sstevel@tonic-gate extern int pr_unkill(prnode_t *, int); 3400Sstevel@tonic-gate extern int pr_nice(proc_t *, int, cred_t *); 3410Sstevel@tonic-gate extern void pr_setentryexit(proc_t *, sysset_t *, int); 3420Sstevel@tonic-gate extern int pr_set(proc_t *, long); 3430Sstevel@tonic-gate extern int pr_unset(proc_t *, long); 3440Sstevel@tonic-gate extern void pr_sethold(prnode_t *, sigset_t *); 3450Sstevel@tonic-gate extern void pr_setfault(proc_t *, fltset_t *); 3460Sstevel@tonic-gate extern int prusrio(proc_t *, enum uio_rw, struct uio *, int); 3470Sstevel@tonic-gate extern int prwritectl(vnode_t *, struct uio *, cred_t *); 3480Sstevel@tonic-gate extern int prlock(prnode_t *, int); 3490Sstevel@tonic-gate extern void prunmark(proc_t *); 3500Sstevel@tonic-gate extern void prunlock(prnode_t *); 3510Sstevel@tonic-gate extern size_t prpdsize(struct as *); 3520Sstevel@tonic-gate extern int prpdread(proc_t *, uint_t, struct uio *); 3530Sstevel@tonic-gate extern size_t oprpdsize(struct as *); 3540Sstevel@tonic-gate extern int oprpdread(struct as *, uint_t, struct uio *); 3550Sstevel@tonic-gate extern void prgetaction(proc_t *, user_t *, uint_t, struct sigaction *); 3560Sstevel@tonic-gate extern void prgetusage(kthread_t *, struct prhusage *); 3570Sstevel@tonic-gate extern void praddusage(kthread_t *, struct prhusage *); 3580Sstevel@tonic-gate extern void prcvtusage(struct prhusage *, prusage_t *); 3590Sstevel@tonic-gate extern void prscaleusage(prhusage_t *); 3600Sstevel@tonic-gate extern kthread_t *prchoose(proc_t *); 3610Sstevel@tonic-gate extern void allsetrun(proc_t *); 3620Sstevel@tonic-gate extern int setisempty(uint32_t *, uint_t); 3630Sstevel@tonic-gate extern int pr_u32tos(uint32_t, char *, int); 3640Sstevel@tonic-gate extern vnode_t *prlwpnode(prnode_t *, uint_t); 3650Sstevel@tonic-gate extern prnode_t *prgetnode(vnode_t *, prnodetype_t); 3660Sstevel@tonic-gate extern void prfreenode(prnode_t *); 3670Sstevel@tonic-gate extern void pr_object_name(char *, vnode_t *, struct vattr *); 3680Sstevel@tonic-gate extern int set_watched_area(proc_t *, struct watched_area *); 3690Sstevel@tonic-gate extern int clear_watched_area(proc_t *, struct watched_area *); 3700Sstevel@tonic-gate extern void pr_free_watchpoints(proc_t *); 3710Sstevel@tonic-gate extern proc_t *pr_cancel_watch(prnode_t *); 3720Sstevel@tonic-gate extern struct seg *break_seg(proc_t *); 3730Sstevel@tonic-gate 3740Sstevel@tonic-gate /* 3750Sstevel@tonic-gate * Machine-dependent routines (defined in prmachdep.c). 3760Sstevel@tonic-gate */ 3770Sstevel@tonic-gate extern void prgetprregs(klwp_t *, prgregset_t); 3780Sstevel@tonic-gate extern void prsetprregs(klwp_t *, prgregset_t, int); 3790Sstevel@tonic-gate 3800Sstevel@tonic-gate #if defined(_SYSCALL32_IMPL) 3810Sstevel@tonic-gate extern void prgetprregs32(klwp_t *, prgregset32_t); 3820Sstevel@tonic-gate extern void prgregset_32ton(klwp_t *, prgregset32_t, prgregset_t); 3830Sstevel@tonic-gate extern void prgetprfpregs32(klwp_t *, prfpregset32_t *); 3840Sstevel@tonic-gate extern void prsetprfpregs32(klwp_t *, prfpregset32_t *); 3850Sstevel@tonic-gate extern size_t prpdsize32(struct as *); 3860Sstevel@tonic-gate extern int prpdread32(proc_t *, uint_t, struct uio *); 3870Sstevel@tonic-gate extern size_t oprpdsize32(struct as *); 3880Sstevel@tonic-gate extern int oprpdread32(struct as *, uint_t, struct uio *); 3890Sstevel@tonic-gate #endif /* _SYSCALL32_IMPL */ 3900Sstevel@tonic-gate 3910Sstevel@tonic-gate extern void prpokethread(kthread_t *t); 3920Sstevel@tonic-gate extern int prgetrvals(klwp_t *, long *, long *); 3930Sstevel@tonic-gate extern void prgetprfpregs(klwp_t *, prfpregset_t *); 3940Sstevel@tonic-gate extern void prsetprfpregs(klwp_t *, prfpregset_t *); 3950Sstevel@tonic-gate extern void prgetprxregs(klwp_t *, caddr_t); 3960Sstevel@tonic-gate extern void prsetprxregs(klwp_t *, caddr_t); 3970Sstevel@tonic-gate extern int prgetprxregsize(proc_t *); 3980Sstevel@tonic-gate extern int prhasfp(void); 3990Sstevel@tonic-gate extern int prhasx(proc_t *); 4000Sstevel@tonic-gate extern caddr_t prgetstackbase(proc_t *); 4010Sstevel@tonic-gate extern caddr_t prgetpsaddr(proc_t *); 4020Sstevel@tonic-gate extern int prisstep(klwp_t *); 4030Sstevel@tonic-gate extern void prsvaddr(klwp_t *, caddr_t); 4040Sstevel@tonic-gate extern int prfetchinstr(klwp_t *, ulong_t *); 4050Sstevel@tonic-gate extern ushort_t prgetpctcpu(uint64_t); 4060Sstevel@tonic-gate 4070Sstevel@tonic-gate #endif /* _KERNEL */ 4080Sstevel@tonic-gate 4090Sstevel@tonic-gate #ifdef __cplusplus 4100Sstevel@tonic-gate } 4110Sstevel@tonic-gate #endif 4120Sstevel@tonic-gate 4130Sstevel@tonic-gate #endif /* _SYS_PROC_PRDATA_H */ 414