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