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