xref: /onnv-gate/usr/src/lib/libproc/common/llib-lproc (revision 10089:3b42b78e6a26)
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
53684Srd117015 * Common Development and Distribution License (the "License").
63684Srd117015 * 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/* LINTLIBRARY */
220Sstevel@tonic-gate/* PROTOLIB1 */
230Sstevel@tonic-gate
240Sstevel@tonic-gate/*
25*10089SSurya.Prakki@Sun.COM * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
260Sstevel@tonic-gate * Use is subject to license terms.
270Sstevel@tonic-gate */
280Sstevel@tonic-gate#include "libproc.h"
290Sstevel@tonic-gate
300Sstevel@tonic-gate/*
310Sstevel@tonic-gate * usr/src/lib/libproc
320Sstevel@tonic-gate */
330Sstevel@tonic-gate
340Sstevel@tonic-gate/* Pcontrol.c */
350Sstevel@tonic-gateint	_libproc_debug;
360Sstevel@tonic-gatestruct ps_prochandle *Pcreate(const char *file, char *const *argv,
370Sstevel@tonic-gate		int *perr, char *path, size_t len);
380Sstevel@tonic-gateconst char *Pcreate_error(int error);
390Sstevel@tonic-gatevoid	Pcreate_callback(struct ps_prochandle *Pr);
400Sstevel@tonic-gatestruct ps_prochandle *Pgrab(pid_t pid, int gflag, int *perr);
410Sstevel@tonic-gateconst char *Pgrab_error(int error);
420Sstevel@tonic-gatevoid	Pfree(struct ps_prochandle *Pr);
430Sstevel@tonic-gateint	Pstate(struct ps_prochandle *Pr);
440Sstevel@tonic-gateint	Pasfd(struct ps_prochandle *Pr);
450Sstevel@tonic-gateint	Pctlfd(struct ps_prochandle *Pr);
460Sstevel@tonic-gateconst psinfo_t *Ppsinfo(struct ps_prochandle *Pr);
470Sstevel@tonic-gateconst pstatus_t *Pstatus(struct ps_prochandle *Pr);
480Sstevel@tonic-gateint	Pcred(struct ps_prochandle *Pr, prcred_t *pcrp, int ngroups);
490Sstevel@tonic-gatessize_t	Ppriv(struct ps_prochandle *Pr, prpriv_t *pprivp, size_t);
500Sstevel@tonic-gatevoid	Psync(struct ps_prochandle *Pr);
510Sstevel@tonic-gateint	Pcreate_agent(struct ps_prochandle *Pr);
520Sstevel@tonic-gatevoid	Pdestroy_agent(struct ps_prochandle *Pr);
530Sstevel@tonic-gateint	Preopen(struct ps_prochandle *Pr);
540Sstevel@tonic-gatevoid	Prelease(struct ps_prochandle *Pr, int flags);
550Sstevel@tonic-gateint	Pstopstatus(struct ps_prochandle *Pr, long cmd, uint_t msec);
560Sstevel@tonic-gateint	Pwait(struct ps_prochandle *Pr, uint_t msec);
570Sstevel@tonic-gateint	Pstop(struct ps_prochandle *Pr, uint_t msec);
580Sstevel@tonic-gateint	Pdstop(struct ps_prochandle *Pr);
590Sstevel@tonic-gateint	Pgetareg(struct ps_prochandle *Pr, int regno, prgreg_t *preg);
600Sstevel@tonic-gateint	Pputareg(struct ps_prochandle *Pr, int regno, prgreg_t reg);
610Sstevel@tonic-gateint	Psetrun(struct ps_prochandle *Pr, int sig, int flags);
620Sstevel@tonic-gatessize_t	Pread(struct ps_prochandle *Pr,
630Sstevel@tonic-gate		void *buf, size_t nbyte, uintptr_t address);
640Sstevel@tonic-gatessize_t	Pread_string(struct ps_prochandle *Pr,
650Sstevel@tonic-gate		char *buf, size_t nbyte, uintptr_t address);
660Sstevel@tonic-gatessize_t	Pwrite(struct ps_prochandle *Pr,
670Sstevel@tonic-gate		const void *buf, size_t nbyte, uintptr_t address);
680Sstevel@tonic-gateint	Pclearsig(struct ps_prochandle *Pr);
690Sstevel@tonic-gateint	Pclearfault(struct ps_prochandle *Pr);
700Sstevel@tonic-gateint	Psetbkpt(struct ps_prochandle *Pr, uintptr_t address, ulong_t *saved);
710Sstevel@tonic-gateint	Pdelbkpt(struct ps_prochandle *Pr, uintptr_t address, ulong_t saved);
720Sstevel@tonic-gateint	Pxecbkpt(struct ps_prochandle *Pr, ulong_t saved);
730Sstevel@tonic-gateint	Psetwapt(struct ps_prochandle *Pr, const prwatch_t *wp);
740Sstevel@tonic-gateint	Pdelwapt(struct ps_prochandle *Pr, const prwatch_t *wp);
750Sstevel@tonic-gateint	Pxecwapt(struct ps_prochandle *Pr, const prwatch_t *wp);
760Sstevel@tonic-gateint	Psetflags(struct ps_prochandle *Pr, long flags);
770Sstevel@tonic-gateint	Punsetflags(struct ps_prochandle *Pr, long flags);
780Sstevel@tonic-gateint	Psignal(struct ps_prochandle *Pr, int which, int stop);
790Sstevel@tonic-gatevoid	Psetsignal(struct ps_prochandle *Pr, const sigset_t *set);
800Sstevel@tonic-gateint	Pfault(struct ps_prochandle *Pr, int which, int stop);
810Sstevel@tonic-gatevoid	Psetfault(struct ps_prochandle *Pr, const fltset_t *set);
820Sstevel@tonic-gateint	Psysentry(struct ps_prochandle *Pr, int which, int stop);
830Sstevel@tonic-gatevoid	Psetsysentry(struct ps_prochandle *Pr, const sysset_t *set);
840Sstevel@tonic-gateint	Psysexit(struct ps_prochandle *Pr, int which, int stop);
850Sstevel@tonic-gatevoid	Psetsysexit(struct ps_prochandle *Pr, const sysset_t *set);
860Sstevel@tonic-gateint	Plwp_iter(struct ps_prochandle *Pr, proc_lwp_f *func, void *cd);
870Sstevel@tonic-gateint	Psyscall(struct ps_prochandle *Pr, sysret_t *,
880Sstevel@tonic-gate		int sysindex, uint_t nargs, argdes_t *argp);
890Sstevel@tonic-gate
900Sstevel@tonic-gatestruct ps_lwphandle *Lgrab(struct ps_prochandle *P, lwpid_t lwpid, int *perr);
910Sstevel@tonic-gateconst char *Lgrab_error(int error);
920Sstevel@tonic-gatestruct ps_prochandle *Lprochandle(struct ps_lwphandle *Lwp);
930Sstevel@tonic-gatevoid	Lfree(struct ps_lwphandle *Lwp);
940Sstevel@tonic-gateint	Lctlfd(struct ps_lwphandle *Lwp);
950Sstevel@tonic-gateint	Lwait(struct ps_lwphandle *Lwp, uint_t msec);
960Sstevel@tonic-gateint	Lstop(struct ps_lwphandle *Lwp, uint_t msec);
970Sstevel@tonic-gateint	Ldstop(struct ps_lwphandle *Lwp);
980Sstevel@tonic-gateint	Lstate(struct ps_lwphandle *Lwp);
990Sstevel@tonic-gateconst lwpsinfo_t *Lpsinfo(struct ps_lwphandle *Lwp);
1000Sstevel@tonic-gateconst lwpstatus_t *Lstatus(struct ps_lwphandle *Lwp);
1010Sstevel@tonic-gateint	Lgetareg(struct ps_lwphandle *Lwp, int regno, prgreg_t *preg);
1020Sstevel@tonic-gateint	Lputareg(struct ps_lwphandle *Lwp, int regno, prgreg_t reg);
1030Sstevel@tonic-gateint	Lsetrun(struct ps_lwphandle *Lwp, int sig, int flags);
1040Sstevel@tonic-gateint	Lclearsig(struct ps_lwphandle *Lwp);
1050Sstevel@tonic-gateint	Lclearfault(struct ps_lwphandle *Lwp);
1060Sstevel@tonic-gateint	Lxecbkpt(struct ps_lwphandle *Lwp, ulong_t saved);
1070Sstevel@tonic-gateint	Lxecwapt(struct ps_lwphandle *Lwp, const prwatch_t *wp);
1080Sstevel@tonic-gatevoid	Lsync(struct ps_lwphandle *Lwp);
1090Sstevel@tonic-gate
1100Sstevel@tonic-gate/* Plwpregs.c */
1110Sstevel@tonic-gateint Plwp_getregs(struct ps_prochandle *Pr, lwpid_t i, prgregset_t gr);
1120Sstevel@tonic-gateint Plwp_setregs(struct ps_prochandle *Pr, lwpid_t i, const prgregset_t gr);
1130Sstevel@tonic-gateint Plwp_getfpregs(struct ps_prochandle *Pr, lwpid_t i, prfpregset_t *fp);
1140Sstevel@tonic-gateint Plwp_setfpregs(struct ps_prochandle *Pr, lwpid_t i, const prfpregset_t *fp);
1150Sstevel@tonic-gate#if defined(sparc) || defined(__sparc)
1160Sstevel@tonic-gateint Plwp_getxregs(struct ps_prochandle *Pr, lwpid_t i, prxregset_t *xr);
1170Sstevel@tonic-gateint Plwp_setxregs(struct ps_prochandle *Pr, lwpid_t i, const prxregset_t *xr);
1180Sstevel@tonic-gate#if defined(__sparcv9)
1190Sstevel@tonic-gateint Plwp_getasrs(struct ps_prochandle *Pr, lwpid_t i, asrset_t asrs);
1200Sstevel@tonic-gateint Plwp_setasrs(struct ps_prochandle *Pr, lwpid_t i, const asrset_t asrs);
1210Sstevel@tonic-gate#endif  /* __sparcv9 */
1220Sstevel@tonic-gate#endif  /* __sparc */
1230Sstevel@tonic-gateint Plwp_getpsinfo(struct ps_prochandle *Pr, lwpid_t i, lwpsinfo_t *lps);
1240Sstevel@tonic-gate
1250Sstevel@tonic-gate/* Pcore.c */
1260Sstevel@tonic-gatestruct ps_prochandle *Pfgrab_core(int fd, const char *aout, int *perr);
1270Sstevel@tonic-gatestruct ps_prochandle *Pgrab_core(const char *core, const char *aout,
1280Sstevel@tonic-gate	int gflag, int *perr);
1290Sstevel@tonic-gate
1300Sstevel@tonic-gate/* Pisprocdir.c */
1310Sstevel@tonic-gateint	Pisprocdir(struct ps_prochandle *Pr, const char *dir);
1320Sstevel@tonic-gate
1330Sstevel@tonic-gate/* Pservice.c */
1340Sstevel@tonic-gateps_err_e ps_pdmodel(struct ps_prochandle *Pr, int *modelp);
1350Sstevel@tonic-gateps_err_e ps_pread(struct ps_prochandle *Pr,
1360Sstevel@tonic-gate		psaddr_t addr, void *buf, size_t size);
1370Sstevel@tonic-gateps_err_e ps_pwrite(struct ps_prochandle *Pr,
1380Sstevel@tonic-gate		psaddr_t addr, const void *buf, size_t size);
1390Sstevel@tonic-gateps_err_e ps_pdread(struct ps_prochandle *Pr,
1400Sstevel@tonic-gate		psaddr_t addr, void *buf, size_t size);
1410Sstevel@tonic-gateps_err_e ps_pdwrite(struct ps_prochandle *Pr,
1420Sstevel@tonic-gate		psaddr_t addr, const void *buf, size_t size);
1430Sstevel@tonic-gateps_err_e ps_ptread(struct ps_prochandle *Pr,
1440Sstevel@tonic-gate		psaddr_t addr, void *buf, size_t size);
1450Sstevel@tonic-gateps_err_e ps_ptwrite(struct ps_prochandle *Pr,
1460Sstevel@tonic-gate		psaddr_t addr, const void *buf, size_t size);
1470Sstevel@tonic-gateps_err_e ps_pstop(struct ps_prochandle *Pr);
1480Sstevel@tonic-gateps_err_e ps_pcontinue(struct ps_prochandle *Pr);
1490Sstevel@tonic-gateps_err_e ps_lstop(struct ps_prochandle *Pr, lwpid_t lwpid);
1500Sstevel@tonic-gateps_err_e ps_lcontinue(struct ps_prochandle *Pr, lwpid_t lwpid);
1510Sstevel@tonic-gateps_err_e ps_lgetregs(struct ps_prochandle *Pr,
1520Sstevel@tonic-gate		lwpid_t lwpid, prgregset_t regs);
1530Sstevel@tonic-gateps_err_e ps_lsetregs(struct ps_prochandle *Pr,
1540Sstevel@tonic-gate		lwpid_t lwpid, const prgregset_t regs);
1550Sstevel@tonic-gateps_err_e ps_lgetfpregs(struct ps_prochandle *Pr,
1560Sstevel@tonic-gate		lwpid_t lwpid, prfpregset_t *regs);
1570Sstevel@tonic-gateps_err_e ps_lsetfpregs(struct ps_prochandle *Pr,
1580Sstevel@tonic-gate		lwpid_t lwpid, const prfpregset_t *regs);
1590Sstevel@tonic-gate#if defined(sparc) || defined(__sparc)
1600Sstevel@tonic-gateps_err_e ps_lgetxregsize(struct ps_prochandle *Pr,
1610Sstevel@tonic-gate		lwpid_t lwpid, int *xrsize);
1620Sstevel@tonic-gateps_err_e ps_lgetxregs(struct ps_prochandle *Pr,
1630Sstevel@tonic-gate		lwpid_t lwpid, caddr_t xregs);
1640Sstevel@tonic-gateps_err_e ps_lsetxregs(struct ps_prochandle *Pr,
1650Sstevel@tonic-gate		lwpid_t lwpid, caddr_t xregs);
1660Sstevel@tonic-gate#endif	/* sparc */
1670Sstevel@tonic-gate#if defined(__i386) || defined(__amd64)
1680Sstevel@tonic-gateps_err_e ps_lgetLDT(struct ps_prochandle *Pr,
1690Sstevel@tonic-gate		lwpid_t lwpid, struct ssd *ldt);
1700Sstevel@tonic-gate#endif	/* __i386 || __amd6464 */
1710Sstevel@tonic-gatevoid	ps_plog(const char *fmt, ...);
1720Sstevel@tonic-gate
1730Sstevel@tonic-gate/* Psymtab.c */
1740Sstevel@tonic-gatevoid	Pupdate_maps(struct ps_prochandle *Pr);
1750Sstevel@tonic-gatevoid	Pupdate_syms(struct ps_prochandle *Pr);
1760Sstevel@tonic-gaterd_agent_t *Prd_agent(struct ps_prochandle *Pr);
1770Sstevel@tonic-gateconst prmap_t *Paddr_to_map(struct ps_prochandle *Pr, uintptr_t addr);
1780Sstevel@tonic-gateconst prmap_t *Paddr_to_text_map(struct ps_prochandle *Pr, uintptr_t addr);
1790Sstevel@tonic-gateconst prmap_t *Pname_to_map(struct ps_prochandle *Pr, const char *name);
1800Sstevel@tonic-gateconst prmap_t *Plmid_to_map(struct ps_prochandle *Pr, Lmid_t lmid,
1810Sstevel@tonic-gate		const char *name);
1820Sstevel@tonic-gateint	Plookup_by_addr(struct ps_prochandle *Pr, uintptr_t addr,
1830Sstevel@tonic-gate		char *sym_name_buffer, size_t bufsize, GElf_Sym *symbolp);
1840Sstevel@tonic-gateint	Plookup_by_name(struct ps_prochandle *Pr,
1850Sstevel@tonic-gate		const char *object_name, const char *symbol_name,
1860Sstevel@tonic-gate		GElf_Sym *sym);
1870Sstevel@tonic-gateint	Plookup_by_lmid(struct ps_prochandle *Pr,
1880Sstevel@tonic-gate		Lmid_t lmid, const char *object_name, const char *symbol_name,
1890Sstevel@tonic-gate		GElf_Sym *sym);
1900Sstevel@tonic-gateconst rd_loadobj_t *Paddr_to_loadobj(struct ps_prochandle *, uintptr_t);
1910Sstevel@tonic-gateconst rd_loadobj_t *Pname_to_loadobj(struct ps_prochandle *, const char *);
1920Sstevel@tonic-gateconst rd_loadobj_t *Plmid_to_loadobj(struct ps_prochandle *, Lmid_t,
1930Sstevel@tonic-gate		const char *);
1940Sstevel@tonic-gateint	Pmapping_iter(struct ps_prochandle *Pr, proc_map_f *func, void *cd);
1957675SEdward.Pilatowicz@Sun.COMint	Pmapping_iter_resolved(struct ps_prochandle *Pr, proc_map_f *func,
1967675SEdward.Pilatowicz@Sun.COM		void *cd);
1970Sstevel@tonic-gateint	Pobject_iter(struct ps_prochandle *Pr, proc_map_f *func, void *cd);
1987675SEdward.Pilatowicz@Sun.COMint	Pobject_iter_resolved(struct ps_prochandle *Pr, proc_map_f *func,
1997675SEdward.Pilatowicz@Sun.COM		void *cd);
2000Sstevel@tonic-gatechar	*Pobjname(struct ps_prochandle *Pr, uintptr_t addr,
2010Sstevel@tonic-gate		char *buffer, size_t bufsize);
2027675SEdward.Pilatowicz@Sun.COMchar	*Pobjname_resolved(struct ps_prochandle *Pr, uintptr_t addr,
2037675SEdward.Pilatowicz@Sun.COM		char *buffer, size_t bufsize);
2040Sstevel@tonic-gateint	Plmid(struct ps_prochandle *Pr, uintptr_t addr, Lmid_t *lmidp);
2050Sstevel@tonic-gateint	Psymbol_iter(struct ps_prochandle *Pr, const char *object_name,
2060Sstevel@tonic-gate		int which, int type, proc_sym_f *func, void *cd);
2070Sstevel@tonic-gateint	Psymbol_iter_by_lmid(struct ps_prochandle *Pr, Lmid_t lmid,
2080Sstevel@tonic-gate		const char *object_name, int which, int type,
2090Sstevel@tonic-gate		proc_sym_f *func, void *cd);
2100Sstevel@tonic-gatechar	*Pgetenv(struct ps_prochandle *Pr, const char *name,
2110Sstevel@tonic-gate		char *buffer, size_t bufsize);
2120Sstevel@tonic-gatechar	*Pplatform(struct ps_prochandle *Pr, char *s, size_t n);
2130Sstevel@tonic-gateint	Puname(struct ps_prochandle *Pr, struct utsname *u);
2140Sstevel@tonic-gatechar	*Pzonename(struct ps_prochandle *Pr, char *s, size_t n);
2157675SEdward.Pilatowicz@Sun.COMchar	*Pfindobj(struct ps_prochandle *Pr, const char *path,
2167675SEdward.Pilatowicz@Sun.COM		char *s, size_t n);
2170Sstevel@tonic-gatechar	*Pexecname(struct ps_prochandle *Pr, char *buffer, size_t bufsize);
2180Sstevel@tonic-gatevoid	Preset_maps(struct ps_prochandle *Pr);
2190Sstevel@tonic-gate
2200Sstevel@tonic-gateps_err_e ps_pglobal_lookup(struct ps_prochandle *Pr,
2210Sstevel@tonic-gate		const char *object_name, const char *sym_name,
2220Sstevel@tonic-gate		psaddr_t *sym_addr);
2230Sstevel@tonic-gate
2240Sstevel@tonic-gateps_err_e ps_pglobal_sym(struct ps_prochandle *Pr,
2250Sstevel@tonic-gate		const char *object_name, const char *sym_name,
2260Sstevel@tonic-gate		ps_sym_t *symp);
2270Sstevel@tonic-gate
2280Sstevel@tonic-gatelong	Pgetauxval(struct ps_prochandle *Pr, int type);
2290Sstevel@tonic-gateconst auxv_t *Pgetauxvec(struct ps_prochandle *Pr);
2300Sstevel@tonic-gateps_err_e ps_pauxv(struct ps_prochandle *Pr, const auxv_t **aux);
2310Sstevel@tonic-gate
2320Sstevel@tonic-gate/* Putil.c */
2330Sstevel@tonic-gatevoid	Perror_printf(struct ps_prochandle *Pr, const char *format, ...);
2340Sstevel@tonic-gate
2350Sstevel@tonic-gate/* pr_door.c */
2360Sstevel@tonic-gateint	pr_door_info(struct ps_prochandle *Pr, int did, door_info_t *di);
2370Sstevel@tonic-gate
2380Sstevel@tonic-gate/* pr_exit.c */
2390Sstevel@tonic-gateint	pr_exit(struct ps_prochandle *Pr, int status);
2400Sstevel@tonic-gateint	pr_lwp_exit(struct ps_prochandle *Pr);
2410Sstevel@tonic-gate
2420Sstevel@tonic-gate/* pr_fcntl.c */
2430Sstevel@tonic-gateint	pr_fcntl(struct ps_prochandle *Pr, int fd, int cmd, void *argp);
2440Sstevel@tonic-gate
2450Sstevel@tonic-gate/* pr_getitimer.c */
2460Sstevel@tonic-gateint	pr_getitimer(struct ps_prochandle *Pr,
2470Sstevel@tonic-gate		int which, struct itimerval *itv);
2480Sstevel@tonic-gateint	pr_setitimer(struct ps_prochandle *Pr,
2490Sstevel@tonic-gate		int which, const struct itimerval *itv, struct itimerval *oitv);
2500Sstevel@tonic-gate
2510Sstevel@tonic-gate/* pr_getrctl.c */
2520Sstevel@tonic-gateint	pr_getrctl(struct ps_prochandle *Pr, const char *rname,
2530Sstevel@tonic-gate		rctlblk_t *old_blk, rctlblk_t *new_blk, int rflag);
2540Sstevel@tonic-gateint   pr_setrctl(struct ps_prochandle *Pr, const char *rname,
2550Sstevel@tonic-gate		rctlblk_t *old_blk, rctlblk_t *new_blk, int rflag);
2563684Srd117015int   pr_setprojrctl(struct ps_prochandle *Pr, const char *rname,
2573684Srd117015		rctlblk_t *new_blk, size_t size, int rflag);
2580Sstevel@tonic-gate
2590Sstevel@tonic-gate/* pr_getrlimit.c */
2600Sstevel@tonic-gateint	pr_getrlimit(struct ps_prochandle *Pr,
2610Sstevel@tonic-gate		int resource, struct rlimit *rlp);
2620Sstevel@tonic-gateint	pr_setrlimit(struct ps_prochandle *Pr,
2630Sstevel@tonic-gate		int resource, const struct rlimit *rlp);
2640Sstevel@tonic-gateint	pr_getrlimit64(struct ps_prochandle *Pr,
2650Sstevel@tonic-gate		int resource, struct rlimit64 *rlp);
2660Sstevel@tonic-gateint	pr_setrlimit64(struct ps_prochandle *Pr,
2670Sstevel@tonic-gate		int resource, const struct rlimit64 *rlp);
2680Sstevel@tonic-gate
2690Sstevel@tonic-gate/* pr_getsockname.c */
2700Sstevel@tonic-gateint	pr_getsockname(struct ps_prochandle *Pr,
2710Sstevel@tonic-gate		int sock, struct sockaddr *name, socklen_t *namelen);
2720Sstevel@tonic-gateint	pr_getpeername(struct ps_prochandle *Pr,
2730Sstevel@tonic-gate		int sock, struct sockaddr *name, socklen_t *namelen);
2740Sstevel@tonic-gate
2750Sstevel@tonic-gate/* pr_ioctl.c */
2760Sstevel@tonic-gateint	pr_ioctl(struct ps_prochandle *Pr,
2770Sstevel@tonic-gate		int fd, int code, void *buf, size_t size);
2780Sstevel@tonic-gate
2790Sstevel@tonic-gate/* pr_lseek.c */
2800Sstevel@tonic-gateoff_t	pr_lseek(struct ps_prochandle *Pr,
2810Sstevel@tonic-gate		int filedes, off_t offset, int whence);
2820Sstevel@tonic-gateoffset_t pr_llseek(struct ps_prochandle *Pr,
2830Sstevel@tonic-gate		int filedes, offset_t offset, int whence);
2840Sstevel@tonic-gate
2850Sstevel@tonic-gate/* pr_memcntl.c */
2860Sstevel@tonic-gateint	pr_memcntl(struct ps_prochandle *Pr,
2870Sstevel@tonic-gate	caddr_t addr, size_t len, int cmd, caddr_t arg, int attr, int mask);
2880Sstevel@tonic-gate
2890Sstevel@tonic-gate/* pr_mmap.c */
2900Sstevel@tonic-gatevoid	*pr_mmap(struct ps_prochandle *Pr,
2910Sstevel@tonic-gate		void *addr, size_t len, int prot, int flags, int fd, off_t off);
2920Sstevel@tonic-gateint	pr_munmap(struct ps_prochandle *Pr,
2930Sstevel@tonic-gate		void *addr, size_t len);
2940Sstevel@tonic-gatevoid	*pr_zmap(struct ps_prochandle *Pr,
2950Sstevel@tonic-gate		void *addr, size_t len, int prot, int flags);
2960Sstevel@tonic-gate
2970Sstevel@tonic-gate/* pr_open.c */
2980Sstevel@tonic-gateint	pr_open(struct ps_prochandle *Pr,
2990Sstevel@tonic-gate		const char *filename, int flags, mode_t mode);
3000Sstevel@tonic-gateint	pr_creat(struct ps_prochandle *Pr,
3010Sstevel@tonic-gate		const char *filename, mode_t mode);
3020Sstevel@tonic-gateint	pr_close(struct ps_prochandle *Pr, int fd);
3030Sstevel@tonic-gateint	pr_access(struct ps_prochandle *Pr, const char *path, int amode);
3040Sstevel@tonic-gate
3050Sstevel@tonic-gate/* pr_pbind.c */
3060Sstevel@tonic-gateint	pr_processor_bind(struct ps_prochandle *Pr, idtype_t, id_t, int, int *);
3070Sstevel@tonic-gate
3080Sstevel@tonic-gate/* pr_rename.c */
3090Sstevel@tonic-gateint	pr_rename(struct ps_prochandle *Pr, const char *old, const char *new);
3100Sstevel@tonic-gateint	pr_link(struct ps_prochandle *Pr, const char *exist, const char *new);
3110Sstevel@tonic-gateint	pr_unlink(struct ps_prochandle *Pr, const char *);
3120Sstevel@tonic-gate
3130Sstevel@tonic-gate/* pr_sigaction.c */
3140Sstevel@tonic-gateint	pr_sigaction(struct ps_prochandle *Pr,
3150Sstevel@tonic-gate		int sig, const struct sigaction *act, struct sigaction *oact);
3160Sstevel@tonic-gate
3170Sstevel@tonic-gate/* pr_stat.c */
3180Sstevel@tonic-gateint	pr_stat(struct ps_prochandle *Pr, const char *path, struct stat *buf);
3190Sstevel@tonic-gateint	pr_lstat(struct ps_prochandle *Pr, const char *path, struct stat *buf);
3200Sstevel@tonic-gateint	pr_fstat(struct ps_prochandle *Pr, int fd, struct stat *buf);
3210Sstevel@tonic-gateint	pr_stat64(struct ps_prochandle *Pr, const char *path,
3220Sstevel@tonic-gate		struct stat64 *buf);
3230Sstevel@tonic-gateint	pr_lstat64(struct ps_prochandle *Pr, const char *path,
3240Sstevel@tonic-gate		struct stat64 *buf);
3250Sstevel@tonic-gateint	pr_fstat64(struct ps_prochandle *Pr, int fd, struct stat64 *buf);
3260Sstevel@tonic-gate
3270Sstevel@tonic-gate/* pr_statvfs.c */
3280Sstevel@tonic-gateint	pr_statvfs(struct ps_prochandle *Pr, const char *path, statvfs_t *buf);
3290Sstevel@tonic-gateint	pr_fstatvfs(struct ps_prochandle *Pr, int fd, statvfs_t *buf);
3300Sstevel@tonic-gate
3310Sstevel@tonic-gate/* pr_tasksys.c */
3320Sstevel@tonic-gateprojid_t pr_getprojid(struct ps_prochandle *Pr);
3330Sstevel@tonic-gatetaskid_t pr_gettaskid(struct ps_prochandle *Pr);
3340Sstevel@tonic-gatetaskid_t pr_settaskid(struct ps_prochandle *Pr, projid_t project, int flags);
3350Sstevel@tonic-gate
3360Sstevel@tonic-gate/* pr_waitid.c */
3370Sstevel@tonic-gateint	pr_waitid(struct ps_prochandle *Pr,
3380Sstevel@tonic-gate		idtype_t idtype, id_t id, siginfo_t *infop, int options);
3390Sstevel@tonic-gate
3400Sstevel@tonic-gate/* proc_get_info.c */
3410Sstevel@tonic-gateint	proc_get_cred(pid_t pid, prcred_t *credp, int ngroups);
3420Sstevel@tonic-gateprpriv_t *proc_get_priv(pid_t pid);
3430Sstevel@tonic-gateint	proc_get_psinfo(pid_t pid, psinfo_t *psp);
3440Sstevel@tonic-gateint	proc_get_status(pid_t pid, pstatus_t *psp);
3450Sstevel@tonic-gateint	proc_get_auxv(pid_t pid, auxv_t *pauxv, int naux);
3460Sstevel@tonic-gate
3470Sstevel@tonic-gate/* proc_names.c */
3480Sstevel@tonic-gatechar	*proc_fltname(int flt, char *buf, size_t bufsz);
3490Sstevel@tonic-gatechar	*proc_signame(int sig, char *buf, size_t bufsz);
3500Sstevel@tonic-gatechar	*proc_sysname(int sys, char *buf, size_t bufsz);
3510Sstevel@tonic-gate
3520Sstevel@tonic-gateint	proc_str2flt(const char *str, int *fltnum);
3530Sstevel@tonic-gateint	proc_str2sig(const char *str, int *signum);
3540Sstevel@tonic-gateint	proc_str2sys(const char *str, int *sysnum);
3550Sstevel@tonic-gate
3560Sstevel@tonic-gatechar	*proc_fltset2str(const fltset_t *set, const char *delim, int members,
3570Sstevel@tonic-gate		char *buf, size_t nbytes);
3580Sstevel@tonic-gatechar	*proc_sigset2str(const sigset_t *set, const char *delim, int members,
3590Sstevel@tonic-gate		char *buf, size_t nbytes);
3600Sstevel@tonic-gatechar	*proc_sysset2str(const sysset_t *set, const char *delim, int members,
3610Sstevel@tonic-gate		char *buf, size_t nbytes);
3620Sstevel@tonic-gate
3630Sstevel@tonic-gatechar	*proc_str2fltset(const char *str, const char *delim, int members,
3640Sstevel@tonic-gate		fltset_t *set);
3650Sstevel@tonic-gatechar	*proc_str2sigset(const char *str, const char *delim, int members,
3660Sstevel@tonic-gate		sigset_t *set);
3670Sstevel@tonic-gatechar	*proc_str2sysset(const char *str, const char *delim, int members,
3680Sstevel@tonic-gate		sysset_t *set);
3690Sstevel@tonic-gate
3700Sstevel@tonic-gateint	proc_walk(proc_walk_f *func, void *arg, int flags);
3710Sstevel@tonic-gate
3720Sstevel@tonic-gate/* proc_arg.c */
3730Sstevel@tonic-gatestruct ps_prochandle *proc_arg_grab(const char *arg,
3740Sstevel@tonic-gate	int oflag, int gflag, int *perr);
3750Sstevel@tonic-gate
3760Sstevel@tonic-gatepid_t	proc_arg_psinfo(const char *arg, int oflag, psinfo_t *psp, int *perr);
3770Sstevel@tonic-gatevoid	proc_unctrl_psinfo(psinfo_t *psp);
3780Sstevel@tonic-gate
3790Sstevel@tonic-gate/* proc_set.c */
3800Sstevel@tonic-gateint	Psetcred(struct ps_prochandle *Pr, const prcred_t *pcred);
3810Sstevel@tonic-gate
3820Sstevel@tonic-gate/* Pstack.c */
3830Sstevel@tonic-gateint	Pstack_iter(struct ps_prochandle *Pr,
3840Sstevel@tonic-gate		const prgregset_t regs, proc_stack_f *func, void *arg);
3850Sstevel@tonic-gate
3860Sstevel@tonic-gate/* Pisadep.c */
3870Sstevel@tonic-gateconst char *Ppltdest(struct ps_prochandle *Pr, uintptr_t addr);
388