xref: /titanic_52/usr/src/lib/libproc/common/llib-lproc (revision 2a12f85ad140e332791b4bad1208a734c3f26bf3)
17c478bd9Sstevel@tonic-gate/*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5532877c4Srd117015 * Common Development and Distribution License (the "License").
6532877c4Srd117015 * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
217c478bd9Sstevel@tonic-gate/* LINTLIBRARY */
227c478bd9Sstevel@tonic-gate/* PROTOLIB1 */
237c478bd9Sstevel@tonic-gate
247c478bd9Sstevel@tonic-gate/*
25fb9b0aa8SSurya Prakki * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate */
28*2a12f85aSJeremy Jones/*
29*2a12f85aSJeremy Jones * Copyright (c) 2013 by Delphix. All rights reserved.
30*2a12f85aSJeremy Jones */
317c478bd9Sstevel@tonic-gate#include "libproc.h"
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gate/*
347c478bd9Sstevel@tonic-gate * usr/src/lib/libproc
357c478bd9Sstevel@tonic-gate */
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gate/* Pcontrol.c */
387c478bd9Sstevel@tonic-gateint	_libproc_debug;
397c478bd9Sstevel@tonic-gatestruct ps_prochandle *Pcreate(const char *file, char *const *argv,
407c478bd9Sstevel@tonic-gate		int *perr, char *path, size_t len);
417c478bd9Sstevel@tonic-gateconst char *Pcreate_error(int error);
427c478bd9Sstevel@tonic-gatevoid	Pcreate_callback(struct ps_prochandle *Pr);
437c478bd9Sstevel@tonic-gatestruct ps_prochandle *Pgrab(pid_t pid, int gflag, int *perr);
447c478bd9Sstevel@tonic-gateconst char *Pgrab_error(int error);
457c478bd9Sstevel@tonic-gatevoid	Pfree(struct ps_prochandle *Pr);
467c478bd9Sstevel@tonic-gateint	Pstate(struct ps_prochandle *Pr);
477c478bd9Sstevel@tonic-gateint	Pasfd(struct ps_prochandle *Pr);
487c478bd9Sstevel@tonic-gateint	Pctlfd(struct ps_prochandle *Pr);
497c478bd9Sstevel@tonic-gateconst psinfo_t *Ppsinfo(struct ps_prochandle *Pr);
507c478bd9Sstevel@tonic-gateconst pstatus_t *Pstatus(struct ps_prochandle *Pr);
517c478bd9Sstevel@tonic-gateint	Pcred(struct ps_prochandle *Pr, prcred_t *pcrp, int ngroups);
52*2a12f85aSJeremy Jonesint	Ppriv(struct ps_prochandle *Pr, prpriv_t **pprivp);
537c478bd9Sstevel@tonic-gatevoid	Psync(struct ps_prochandle *Pr);
547c478bd9Sstevel@tonic-gateint	Pcreate_agent(struct ps_prochandle *Pr);
557c478bd9Sstevel@tonic-gatevoid	Pdestroy_agent(struct ps_prochandle *Pr);
567c478bd9Sstevel@tonic-gateint	Preopen(struct ps_prochandle *Pr);
577c478bd9Sstevel@tonic-gatevoid	Prelease(struct ps_prochandle *Pr, int flags);
587c478bd9Sstevel@tonic-gateint	Pstopstatus(struct ps_prochandle *Pr, long cmd, uint_t msec);
597c478bd9Sstevel@tonic-gateint	Pwait(struct ps_prochandle *Pr, uint_t msec);
607c478bd9Sstevel@tonic-gateint	Pstop(struct ps_prochandle *Pr, uint_t msec);
617c478bd9Sstevel@tonic-gateint	Pdstop(struct ps_prochandle *Pr);
627c478bd9Sstevel@tonic-gateint	Pgetareg(struct ps_prochandle *Pr, int regno, prgreg_t *preg);
637c478bd9Sstevel@tonic-gateint	Pputareg(struct ps_prochandle *Pr, int regno, prgreg_t reg);
647c478bd9Sstevel@tonic-gateint	Psetrun(struct ps_prochandle *Pr, int sig, int flags);
657c478bd9Sstevel@tonic-gatessize_t	Pread(struct ps_prochandle *Pr,
667c478bd9Sstevel@tonic-gate		void *buf, size_t nbyte, uintptr_t address);
677c478bd9Sstevel@tonic-gatessize_t	Pread_string(struct ps_prochandle *Pr,
687c478bd9Sstevel@tonic-gate		char *buf, size_t nbyte, uintptr_t address);
697c478bd9Sstevel@tonic-gatessize_t	Pwrite(struct ps_prochandle *Pr,
707c478bd9Sstevel@tonic-gate		const void *buf, size_t nbyte, uintptr_t address);
717c478bd9Sstevel@tonic-gateint	Pclearsig(struct ps_prochandle *Pr);
727c478bd9Sstevel@tonic-gateint	Pclearfault(struct ps_prochandle *Pr);
737c478bd9Sstevel@tonic-gateint	Psetbkpt(struct ps_prochandle *Pr, uintptr_t address, ulong_t *saved);
747c478bd9Sstevel@tonic-gateint	Pdelbkpt(struct ps_prochandle *Pr, uintptr_t address, ulong_t saved);
757c478bd9Sstevel@tonic-gateint	Pxecbkpt(struct ps_prochandle *Pr, ulong_t saved);
767c478bd9Sstevel@tonic-gateint	Psetwapt(struct ps_prochandle *Pr, const prwatch_t *wp);
777c478bd9Sstevel@tonic-gateint	Pdelwapt(struct ps_prochandle *Pr, const prwatch_t *wp);
787c478bd9Sstevel@tonic-gateint	Pxecwapt(struct ps_prochandle *Pr, const prwatch_t *wp);
797c478bd9Sstevel@tonic-gateint	Psetflags(struct ps_prochandle *Pr, long flags);
807c478bd9Sstevel@tonic-gateint	Punsetflags(struct ps_prochandle *Pr, long flags);
817c478bd9Sstevel@tonic-gateint	Psignal(struct ps_prochandle *Pr, int which, int stop);
827c478bd9Sstevel@tonic-gatevoid	Psetsignal(struct ps_prochandle *Pr, const sigset_t *set);
837c478bd9Sstevel@tonic-gateint	Pfault(struct ps_prochandle *Pr, int which, int stop);
847c478bd9Sstevel@tonic-gatevoid	Psetfault(struct ps_prochandle *Pr, const fltset_t *set);
857c478bd9Sstevel@tonic-gateint	Psysentry(struct ps_prochandle *Pr, int which, int stop);
867c478bd9Sstevel@tonic-gatevoid	Psetsysentry(struct ps_prochandle *Pr, const sysset_t *set);
877c478bd9Sstevel@tonic-gateint	Psysexit(struct ps_prochandle *Pr, int which, int stop);
887c478bd9Sstevel@tonic-gatevoid	Psetsysexit(struct ps_prochandle *Pr, const sysset_t *set);
897c478bd9Sstevel@tonic-gateint	Plwp_iter(struct ps_prochandle *Pr, proc_lwp_f *func, void *cd);
907c478bd9Sstevel@tonic-gateint	Psyscall(struct ps_prochandle *Pr, sysret_t *,
917c478bd9Sstevel@tonic-gate		int sysindex, uint_t nargs, argdes_t *argp);
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gatestruct ps_lwphandle *Lgrab(struct ps_prochandle *P, lwpid_t lwpid, int *perr);
947c478bd9Sstevel@tonic-gateconst char *Lgrab_error(int error);
957c478bd9Sstevel@tonic-gatestruct ps_prochandle *Lprochandle(struct ps_lwphandle *Lwp);
967c478bd9Sstevel@tonic-gatevoid	Lfree(struct ps_lwphandle *Lwp);
977c478bd9Sstevel@tonic-gateint	Lctlfd(struct ps_lwphandle *Lwp);
987c478bd9Sstevel@tonic-gateint	Lwait(struct ps_lwphandle *Lwp, uint_t msec);
997c478bd9Sstevel@tonic-gateint	Lstop(struct ps_lwphandle *Lwp, uint_t msec);
1007c478bd9Sstevel@tonic-gateint	Ldstop(struct ps_lwphandle *Lwp);
1017c478bd9Sstevel@tonic-gateint	Lstate(struct ps_lwphandle *Lwp);
1027c478bd9Sstevel@tonic-gateconst lwpsinfo_t *Lpsinfo(struct ps_lwphandle *Lwp);
1037c478bd9Sstevel@tonic-gateconst lwpstatus_t *Lstatus(struct ps_lwphandle *Lwp);
1047c478bd9Sstevel@tonic-gateint	Lgetareg(struct ps_lwphandle *Lwp, int regno, prgreg_t *preg);
1057c478bd9Sstevel@tonic-gateint	Lputareg(struct ps_lwphandle *Lwp, int regno, prgreg_t reg);
1067c478bd9Sstevel@tonic-gateint	Lsetrun(struct ps_lwphandle *Lwp, int sig, int flags);
1077c478bd9Sstevel@tonic-gateint	Lclearsig(struct ps_lwphandle *Lwp);
1087c478bd9Sstevel@tonic-gateint	Lclearfault(struct ps_lwphandle *Lwp);
1097c478bd9Sstevel@tonic-gateint	Lxecbkpt(struct ps_lwphandle *Lwp, ulong_t saved);
1107c478bd9Sstevel@tonic-gateint	Lxecwapt(struct ps_lwphandle *Lwp, const prwatch_t *wp);
1117c478bd9Sstevel@tonic-gatevoid	Lsync(struct ps_lwphandle *Lwp);
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gate/* Plwpregs.c */
1147c478bd9Sstevel@tonic-gateint Plwp_getregs(struct ps_prochandle *Pr, lwpid_t i, prgregset_t gr);
1157c478bd9Sstevel@tonic-gateint Plwp_setregs(struct ps_prochandle *Pr, lwpid_t i, const prgregset_t gr);
1167c478bd9Sstevel@tonic-gateint Plwp_getfpregs(struct ps_prochandle *Pr, lwpid_t i, prfpregset_t *fp);
1177c478bd9Sstevel@tonic-gateint Plwp_setfpregs(struct ps_prochandle *Pr, lwpid_t i, const prfpregset_t *fp);
1187c478bd9Sstevel@tonic-gate#if defined(sparc) || defined(__sparc)
1197c478bd9Sstevel@tonic-gateint Plwp_getxregs(struct ps_prochandle *Pr, lwpid_t i, prxregset_t *xr);
1207c478bd9Sstevel@tonic-gateint Plwp_setxregs(struct ps_prochandle *Pr, lwpid_t i, const prxregset_t *xr);
1217c478bd9Sstevel@tonic-gate#if defined(__sparcv9)
1227c478bd9Sstevel@tonic-gateint Plwp_getasrs(struct ps_prochandle *Pr, lwpid_t i, asrset_t asrs);
1237c478bd9Sstevel@tonic-gateint Plwp_setasrs(struct ps_prochandle *Pr, lwpid_t i, const asrset_t asrs);
1247c478bd9Sstevel@tonic-gate#endif  /* __sparcv9 */
1257c478bd9Sstevel@tonic-gate#endif  /* __sparc */
1267c478bd9Sstevel@tonic-gateint Plwp_getpsinfo(struct ps_prochandle *Pr, lwpid_t i, lwpsinfo_t *lps);
1277c478bd9Sstevel@tonic-gate
1287c478bd9Sstevel@tonic-gate/* Pcore.c */
1297c478bd9Sstevel@tonic-gatestruct ps_prochandle *Pfgrab_core(int fd, const char *aout, int *perr);
1307c478bd9Sstevel@tonic-gatestruct ps_prochandle *Pgrab_core(const char *core, const char *aout,
1317c478bd9Sstevel@tonic-gate	int gflag, int *perr);
1327c478bd9Sstevel@tonic-gate
1337c478bd9Sstevel@tonic-gate/* Pisprocdir.c */
1347c478bd9Sstevel@tonic-gateint	Pisprocdir(struct ps_prochandle *Pr, const char *dir);
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gate/* Pservice.c */
1377c478bd9Sstevel@tonic-gateps_err_e ps_pdmodel(struct ps_prochandle *Pr, int *modelp);
1387c478bd9Sstevel@tonic-gateps_err_e ps_pread(struct ps_prochandle *Pr,
1397c478bd9Sstevel@tonic-gate		psaddr_t addr, void *buf, size_t size);
1407c478bd9Sstevel@tonic-gateps_err_e ps_pwrite(struct ps_prochandle *Pr,
1417c478bd9Sstevel@tonic-gate		psaddr_t addr, const void *buf, size_t size);
1427c478bd9Sstevel@tonic-gateps_err_e ps_pdread(struct ps_prochandle *Pr,
1437c478bd9Sstevel@tonic-gate		psaddr_t addr, void *buf, size_t size);
1447c478bd9Sstevel@tonic-gateps_err_e ps_pdwrite(struct ps_prochandle *Pr,
1457c478bd9Sstevel@tonic-gate		psaddr_t addr, const void *buf, size_t size);
1467c478bd9Sstevel@tonic-gateps_err_e ps_ptread(struct ps_prochandle *Pr,
1477c478bd9Sstevel@tonic-gate		psaddr_t addr, void *buf, size_t size);
1487c478bd9Sstevel@tonic-gateps_err_e ps_ptwrite(struct ps_prochandle *Pr,
1497c478bd9Sstevel@tonic-gate		psaddr_t addr, const void *buf, size_t size);
1507c478bd9Sstevel@tonic-gateps_err_e ps_pstop(struct ps_prochandle *Pr);
1517c478bd9Sstevel@tonic-gateps_err_e ps_pcontinue(struct ps_prochandle *Pr);
1527c478bd9Sstevel@tonic-gateps_err_e ps_lstop(struct ps_prochandle *Pr, lwpid_t lwpid);
1537c478bd9Sstevel@tonic-gateps_err_e ps_lcontinue(struct ps_prochandle *Pr, lwpid_t lwpid);
1547c478bd9Sstevel@tonic-gateps_err_e ps_lgetregs(struct ps_prochandle *Pr,
1557c478bd9Sstevel@tonic-gate		lwpid_t lwpid, prgregset_t regs);
1567c478bd9Sstevel@tonic-gateps_err_e ps_lsetregs(struct ps_prochandle *Pr,
1577c478bd9Sstevel@tonic-gate		lwpid_t lwpid, const prgregset_t regs);
1587c478bd9Sstevel@tonic-gateps_err_e ps_lgetfpregs(struct ps_prochandle *Pr,
1597c478bd9Sstevel@tonic-gate		lwpid_t lwpid, prfpregset_t *regs);
1607c478bd9Sstevel@tonic-gateps_err_e ps_lsetfpregs(struct ps_prochandle *Pr,
1617c478bd9Sstevel@tonic-gate		lwpid_t lwpid, const prfpregset_t *regs);
1627c478bd9Sstevel@tonic-gate#if defined(sparc) || defined(__sparc)
1637c478bd9Sstevel@tonic-gateps_err_e ps_lgetxregsize(struct ps_prochandle *Pr,
1647c478bd9Sstevel@tonic-gate		lwpid_t lwpid, int *xrsize);
1657c478bd9Sstevel@tonic-gateps_err_e ps_lgetxregs(struct ps_prochandle *Pr,
1667c478bd9Sstevel@tonic-gate		lwpid_t lwpid, caddr_t xregs);
1677c478bd9Sstevel@tonic-gateps_err_e ps_lsetxregs(struct ps_prochandle *Pr,
1687c478bd9Sstevel@tonic-gate		lwpid_t lwpid, caddr_t xregs);
1697c478bd9Sstevel@tonic-gate#endif	/* sparc */
1707c478bd9Sstevel@tonic-gate#if defined(__i386) || defined(__amd64)
1717c478bd9Sstevel@tonic-gateps_err_e ps_lgetLDT(struct ps_prochandle *Pr,
1727c478bd9Sstevel@tonic-gate		lwpid_t lwpid, struct ssd *ldt);
1737c478bd9Sstevel@tonic-gate#endif	/* __i386 || __amd6464 */
1747c478bd9Sstevel@tonic-gatevoid	ps_plog(const char *fmt, ...);
1757c478bd9Sstevel@tonic-gate
1767c478bd9Sstevel@tonic-gate/* Psymtab.c */
1777c478bd9Sstevel@tonic-gatevoid	Pupdate_maps(struct ps_prochandle *Pr);
1787c478bd9Sstevel@tonic-gatevoid	Pupdate_syms(struct ps_prochandle *Pr);
1797c478bd9Sstevel@tonic-gaterd_agent_t *Prd_agent(struct ps_prochandle *Pr);
1807c478bd9Sstevel@tonic-gateconst prmap_t *Paddr_to_map(struct ps_prochandle *Pr, uintptr_t addr);
1817c478bd9Sstevel@tonic-gateconst prmap_t *Paddr_to_text_map(struct ps_prochandle *Pr, uintptr_t addr);
1827c478bd9Sstevel@tonic-gateconst prmap_t *Pname_to_map(struct ps_prochandle *Pr, const char *name);
1837c478bd9Sstevel@tonic-gateconst prmap_t *Plmid_to_map(struct ps_prochandle *Pr, Lmid_t lmid,
1847c478bd9Sstevel@tonic-gate		const char *name);
1857c478bd9Sstevel@tonic-gateint	Plookup_by_addr(struct ps_prochandle *Pr, uintptr_t addr,
1867c478bd9Sstevel@tonic-gate		char *sym_name_buffer, size_t bufsize, GElf_Sym *symbolp);
1877c478bd9Sstevel@tonic-gateint	Plookup_by_name(struct ps_prochandle *Pr,
1887c478bd9Sstevel@tonic-gate		const char *object_name, const char *symbol_name,
1897c478bd9Sstevel@tonic-gate		GElf_Sym *sym);
1907c478bd9Sstevel@tonic-gateint	Plookup_by_lmid(struct ps_prochandle *Pr,
1917c478bd9Sstevel@tonic-gate		Lmid_t lmid, const char *object_name, const char *symbol_name,
1927c478bd9Sstevel@tonic-gate		GElf_Sym *sym);
1937c478bd9Sstevel@tonic-gateconst rd_loadobj_t *Paddr_to_loadobj(struct ps_prochandle *, uintptr_t);
1947c478bd9Sstevel@tonic-gateconst rd_loadobj_t *Pname_to_loadobj(struct ps_prochandle *, const char *);
1957c478bd9Sstevel@tonic-gateconst rd_loadobj_t *Plmid_to_loadobj(struct ps_prochandle *, Lmid_t,
1967c478bd9Sstevel@tonic-gate		const char *);
1977c478bd9Sstevel@tonic-gateint	Pmapping_iter(struct ps_prochandle *Pr, proc_map_f *func, void *cd);
198186f7fbfSEdward Pilatowiczint	Pmapping_iter_resolved(struct ps_prochandle *Pr, proc_map_f *func,
199186f7fbfSEdward Pilatowicz		void *cd);
2007c478bd9Sstevel@tonic-gateint	Pobject_iter(struct ps_prochandle *Pr, proc_map_f *func, void *cd);
201186f7fbfSEdward Pilatowiczint	Pobject_iter_resolved(struct ps_prochandle *Pr, proc_map_f *func,
202186f7fbfSEdward Pilatowicz		void *cd);
2037c478bd9Sstevel@tonic-gatechar	*Pobjname(struct ps_prochandle *Pr, uintptr_t addr,
2047c478bd9Sstevel@tonic-gate		char *buffer, size_t bufsize);
205186f7fbfSEdward Pilatowiczchar	*Pobjname_resolved(struct ps_prochandle *Pr, uintptr_t addr,
206186f7fbfSEdward Pilatowicz		char *buffer, size_t bufsize);
2077c478bd9Sstevel@tonic-gateint	Plmid(struct ps_prochandle *Pr, uintptr_t addr, Lmid_t *lmidp);
2087c478bd9Sstevel@tonic-gateint	Psymbol_iter(struct ps_prochandle *Pr, const char *object_name,
2097c478bd9Sstevel@tonic-gate		int which, int type, proc_sym_f *func, void *cd);
2107c478bd9Sstevel@tonic-gateint	Psymbol_iter_by_lmid(struct ps_prochandle *Pr, Lmid_t lmid,
2117c478bd9Sstevel@tonic-gate		const char *object_name, int which, int type,
2127c478bd9Sstevel@tonic-gate		proc_sym_f *func, void *cd);
2137c478bd9Sstevel@tonic-gatechar	*Pgetenv(struct ps_prochandle *Pr, const char *name,
2147c478bd9Sstevel@tonic-gate		char *buffer, size_t bufsize);
2157c478bd9Sstevel@tonic-gatechar	*Pplatform(struct ps_prochandle *Pr, char *s, size_t n);
2167c478bd9Sstevel@tonic-gateint	Puname(struct ps_prochandle *Pr, struct utsname *u);
2177c478bd9Sstevel@tonic-gatechar	*Pzonename(struct ps_prochandle *Pr, char *s, size_t n);
218186f7fbfSEdward Pilatowiczchar	*Pfindobj(struct ps_prochandle *Pr, const char *path,
219186f7fbfSEdward Pilatowicz		char *s, size_t n);
2207c478bd9Sstevel@tonic-gatechar	*Pexecname(struct ps_prochandle *Pr, char *buffer, size_t bufsize);
2217c478bd9Sstevel@tonic-gatevoid	Preset_maps(struct ps_prochandle *Pr);
2227c478bd9Sstevel@tonic-gate
2237c478bd9Sstevel@tonic-gateps_err_e ps_pglobal_lookup(struct ps_prochandle *Pr,
2247c478bd9Sstevel@tonic-gate		const char *object_name, const char *sym_name,
2257c478bd9Sstevel@tonic-gate		psaddr_t *sym_addr);
2267c478bd9Sstevel@tonic-gate
2277c478bd9Sstevel@tonic-gateps_err_e ps_pglobal_sym(struct ps_prochandle *Pr,
2287c478bd9Sstevel@tonic-gate		const char *object_name, const char *sym_name,
2297c478bd9Sstevel@tonic-gate		ps_sym_t *symp);
2307c478bd9Sstevel@tonic-gate
2317c478bd9Sstevel@tonic-gatelong	Pgetauxval(struct ps_prochandle *Pr, int type);
2327c478bd9Sstevel@tonic-gateconst auxv_t *Pgetauxvec(struct ps_prochandle *Pr);
2337c478bd9Sstevel@tonic-gateps_err_e ps_pauxv(struct ps_prochandle *Pr, const auxv_t **aux);
2347c478bd9Sstevel@tonic-gate
2357c478bd9Sstevel@tonic-gate/* Putil.c */
2367c478bd9Sstevel@tonic-gatevoid	Perror_printf(struct ps_prochandle *Pr, const char *format, ...);
2377c478bd9Sstevel@tonic-gate
2387c478bd9Sstevel@tonic-gate/* pr_door.c */
2397c478bd9Sstevel@tonic-gateint	pr_door_info(struct ps_prochandle *Pr, int did, door_info_t *di);
2407c478bd9Sstevel@tonic-gate
2417c478bd9Sstevel@tonic-gate/* pr_exit.c */
2427c478bd9Sstevel@tonic-gateint	pr_exit(struct ps_prochandle *Pr, int status);
2437c478bd9Sstevel@tonic-gateint	pr_lwp_exit(struct ps_prochandle *Pr);
2447c478bd9Sstevel@tonic-gate
2457c478bd9Sstevel@tonic-gate/* pr_fcntl.c */
2467c478bd9Sstevel@tonic-gateint	pr_fcntl(struct ps_prochandle *Pr, int fd, int cmd, void *argp);
2477c478bd9Sstevel@tonic-gate
2487c478bd9Sstevel@tonic-gate/* pr_getitimer.c */
2497c478bd9Sstevel@tonic-gateint	pr_getitimer(struct ps_prochandle *Pr,
2507c478bd9Sstevel@tonic-gate		int which, struct itimerval *itv);
2517c478bd9Sstevel@tonic-gateint	pr_setitimer(struct ps_prochandle *Pr,
2527c478bd9Sstevel@tonic-gate		int which, const struct itimerval *itv, struct itimerval *oitv);
2537c478bd9Sstevel@tonic-gate
2547c478bd9Sstevel@tonic-gate/* pr_getrctl.c */
2557c478bd9Sstevel@tonic-gateint	pr_getrctl(struct ps_prochandle *Pr, const char *rname,
2567c478bd9Sstevel@tonic-gate		rctlblk_t *old_blk, rctlblk_t *new_blk, int rflag);
2577c478bd9Sstevel@tonic-gateint   pr_setrctl(struct ps_prochandle *Pr, const char *rname,
2587c478bd9Sstevel@tonic-gate		rctlblk_t *old_blk, rctlblk_t *new_blk, int rflag);
259532877c4Srd117015int   pr_setprojrctl(struct ps_prochandle *Pr, const char *rname,
260532877c4Srd117015		rctlblk_t *new_blk, size_t size, int rflag);
2617c478bd9Sstevel@tonic-gate
2627c478bd9Sstevel@tonic-gate/* pr_getrlimit.c */
2637c478bd9Sstevel@tonic-gateint	pr_getrlimit(struct ps_prochandle *Pr,
2647c478bd9Sstevel@tonic-gate		int resource, struct rlimit *rlp);
2657c478bd9Sstevel@tonic-gateint	pr_setrlimit(struct ps_prochandle *Pr,
2667c478bd9Sstevel@tonic-gate		int resource, const struct rlimit *rlp);
2677c478bd9Sstevel@tonic-gateint	pr_getrlimit64(struct ps_prochandle *Pr,
2687c478bd9Sstevel@tonic-gate		int resource, struct rlimit64 *rlp);
2697c478bd9Sstevel@tonic-gateint	pr_setrlimit64(struct ps_prochandle *Pr,
2707c478bd9Sstevel@tonic-gate		int resource, const struct rlimit64 *rlp);
2717c478bd9Sstevel@tonic-gate
2727c478bd9Sstevel@tonic-gate/* pr_getsockname.c */
2737c478bd9Sstevel@tonic-gateint	pr_getsockname(struct ps_prochandle *Pr,
2747c478bd9Sstevel@tonic-gate		int sock, struct sockaddr *name, socklen_t *namelen);
2757c478bd9Sstevel@tonic-gateint	pr_getpeername(struct ps_prochandle *Pr,
2767c478bd9Sstevel@tonic-gate		int sock, struct sockaddr *name, socklen_t *namelen);
2777c478bd9Sstevel@tonic-gate
2787c478bd9Sstevel@tonic-gate/* pr_ioctl.c */
2797c478bd9Sstevel@tonic-gateint	pr_ioctl(struct ps_prochandle *Pr,
2807c478bd9Sstevel@tonic-gate		int fd, int code, void *buf, size_t size);
2817c478bd9Sstevel@tonic-gate
2827c478bd9Sstevel@tonic-gate/* pr_lseek.c */
2837c478bd9Sstevel@tonic-gateoff_t	pr_lseek(struct ps_prochandle *Pr,
2847c478bd9Sstevel@tonic-gate		int filedes, off_t offset, int whence);
2857c478bd9Sstevel@tonic-gateoffset_t pr_llseek(struct ps_prochandle *Pr,
2867c478bd9Sstevel@tonic-gate		int filedes, offset_t offset, int whence);
2877c478bd9Sstevel@tonic-gate
2887c478bd9Sstevel@tonic-gate/* pr_memcntl.c */
2897c478bd9Sstevel@tonic-gateint	pr_memcntl(struct ps_prochandle *Pr,
2907c478bd9Sstevel@tonic-gate	caddr_t addr, size_t len, int cmd, caddr_t arg, int attr, int mask);
2917c478bd9Sstevel@tonic-gate
2927c478bd9Sstevel@tonic-gate/* pr_mmap.c */
2937c478bd9Sstevel@tonic-gatevoid	*pr_mmap(struct ps_prochandle *Pr,
2947c478bd9Sstevel@tonic-gate		void *addr, size_t len, int prot, int flags, int fd, off_t off);
2957c478bd9Sstevel@tonic-gateint	pr_munmap(struct ps_prochandle *Pr,
2967c478bd9Sstevel@tonic-gate		void *addr, size_t len);
2977c478bd9Sstevel@tonic-gatevoid	*pr_zmap(struct ps_prochandle *Pr,
2987c478bd9Sstevel@tonic-gate		void *addr, size_t len, int prot, int flags);
2997c478bd9Sstevel@tonic-gate
3007c478bd9Sstevel@tonic-gate/* pr_open.c */
3017c478bd9Sstevel@tonic-gateint	pr_open(struct ps_prochandle *Pr,
3027c478bd9Sstevel@tonic-gate		const char *filename, int flags, mode_t mode);
3037c478bd9Sstevel@tonic-gateint	pr_creat(struct ps_prochandle *Pr,
3047c478bd9Sstevel@tonic-gate		const char *filename, mode_t mode);
3057c478bd9Sstevel@tonic-gateint	pr_close(struct ps_prochandle *Pr, int fd);
3067c478bd9Sstevel@tonic-gateint	pr_access(struct ps_prochandle *Pr, const char *path, int amode);
3077c478bd9Sstevel@tonic-gate
3087c478bd9Sstevel@tonic-gate/* pr_pbind.c */
3097c478bd9Sstevel@tonic-gateint	pr_processor_bind(struct ps_prochandle *Pr, idtype_t, id_t, int, int *);
3107c478bd9Sstevel@tonic-gate
3117c478bd9Sstevel@tonic-gate/* pr_rename.c */
3127c478bd9Sstevel@tonic-gateint	pr_rename(struct ps_prochandle *Pr, const char *old, const char *new);
3137c478bd9Sstevel@tonic-gateint	pr_link(struct ps_prochandle *Pr, const char *exist, const char *new);
3147c478bd9Sstevel@tonic-gateint	pr_unlink(struct ps_prochandle *Pr, const char *);
3157c478bd9Sstevel@tonic-gate
3167c478bd9Sstevel@tonic-gate/* pr_sigaction.c */
3177c478bd9Sstevel@tonic-gateint	pr_sigaction(struct ps_prochandle *Pr,
3187c478bd9Sstevel@tonic-gate		int sig, const struct sigaction *act, struct sigaction *oact);
3197c478bd9Sstevel@tonic-gate
3207c478bd9Sstevel@tonic-gate/* pr_stat.c */
3217c478bd9Sstevel@tonic-gateint	pr_stat(struct ps_prochandle *Pr, const char *path, struct stat *buf);
3227c478bd9Sstevel@tonic-gateint	pr_lstat(struct ps_prochandle *Pr, const char *path, struct stat *buf);
3237c478bd9Sstevel@tonic-gateint	pr_fstat(struct ps_prochandle *Pr, int fd, struct stat *buf);
3247c478bd9Sstevel@tonic-gateint	pr_stat64(struct ps_prochandle *Pr, const char *path,
3257c478bd9Sstevel@tonic-gate		struct stat64 *buf);
3267c478bd9Sstevel@tonic-gateint	pr_lstat64(struct ps_prochandle *Pr, const char *path,
3277c478bd9Sstevel@tonic-gate		struct stat64 *buf);
3287c478bd9Sstevel@tonic-gateint	pr_fstat64(struct ps_prochandle *Pr, int fd, struct stat64 *buf);
3297c478bd9Sstevel@tonic-gate
3307c478bd9Sstevel@tonic-gate/* pr_statvfs.c */
3317c478bd9Sstevel@tonic-gateint	pr_statvfs(struct ps_prochandle *Pr, const char *path, statvfs_t *buf);
3327c478bd9Sstevel@tonic-gateint	pr_fstatvfs(struct ps_prochandle *Pr, int fd, statvfs_t *buf);
3337c478bd9Sstevel@tonic-gate
3347c478bd9Sstevel@tonic-gate/* pr_tasksys.c */
3357c478bd9Sstevel@tonic-gateprojid_t pr_getprojid(struct ps_prochandle *Pr);
3367c478bd9Sstevel@tonic-gatetaskid_t pr_gettaskid(struct ps_prochandle *Pr);
3377c478bd9Sstevel@tonic-gatetaskid_t pr_settaskid(struct ps_prochandle *Pr, projid_t project, int flags);
3387c478bd9Sstevel@tonic-gate
3397c478bd9Sstevel@tonic-gate/* pr_waitid.c */
3407c478bd9Sstevel@tonic-gateint	pr_waitid(struct ps_prochandle *Pr,
3417c478bd9Sstevel@tonic-gate		idtype_t idtype, id_t id, siginfo_t *infop, int options);
3427c478bd9Sstevel@tonic-gate
3437c478bd9Sstevel@tonic-gate/* proc_get_info.c */
3447c478bd9Sstevel@tonic-gateint	proc_get_cred(pid_t pid, prcred_t *credp, int ngroups);
3457c478bd9Sstevel@tonic-gateprpriv_t *proc_get_priv(pid_t pid);
3467c478bd9Sstevel@tonic-gateint	proc_get_psinfo(pid_t pid, psinfo_t *psp);
3477c478bd9Sstevel@tonic-gateint	proc_get_status(pid_t pid, pstatus_t *psp);
3487c478bd9Sstevel@tonic-gateint	proc_get_auxv(pid_t pid, auxv_t *pauxv, int naux);
3497c478bd9Sstevel@tonic-gate
3507c478bd9Sstevel@tonic-gate/* proc_names.c */
3517c478bd9Sstevel@tonic-gatechar	*proc_fltname(int flt, char *buf, size_t bufsz);
3527c478bd9Sstevel@tonic-gatechar	*proc_signame(int sig, char *buf, size_t bufsz);
3537c478bd9Sstevel@tonic-gatechar	*proc_sysname(int sys, char *buf, size_t bufsz);
3547c478bd9Sstevel@tonic-gate
3557c478bd9Sstevel@tonic-gateint	proc_str2flt(const char *str, int *fltnum);
3567c478bd9Sstevel@tonic-gateint	proc_str2sig(const char *str, int *signum);
3577c478bd9Sstevel@tonic-gateint	proc_str2sys(const char *str, int *sysnum);
3587c478bd9Sstevel@tonic-gate
3597c478bd9Sstevel@tonic-gatechar	*proc_fltset2str(const fltset_t *set, const char *delim, int members,
3607c478bd9Sstevel@tonic-gate		char *buf, size_t nbytes);
3617c478bd9Sstevel@tonic-gatechar	*proc_sigset2str(const sigset_t *set, const char *delim, int members,
3627c478bd9Sstevel@tonic-gate		char *buf, size_t nbytes);
3637c478bd9Sstevel@tonic-gatechar	*proc_sysset2str(const sysset_t *set, const char *delim, int members,
3647c478bd9Sstevel@tonic-gate		char *buf, size_t nbytes);
3657c478bd9Sstevel@tonic-gate
3667c478bd9Sstevel@tonic-gatechar	*proc_str2fltset(const char *str, const char *delim, int members,
3677c478bd9Sstevel@tonic-gate		fltset_t *set);
3687c478bd9Sstevel@tonic-gatechar	*proc_str2sigset(const char *str, const char *delim, int members,
3697c478bd9Sstevel@tonic-gate		sigset_t *set);
3707c478bd9Sstevel@tonic-gatechar	*proc_str2sysset(const char *str, const char *delim, int members,
3717c478bd9Sstevel@tonic-gate		sysset_t *set);
3727c478bd9Sstevel@tonic-gate
3737c478bd9Sstevel@tonic-gateint	proc_walk(proc_walk_f *func, void *arg, int flags);
3747c478bd9Sstevel@tonic-gate
3757c478bd9Sstevel@tonic-gate/* proc_arg.c */
3767c478bd9Sstevel@tonic-gatestruct ps_prochandle *proc_arg_grab(const char *arg,
3777c478bd9Sstevel@tonic-gate	int oflag, int gflag, int *perr);
3787c478bd9Sstevel@tonic-gate
3797c478bd9Sstevel@tonic-gatepid_t	proc_arg_psinfo(const char *arg, int oflag, psinfo_t *psp, int *perr);
3807c478bd9Sstevel@tonic-gatevoid	proc_unctrl_psinfo(psinfo_t *psp);
3817c478bd9Sstevel@tonic-gate
3827c478bd9Sstevel@tonic-gate/* proc_set.c */
3837c478bd9Sstevel@tonic-gateint	Psetcred(struct ps_prochandle *Pr, const prcred_t *pcred);
3847c478bd9Sstevel@tonic-gate
3857c478bd9Sstevel@tonic-gate/* Pstack.c */
3867c478bd9Sstevel@tonic-gateint	Pstack_iter(struct ps_prochandle *Pr,
3877c478bd9Sstevel@tonic-gate		const prgregset_t regs, proc_stack_f *func, void *arg);
3887c478bd9Sstevel@tonic-gate
3897c478bd9Sstevel@tonic-gate/* Pisadep.c */
3907c478bd9Sstevel@tonic-gateconst char *Ppltdest(struct ps_prochandle *Pr, uintptr_t addr);
391