xref: /onnv-gate/usr/src/lib/libproc/common/llib-lproc (revision 0:68f95e015346)
1*0Sstevel@tonic-gate/*
2*0Sstevel@tonic-gate * CDDL HEADER START
3*0Sstevel@tonic-gate *
4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate * with the License.
8*0Sstevel@tonic-gate *
9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate * and limitations under the License.
13*0Sstevel@tonic-gate *
14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate *
20*0Sstevel@tonic-gate * CDDL HEADER END
21*0Sstevel@tonic-gate */
22*0Sstevel@tonic-gate/* LINTLIBRARY */
23*0Sstevel@tonic-gate/* PROTOLIB1 */
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gate/*
26*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
27*0Sstevel@tonic-gate * Use is subject to license terms.
28*0Sstevel@tonic-gate */
29*0Sstevel@tonic-gate#pragma ident	"%Z%%M%	%I%	%E% SMI"
30*0Sstevel@tonic-gate
31*0Sstevel@tonic-gate#include "libproc.h"
32*0Sstevel@tonic-gate
33*0Sstevel@tonic-gate/*
34*0Sstevel@tonic-gate * usr/src/lib/libproc
35*0Sstevel@tonic-gate */
36*0Sstevel@tonic-gate
37*0Sstevel@tonic-gate/* Pcontrol.c */
38*0Sstevel@tonic-gateint	_libproc_debug;
39*0Sstevel@tonic-gatestruct ps_prochandle *Pcreate(const char *file, char *const *argv,
40*0Sstevel@tonic-gate		int *perr, char *path, size_t len);
41*0Sstevel@tonic-gateconst char *Pcreate_error(int error);
42*0Sstevel@tonic-gatevoid	Pcreate_callback(struct ps_prochandle *Pr);
43*0Sstevel@tonic-gatestruct ps_prochandle *Pgrab(pid_t pid, int gflag, int *perr);
44*0Sstevel@tonic-gateconst char *Pgrab_error(int error);
45*0Sstevel@tonic-gatevoid	Pfree(struct ps_prochandle *Pr);
46*0Sstevel@tonic-gateint	Pstate(struct ps_prochandle *Pr);
47*0Sstevel@tonic-gateint	Pasfd(struct ps_prochandle *Pr);
48*0Sstevel@tonic-gateint	Pctlfd(struct ps_prochandle *Pr);
49*0Sstevel@tonic-gateconst psinfo_t *Ppsinfo(struct ps_prochandle *Pr);
50*0Sstevel@tonic-gateconst pstatus_t *Pstatus(struct ps_prochandle *Pr);
51*0Sstevel@tonic-gateint	Pcred(struct ps_prochandle *Pr, prcred_t *pcrp, int ngroups);
52*0Sstevel@tonic-gatessize_t	Ppriv(struct ps_prochandle *Pr, prpriv_t *pprivp, size_t);
53*0Sstevel@tonic-gatevoid	Psync(struct ps_prochandle *Pr);
54*0Sstevel@tonic-gateint	Pcreate_agent(struct ps_prochandle *Pr);
55*0Sstevel@tonic-gatevoid	Pdestroy_agent(struct ps_prochandle *Pr);
56*0Sstevel@tonic-gateint	Preopen(struct ps_prochandle *Pr);
57*0Sstevel@tonic-gatevoid	Prelease(struct ps_prochandle *Pr, int flags);
58*0Sstevel@tonic-gateint	Pstopstatus(struct ps_prochandle *Pr, long cmd, uint_t msec);
59*0Sstevel@tonic-gateint	Pwait(struct ps_prochandle *Pr, uint_t msec);
60*0Sstevel@tonic-gateint	Pstop(struct ps_prochandle *Pr, uint_t msec);
61*0Sstevel@tonic-gateint	Pdstop(struct ps_prochandle *Pr);
62*0Sstevel@tonic-gateint	Pgetareg(struct ps_prochandle *Pr, int regno, prgreg_t *preg);
63*0Sstevel@tonic-gateint	Pputareg(struct ps_prochandle *Pr, int regno, prgreg_t reg);
64*0Sstevel@tonic-gateint	Psetrun(struct ps_prochandle *Pr, int sig, int flags);
65*0Sstevel@tonic-gatessize_t	Pread(struct ps_prochandle *Pr,
66*0Sstevel@tonic-gate		void *buf, size_t nbyte, uintptr_t address);
67*0Sstevel@tonic-gatessize_t	Pread_string(struct ps_prochandle *Pr,
68*0Sstevel@tonic-gate		char *buf, size_t nbyte, uintptr_t address);
69*0Sstevel@tonic-gatessize_t	Pwrite(struct ps_prochandle *Pr,
70*0Sstevel@tonic-gate		const void *buf, size_t nbyte, uintptr_t address);
71*0Sstevel@tonic-gateint	Pclearsig(struct ps_prochandle *Pr);
72*0Sstevel@tonic-gateint	Pclearfault(struct ps_prochandle *Pr);
73*0Sstevel@tonic-gateint	Psetbkpt(struct ps_prochandle *Pr, uintptr_t address, ulong_t *saved);
74*0Sstevel@tonic-gateint	Pdelbkpt(struct ps_prochandle *Pr, uintptr_t address, ulong_t saved);
75*0Sstevel@tonic-gateint	Pxecbkpt(struct ps_prochandle *Pr, ulong_t saved);
76*0Sstevel@tonic-gateint	Psetwapt(struct ps_prochandle *Pr, const prwatch_t *wp);
77*0Sstevel@tonic-gateint	Pdelwapt(struct ps_prochandle *Pr, const prwatch_t *wp);
78*0Sstevel@tonic-gateint	Pxecwapt(struct ps_prochandle *Pr, const prwatch_t *wp);
79*0Sstevel@tonic-gateint	Psetflags(struct ps_prochandle *Pr, long flags);
80*0Sstevel@tonic-gateint	Punsetflags(struct ps_prochandle *Pr, long flags);
81*0Sstevel@tonic-gateint	Psignal(struct ps_prochandle *Pr, int which, int stop);
82*0Sstevel@tonic-gatevoid	Psetsignal(struct ps_prochandle *Pr, const sigset_t *set);
83*0Sstevel@tonic-gateint	Pfault(struct ps_prochandle *Pr, int which, int stop);
84*0Sstevel@tonic-gatevoid	Psetfault(struct ps_prochandle *Pr, const fltset_t *set);
85*0Sstevel@tonic-gateint	Psysentry(struct ps_prochandle *Pr, int which, int stop);
86*0Sstevel@tonic-gatevoid	Psetsysentry(struct ps_prochandle *Pr, const sysset_t *set);
87*0Sstevel@tonic-gateint	Psysexit(struct ps_prochandle *Pr, int which, int stop);
88*0Sstevel@tonic-gatevoid	Psetsysexit(struct ps_prochandle *Pr, const sysset_t *set);
89*0Sstevel@tonic-gateint	Plwp_iter(struct ps_prochandle *Pr, proc_lwp_f *func, void *cd);
90*0Sstevel@tonic-gateint	Psyscall(struct ps_prochandle *Pr, sysret_t *,
91*0Sstevel@tonic-gate		int sysindex, uint_t nargs, argdes_t *argp);
92*0Sstevel@tonic-gate
93*0Sstevel@tonic-gatestruct ps_lwphandle *Lgrab(struct ps_prochandle *P, lwpid_t lwpid, int *perr);
94*0Sstevel@tonic-gateconst char *Lgrab_error(int error);
95*0Sstevel@tonic-gatestruct ps_prochandle *Lprochandle(struct ps_lwphandle *Lwp);
96*0Sstevel@tonic-gatevoid	Lfree(struct ps_lwphandle *Lwp);
97*0Sstevel@tonic-gateint	Lctlfd(struct ps_lwphandle *Lwp);
98*0Sstevel@tonic-gateint	Lwait(struct ps_lwphandle *Lwp, uint_t msec);
99*0Sstevel@tonic-gateint	Lstop(struct ps_lwphandle *Lwp, uint_t msec);
100*0Sstevel@tonic-gateint	Ldstop(struct ps_lwphandle *Lwp);
101*0Sstevel@tonic-gateint	Lstate(struct ps_lwphandle *Lwp);
102*0Sstevel@tonic-gateconst lwpsinfo_t *Lpsinfo(struct ps_lwphandle *Lwp);
103*0Sstevel@tonic-gateconst lwpstatus_t *Lstatus(struct ps_lwphandle *Lwp);
104*0Sstevel@tonic-gateint	Lgetareg(struct ps_lwphandle *Lwp, int regno, prgreg_t *preg);
105*0Sstevel@tonic-gateint	Lputareg(struct ps_lwphandle *Lwp, int regno, prgreg_t reg);
106*0Sstevel@tonic-gateint	Lsetrun(struct ps_lwphandle *Lwp, int sig, int flags);
107*0Sstevel@tonic-gateint	Lclearsig(struct ps_lwphandle *Lwp);
108*0Sstevel@tonic-gateint	Lclearfault(struct ps_lwphandle *Lwp);
109*0Sstevel@tonic-gateint	Lxecbkpt(struct ps_lwphandle *Lwp, ulong_t saved);
110*0Sstevel@tonic-gateint	Lxecwapt(struct ps_lwphandle *Lwp, const prwatch_t *wp);
111*0Sstevel@tonic-gatevoid	Lsync(struct ps_lwphandle *Lwp);
112*0Sstevel@tonic-gate
113*0Sstevel@tonic-gate/* Plwpregs.c */
114*0Sstevel@tonic-gateint Plwp_getregs(struct ps_prochandle *Pr, lwpid_t i, prgregset_t gr);
115*0Sstevel@tonic-gateint Plwp_setregs(struct ps_prochandle *Pr, lwpid_t i, const prgregset_t gr);
116*0Sstevel@tonic-gateint Plwp_getfpregs(struct ps_prochandle *Pr, lwpid_t i, prfpregset_t *fp);
117*0Sstevel@tonic-gateint Plwp_setfpregs(struct ps_prochandle *Pr, lwpid_t i, const prfpregset_t *fp);
118*0Sstevel@tonic-gate#if defined(sparc) || defined(__sparc)
119*0Sstevel@tonic-gateint Plwp_getxregs(struct ps_prochandle *Pr, lwpid_t i, prxregset_t *xr);
120*0Sstevel@tonic-gateint Plwp_setxregs(struct ps_prochandle *Pr, lwpid_t i, const prxregset_t *xr);
121*0Sstevel@tonic-gate#if defined(__sparcv9)
122*0Sstevel@tonic-gateint Plwp_getasrs(struct ps_prochandle *Pr, lwpid_t i, asrset_t asrs);
123*0Sstevel@tonic-gateint Plwp_setasrs(struct ps_prochandle *Pr, lwpid_t i, const asrset_t asrs);
124*0Sstevel@tonic-gate#endif  /* __sparcv9 */
125*0Sstevel@tonic-gate#endif  /* __sparc */
126*0Sstevel@tonic-gateint Plwp_getpsinfo(struct ps_prochandle *Pr, lwpid_t i, lwpsinfo_t *lps);
127*0Sstevel@tonic-gate
128*0Sstevel@tonic-gate/* Pcore.c */
129*0Sstevel@tonic-gatestruct ps_prochandle *Pfgrab_core(int fd, const char *aout, int *perr);
130*0Sstevel@tonic-gatestruct ps_prochandle *Pgrab_core(const char *core, const char *aout,
131*0Sstevel@tonic-gate	int gflag, int *perr);
132*0Sstevel@tonic-gate
133*0Sstevel@tonic-gate/* Pisprocdir.c */
134*0Sstevel@tonic-gateint	Pisprocdir(struct ps_prochandle *Pr, const char *dir);
135*0Sstevel@tonic-gate
136*0Sstevel@tonic-gate/* Pservice.c */
137*0Sstevel@tonic-gateps_err_e ps_pdmodel(struct ps_prochandle *Pr, int *modelp);
138*0Sstevel@tonic-gateps_err_e ps_pread(struct ps_prochandle *Pr,
139*0Sstevel@tonic-gate		psaddr_t addr, void *buf, size_t size);
140*0Sstevel@tonic-gateps_err_e ps_pwrite(struct ps_prochandle *Pr,
141*0Sstevel@tonic-gate		psaddr_t addr, const void *buf, size_t size);
142*0Sstevel@tonic-gateps_err_e ps_pdread(struct ps_prochandle *Pr,
143*0Sstevel@tonic-gate		psaddr_t addr, void *buf, size_t size);
144*0Sstevel@tonic-gateps_err_e ps_pdwrite(struct ps_prochandle *Pr,
145*0Sstevel@tonic-gate		psaddr_t addr, const void *buf, size_t size);
146*0Sstevel@tonic-gateps_err_e ps_ptread(struct ps_prochandle *Pr,
147*0Sstevel@tonic-gate		psaddr_t addr, void *buf, size_t size);
148*0Sstevel@tonic-gateps_err_e ps_ptwrite(struct ps_prochandle *Pr,
149*0Sstevel@tonic-gate		psaddr_t addr, const void *buf, size_t size);
150*0Sstevel@tonic-gateps_err_e ps_pstop(struct ps_prochandle *Pr);
151*0Sstevel@tonic-gateps_err_e ps_pcontinue(struct ps_prochandle *Pr);
152*0Sstevel@tonic-gateps_err_e ps_lstop(struct ps_prochandle *Pr, lwpid_t lwpid);
153*0Sstevel@tonic-gateps_err_e ps_lcontinue(struct ps_prochandle *Pr, lwpid_t lwpid);
154*0Sstevel@tonic-gateps_err_e ps_lgetregs(struct ps_prochandle *Pr,
155*0Sstevel@tonic-gate		lwpid_t lwpid, prgregset_t regs);
156*0Sstevel@tonic-gateps_err_e ps_lsetregs(struct ps_prochandle *Pr,
157*0Sstevel@tonic-gate		lwpid_t lwpid, const prgregset_t regs);
158*0Sstevel@tonic-gateps_err_e ps_lgetfpregs(struct ps_prochandle *Pr,
159*0Sstevel@tonic-gate		lwpid_t lwpid, prfpregset_t *regs);
160*0Sstevel@tonic-gateps_err_e ps_lsetfpregs(struct ps_prochandle *Pr,
161*0Sstevel@tonic-gate		lwpid_t lwpid, const prfpregset_t *regs);
162*0Sstevel@tonic-gate#if defined(sparc) || defined(__sparc)
163*0Sstevel@tonic-gateps_err_e ps_lgetxregsize(struct ps_prochandle *Pr,
164*0Sstevel@tonic-gate		lwpid_t lwpid, int *xrsize);
165*0Sstevel@tonic-gateps_err_e ps_lgetxregs(struct ps_prochandle *Pr,
166*0Sstevel@tonic-gate		lwpid_t lwpid, caddr_t xregs);
167*0Sstevel@tonic-gateps_err_e ps_lsetxregs(struct ps_prochandle *Pr,
168*0Sstevel@tonic-gate		lwpid_t lwpid, caddr_t xregs);
169*0Sstevel@tonic-gate#endif	/* sparc */
170*0Sstevel@tonic-gate#if defined(__i386) || defined(__amd64)
171*0Sstevel@tonic-gateps_err_e ps_lgetLDT(struct ps_prochandle *Pr,
172*0Sstevel@tonic-gate		lwpid_t lwpid, struct ssd *ldt);
173*0Sstevel@tonic-gate#endif	/* __i386 || __amd6464 */
174*0Sstevel@tonic-gatevoid	ps_plog(const char *fmt, ...);
175*0Sstevel@tonic-gate
176*0Sstevel@tonic-gate/* Psymtab.c */
177*0Sstevel@tonic-gatevoid	Pupdate_maps(struct ps_prochandle *Pr);
178*0Sstevel@tonic-gatevoid	Pupdate_syms(struct ps_prochandle *Pr);
179*0Sstevel@tonic-gaterd_agent_t *Prd_agent(struct ps_prochandle *Pr);
180*0Sstevel@tonic-gateconst prmap_t *Paddr_to_map(struct ps_prochandle *Pr, uintptr_t addr);
181*0Sstevel@tonic-gateconst prmap_t *Paddr_to_text_map(struct ps_prochandle *Pr, uintptr_t addr);
182*0Sstevel@tonic-gateconst prmap_t *Pname_to_map(struct ps_prochandle *Pr, const char *name);
183*0Sstevel@tonic-gateconst prmap_t *Plmid_to_map(struct ps_prochandle *Pr, Lmid_t lmid,
184*0Sstevel@tonic-gate		const char *name);
185*0Sstevel@tonic-gateint	Plookup_by_addr(struct ps_prochandle *Pr, uintptr_t addr,
186*0Sstevel@tonic-gate		char *sym_name_buffer, size_t bufsize, GElf_Sym *symbolp);
187*0Sstevel@tonic-gateint	Plookup_by_name(struct ps_prochandle *Pr,
188*0Sstevel@tonic-gate		const char *object_name, const char *symbol_name,
189*0Sstevel@tonic-gate		GElf_Sym *sym);
190*0Sstevel@tonic-gateint	Plookup_by_lmid(struct ps_prochandle *Pr,
191*0Sstevel@tonic-gate		Lmid_t lmid, const char *object_name, const char *symbol_name,
192*0Sstevel@tonic-gate		GElf_Sym *sym);
193*0Sstevel@tonic-gateconst rd_loadobj_t *Paddr_to_loadobj(struct ps_prochandle *, uintptr_t);
194*0Sstevel@tonic-gateconst rd_loadobj_t *Pname_to_loadobj(struct ps_prochandle *, const char *);
195*0Sstevel@tonic-gateconst rd_loadobj_t *Plmid_to_loadobj(struct ps_prochandle *, Lmid_t,
196*0Sstevel@tonic-gate		const char *);
197*0Sstevel@tonic-gateint	Pmapping_iter(struct ps_prochandle *Pr, proc_map_f *func, void *cd);
198*0Sstevel@tonic-gateint	Pobject_iter(struct ps_prochandle *Pr, proc_map_f *func, void *cd);
199*0Sstevel@tonic-gatechar	*Pobjname(struct ps_prochandle *Pr, uintptr_t addr,
200*0Sstevel@tonic-gate		char *buffer, size_t bufsize);
201*0Sstevel@tonic-gateint	Plmid(struct ps_prochandle *Pr, uintptr_t addr, Lmid_t *lmidp);
202*0Sstevel@tonic-gateint	Psymbol_iter(struct ps_prochandle *Pr, const char *object_name,
203*0Sstevel@tonic-gate		int which, int type, proc_sym_f *func, void *cd);
204*0Sstevel@tonic-gateint	Psymbol_iter_by_lmid(struct ps_prochandle *Pr, Lmid_t lmid,
205*0Sstevel@tonic-gate		const char *object_name, int which, int type,
206*0Sstevel@tonic-gate		proc_sym_f *func, void *cd);
207*0Sstevel@tonic-gatechar	*Pgetenv(struct ps_prochandle *Pr, const char *name,
208*0Sstevel@tonic-gate		char *buffer, size_t bufsize);
209*0Sstevel@tonic-gatechar	*Pplatform(struct ps_prochandle *Pr, char *s, size_t n);
210*0Sstevel@tonic-gateint	Puname(struct ps_prochandle *Pr, struct utsname *u);
211*0Sstevel@tonic-gatechar	*Pzonename(struct ps_prochandle *Pr, char *s, size_t n);
212*0Sstevel@tonic-gatechar	*Pexecname(struct ps_prochandle *Pr, char *buffer, size_t bufsize);
213*0Sstevel@tonic-gatevoid	Preset_maps(struct ps_prochandle *Pr);
214*0Sstevel@tonic-gate
215*0Sstevel@tonic-gateps_err_e ps_pglobal_lookup(struct ps_prochandle *Pr,
216*0Sstevel@tonic-gate		const char *object_name, const char *sym_name,
217*0Sstevel@tonic-gate		psaddr_t *sym_addr);
218*0Sstevel@tonic-gate
219*0Sstevel@tonic-gateps_err_e ps_pglobal_sym(struct ps_prochandle *Pr,
220*0Sstevel@tonic-gate		const char *object_name, const char *sym_name,
221*0Sstevel@tonic-gate		ps_sym_t *symp);
222*0Sstevel@tonic-gate
223*0Sstevel@tonic-gatelong	Pgetauxval(struct ps_prochandle *Pr, int type);
224*0Sstevel@tonic-gateconst auxv_t *Pgetauxvec(struct ps_prochandle *Pr);
225*0Sstevel@tonic-gateps_err_e ps_pauxv(struct ps_prochandle *Pr, const auxv_t **aux);
226*0Sstevel@tonic-gate
227*0Sstevel@tonic-gate/* Putil.c */
228*0Sstevel@tonic-gatevoid	Perror_printf(struct ps_prochandle *Pr, const char *format, ...);
229*0Sstevel@tonic-gate
230*0Sstevel@tonic-gate/* pr_door.c */
231*0Sstevel@tonic-gateint	pr_door_info(struct ps_prochandle *Pr, int did, door_info_t *di);
232*0Sstevel@tonic-gate
233*0Sstevel@tonic-gate/* pr_exit.c */
234*0Sstevel@tonic-gateint	pr_exit(struct ps_prochandle *Pr, int status);
235*0Sstevel@tonic-gateint	pr_lwp_exit(struct ps_prochandle *Pr);
236*0Sstevel@tonic-gate
237*0Sstevel@tonic-gate/* pr_fcntl.c */
238*0Sstevel@tonic-gateint	pr_fcntl(struct ps_prochandle *Pr, int fd, int cmd, void *argp);
239*0Sstevel@tonic-gate
240*0Sstevel@tonic-gate/* pr_getitimer.c */
241*0Sstevel@tonic-gateint	pr_getitimer(struct ps_prochandle *Pr,
242*0Sstevel@tonic-gate		int which, struct itimerval *itv);
243*0Sstevel@tonic-gateint	pr_setitimer(struct ps_prochandle *Pr,
244*0Sstevel@tonic-gate		int which, const struct itimerval *itv, struct itimerval *oitv);
245*0Sstevel@tonic-gate
246*0Sstevel@tonic-gate/* pr_getrctl.c */
247*0Sstevel@tonic-gateint	pr_getrctl(struct ps_prochandle *Pr, const char *rname,
248*0Sstevel@tonic-gate		rctlblk_t *old_blk, rctlblk_t *new_blk, int rflag);
249*0Sstevel@tonic-gateint   pr_setrctl(struct ps_prochandle *Pr, const char *rname,
250*0Sstevel@tonic-gate		rctlblk_t *old_blk, rctlblk_t *new_blk, int rflag);
251*0Sstevel@tonic-gate
252*0Sstevel@tonic-gate/* pr_getrlimit.c */
253*0Sstevel@tonic-gateint	pr_getrlimit(struct ps_prochandle *Pr,
254*0Sstevel@tonic-gate		int resource, struct rlimit *rlp);
255*0Sstevel@tonic-gateint	pr_setrlimit(struct ps_prochandle *Pr,
256*0Sstevel@tonic-gate		int resource, const struct rlimit *rlp);
257*0Sstevel@tonic-gateint	pr_getrlimit64(struct ps_prochandle *Pr,
258*0Sstevel@tonic-gate		int resource, struct rlimit64 *rlp);
259*0Sstevel@tonic-gateint	pr_setrlimit64(struct ps_prochandle *Pr,
260*0Sstevel@tonic-gate		int resource, const struct rlimit64 *rlp);
261*0Sstevel@tonic-gate
262*0Sstevel@tonic-gate/* pr_getsockname.c */
263*0Sstevel@tonic-gateint	pr_getsockname(struct ps_prochandle *Pr,
264*0Sstevel@tonic-gate		int sock, struct sockaddr *name, socklen_t *namelen);
265*0Sstevel@tonic-gateint	pr_getpeername(struct ps_prochandle *Pr,
266*0Sstevel@tonic-gate		int sock, struct sockaddr *name, socklen_t *namelen);
267*0Sstevel@tonic-gate
268*0Sstevel@tonic-gate/* pr_ioctl.c */
269*0Sstevel@tonic-gateint	pr_ioctl(struct ps_prochandle *Pr,
270*0Sstevel@tonic-gate		int fd, int code, void *buf, size_t size);
271*0Sstevel@tonic-gate
272*0Sstevel@tonic-gate/* pr_lseek.c */
273*0Sstevel@tonic-gateoff_t	pr_lseek(struct ps_prochandle *Pr,
274*0Sstevel@tonic-gate		int filedes, off_t offset, int whence);
275*0Sstevel@tonic-gateoffset_t pr_llseek(struct ps_prochandle *Pr,
276*0Sstevel@tonic-gate		int filedes, offset_t offset, int whence);
277*0Sstevel@tonic-gate
278*0Sstevel@tonic-gate/* pr_memcntl.c */
279*0Sstevel@tonic-gateint	pr_memcntl(struct ps_prochandle *Pr,
280*0Sstevel@tonic-gate	caddr_t addr, size_t len, int cmd, caddr_t arg, int attr, int mask);
281*0Sstevel@tonic-gate
282*0Sstevel@tonic-gate/* pr_mmap.c */
283*0Sstevel@tonic-gatevoid	*pr_mmap(struct ps_prochandle *Pr,
284*0Sstevel@tonic-gate		void *addr, size_t len, int prot, int flags, int fd, off_t off);
285*0Sstevel@tonic-gateint	pr_munmap(struct ps_prochandle *Pr,
286*0Sstevel@tonic-gate		void *addr, size_t len);
287*0Sstevel@tonic-gatevoid	*pr_zmap(struct ps_prochandle *Pr,
288*0Sstevel@tonic-gate		void *addr, size_t len, int prot, int flags);
289*0Sstevel@tonic-gate
290*0Sstevel@tonic-gate/* pr_open.c */
291*0Sstevel@tonic-gateint	pr_open(struct ps_prochandle *Pr,
292*0Sstevel@tonic-gate		const char *filename, int flags, mode_t mode);
293*0Sstevel@tonic-gateint	pr_creat(struct ps_prochandle *Pr,
294*0Sstevel@tonic-gate		const char *filename, mode_t mode);
295*0Sstevel@tonic-gateint	pr_close(struct ps_prochandle *Pr, int fd);
296*0Sstevel@tonic-gateint	pr_access(struct ps_prochandle *Pr, const char *path, int amode);
297*0Sstevel@tonic-gate
298*0Sstevel@tonic-gate/* pr_pbind.c */
299*0Sstevel@tonic-gateint	pr_processor_bind(struct ps_prochandle *Pr, idtype_t, id_t, int, int *);
300*0Sstevel@tonic-gateint	pr_pset_bind(struct ps_prochandle *Pr, int, idtype_t, id_t, int *);
301*0Sstevel@tonic-gate
302*0Sstevel@tonic-gate/* pr_rename.c */
303*0Sstevel@tonic-gateint	pr_rename(struct ps_prochandle *Pr, const char *old, const char *new);
304*0Sstevel@tonic-gateint	pr_link(struct ps_prochandle *Pr, const char *exist, const char *new);
305*0Sstevel@tonic-gateint	pr_unlink(struct ps_prochandle *Pr, const char *);
306*0Sstevel@tonic-gate
307*0Sstevel@tonic-gate/* pr_sigaction.c */
308*0Sstevel@tonic-gateint	pr_sigaction(struct ps_prochandle *Pr,
309*0Sstevel@tonic-gate		int sig, const struct sigaction *act, struct sigaction *oact);
310*0Sstevel@tonic-gate
311*0Sstevel@tonic-gate/* pr_stat.c */
312*0Sstevel@tonic-gateint	pr_stat(struct ps_prochandle *Pr, const char *path, struct stat *buf);
313*0Sstevel@tonic-gateint	pr_lstat(struct ps_prochandle *Pr, const char *path, struct stat *buf);
314*0Sstevel@tonic-gateint	pr_fstat(struct ps_prochandle *Pr, int fd, struct stat *buf);
315*0Sstevel@tonic-gateint	pr_stat64(struct ps_prochandle *Pr, const char *path,
316*0Sstevel@tonic-gate		struct stat64 *buf);
317*0Sstevel@tonic-gateint	pr_lstat64(struct ps_prochandle *Pr, const char *path,
318*0Sstevel@tonic-gate		struct stat64 *buf);
319*0Sstevel@tonic-gateint	pr_fstat64(struct ps_prochandle *Pr, int fd, struct stat64 *buf);
320*0Sstevel@tonic-gate
321*0Sstevel@tonic-gate/* pr_statvfs.c */
322*0Sstevel@tonic-gateint	pr_statvfs(struct ps_prochandle *Pr, const char *path, statvfs_t *buf);
323*0Sstevel@tonic-gateint	pr_fstatvfs(struct ps_prochandle *Pr, int fd, statvfs_t *buf);
324*0Sstevel@tonic-gate
325*0Sstevel@tonic-gate/* pr_tasksys.c */
326*0Sstevel@tonic-gateprojid_t pr_getprojid(struct ps_prochandle *Pr);
327*0Sstevel@tonic-gatetaskid_t pr_gettaskid(struct ps_prochandle *Pr);
328*0Sstevel@tonic-gatetaskid_t pr_settaskid(struct ps_prochandle *Pr, projid_t project, int flags);
329*0Sstevel@tonic-gate
330*0Sstevel@tonic-gate/* pr_waitid.c */
331*0Sstevel@tonic-gateint	pr_waitid(struct ps_prochandle *Pr,
332*0Sstevel@tonic-gate		idtype_t idtype, id_t id, siginfo_t *infop, int options);
333*0Sstevel@tonic-gate
334*0Sstevel@tonic-gate/* proc_get_info.c */
335*0Sstevel@tonic-gateint	proc_get_cred(pid_t pid, prcred_t *credp, int ngroups);
336*0Sstevel@tonic-gateprpriv_t *proc_get_priv(pid_t pid);
337*0Sstevel@tonic-gateint	proc_get_psinfo(pid_t pid, psinfo_t *psp);
338*0Sstevel@tonic-gateint	proc_get_status(pid_t pid, pstatus_t *psp);
339*0Sstevel@tonic-gateint	proc_get_auxv(pid_t pid, auxv_t *pauxv, int naux);
340*0Sstevel@tonic-gate
341*0Sstevel@tonic-gate/* proc_names.c */
342*0Sstevel@tonic-gatechar	*proc_fltname(int flt, char *buf, size_t bufsz);
343*0Sstevel@tonic-gatechar	*proc_signame(int sig, char *buf, size_t bufsz);
344*0Sstevel@tonic-gatechar	*proc_sysname(int sys, char *buf, size_t bufsz);
345*0Sstevel@tonic-gate
346*0Sstevel@tonic-gateint	proc_str2flt(const char *str, int *fltnum);
347*0Sstevel@tonic-gateint	proc_str2sig(const char *str, int *signum);
348*0Sstevel@tonic-gateint	proc_str2sys(const char *str, int *sysnum);
349*0Sstevel@tonic-gate
350*0Sstevel@tonic-gatechar	*proc_fltset2str(const fltset_t *set, const char *delim, int members,
351*0Sstevel@tonic-gate		char *buf, size_t nbytes);
352*0Sstevel@tonic-gatechar	*proc_sigset2str(const sigset_t *set, const char *delim, int members,
353*0Sstevel@tonic-gate		char *buf, size_t nbytes);
354*0Sstevel@tonic-gatechar	*proc_sysset2str(const sysset_t *set, const char *delim, int members,
355*0Sstevel@tonic-gate		char *buf, size_t nbytes);
356*0Sstevel@tonic-gate
357*0Sstevel@tonic-gatechar	*proc_str2fltset(const char *str, const char *delim, int members,
358*0Sstevel@tonic-gate		fltset_t *set);
359*0Sstevel@tonic-gatechar	*proc_str2sigset(const char *str, const char *delim, int members,
360*0Sstevel@tonic-gate		sigset_t *set);
361*0Sstevel@tonic-gatechar	*proc_str2sysset(const char *str, const char *delim, int members,
362*0Sstevel@tonic-gate		sysset_t *set);
363*0Sstevel@tonic-gate
364*0Sstevel@tonic-gateint	proc_walk(proc_walk_f *func, void *arg, int flags);
365*0Sstevel@tonic-gate
366*0Sstevel@tonic-gate/* proc_arg.c */
367*0Sstevel@tonic-gatestruct ps_prochandle *proc_arg_grab(const char *arg,
368*0Sstevel@tonic-gate	int oflag, int gflag, int *perr);
369*0Sstevel@tonic-gate
370*0Sstevel@tonic-gatepid_t	proc_arg_psinfo(const char *arg, int oflag, psinfo_t *psp, int *perr);
371*0Sstevel@tonic-gatevoid	proc_unctrl_psinfo(psinfo_t *psp);
372*0Sstevel@tonic-gate
373*0Sstevel@tonic-gate/* proc_set.c */
374*0Sstevel@tonic-gateint	Psetcred(struct ps_prochandle *Pr, const prcred_t *pcred);
375*0Sstevel@tonic-gate
376*0Sstevel@tonic-gate/* Pstack.c */
377*0Sstevel@tonic-gateint	Pstack_iter(struct ps_prochandle *Pr,
378*0Sstevel@tonic-gate		const prgregset_t regs, proc_stack_f *func, void *arg);
379*0Sstevel@tonic-gate
380*0Sstevel@tonic-gate/* Pisadep.c */
381*0Sstevel@tonic-gateconst char *Ppltdest(struct ps_prochandle *Pr, uintptr_t addr);
382