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
59acbbeafSnn  * Common Development and Distribution License (the "License").
69acbbeafSnn  * 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  */
21ed9c9f97SRoger A. Faulkner 
227c478bd9Sstevel@tonic-gate /*
23ed9c9f97SRoger A. Faulkner  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25cd11e192Sjhaslam  *
26cd11e192Sjhaslam  * Portions Copyright 2007 Chad Mynhier
2734bdffbfSGarrett D'Amore  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
28a63fed2aSJason King  * Copyright 2019 Joyent, Inc.
292a12f85aSJeremy Jones  * Copyright (c) 2013 by Delphix. All rights reserved.
30542a7b7fSCarlos Neira  * Copyright 2019, Carlos Neira <cneirabustos@gmail.com>
31a02120c4SAndy Fiddaman  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
32ed093b41SRobert Mustacchi  * Copyright 2023 Oxide Computer Company
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Interfaces available from the process control library, libproc.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifndef	_LIBPROC_H
407c478bd9Sstevel@tonic-gate #define	_LIBPROC_H
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #include <stdlib.h>
437c478bd9Sstevel@tonic-gate #include <unistd.h>
447c478bd9Sstevel@tonic-gate #include <fcntl.h>
457c478bd9Sstevel@tonic-gate #include <nlist.h>
467c478bd9Sstevel@tonic-gate #include <door.h>
477c478bd9Sstevel@tonic-gate #include <gelf.h>
487c478bd9Sstevel@tonic-gate #include <proc_service.h>
497c478bd9Sstevel@tonic-gate #include <rtld_db.h>
507c478bd9Sstevel@tonic-gate #include <procfs.h>
51a154f012SAlexander Stetsenko #include <ucred.h>
527c478bd9Sstevel@tonic-gate #include <rctl.h>
537c478bd9Sstevel@tonic-gate #include <libctf.h>
547c478bd9Sstevel@tonic-gate #include <sys/stat.h>
557c478bd9Sstevel@tonic-gate #include <sys/statvfs.h>
567c478bd9Sstevel@tonic-gate #include <sys/auxv.h>
577c478bd9Sstevel@tonic-gate #include <sys/resource.h>
587c478bd9Sstevel@tonic-gate #include <sys/socket.h>
597c478bd9Sstevel@tonic-gate #include <sys/utsname.h>
607c478bd9Sstevel@tonic-gate #include <sys/corectl.h>
61d2a70789SRichard Lowe #include <sys/secflags.h>
627c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
637c478bd9Sstevel@tonic-gate #include <sys/sysi86.h>
647c478bd9Sstevel@tonic-gate #endif
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
677c478bd9Sstevel@tonic-gate extern "C" {
687c478bd9Sstevel@tonic-gate #endif
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * Opaque structure tag reference to a process control structure.
727c478bd9Sstevel@tonic-gate  * Clients of libproc cannot look inside the process control structure.
737c478bd9Sstevel@tonic-gate  * The implementation of struct ps_prochandle can change w/o affecting clients.
747c478bd9Sstevel@tonic-gate  */
757c478bd9Sstevel@tonic-gate struct ps_prochandle;
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * Opaque structure tag reference to an lwp control structure.
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate struct ps_lwphandle;
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate extern	int	_libproc_debug;	/* set non-zero to enable debugging fprintfs */
83d7755b5aSrh extern	int	_libproc_no_qsort;	/* set non-zero to inhibit sorting */
84d7755b5aSrh 					/* of symbol tables */
85d9452f23SEdward Pilatowicz extern	int	_libproc_incore_elf;	/* only use in-core elf data */
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate #if defined(__sparc)
887c478bd9Sstevel@tonic-gate #define	R_RVAL1	R_O0		/* register holding a function return value */
897c478bd9Sstevel@tonic-gate #define	R_RVAL2	R_O1		/* 32 more bits for a 64-bit return value */
907c478bd9Sstevel@tonic-gate #endif	/* __sparc */
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #if defined(__amd64)
937c478bd9Sstevel@tonic-gate #define	R_PC	REG_RIP
947c478bd9Sstevel@tonic-gate #define	R_SP	REG_RSP
957c478bd9Sstevel@tonic-gate #define	R_RVAL1	REG_RAX		/* register holding a function return value */
967c478bd9Sstevel@tonic-gate #define	R_RVAL2	REG_RDX		/* 32 more bits for a 64-bit return value */
977c478bd9Sstevel@tonic-gate #elif defined(__i386)
987c478bd9Sstevel@tonic-gate #define	R_PC	EIP
997c478bd9Sstevel@tonic-gate #define	R_SP	UESP
1007c478bd9Sstevel@tonic-gate #define	R_RVAL1	EAX		/* register holding a function return value */
1017c478bd9Sstevel@tonic-gate #define	R_RVAL2	EDX		/* 32 more bits for a 64-bit return value */
1027c478bd9Sstevel@tonic-gate #endif	/* __amd64 || __i386 */
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate #define	R_RVAL	R_RVAL1		/* simple function return value register */
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate /* maximum sizes of things */
1077c478bd9Sstevel@tonic-gate #define	PRMAXSIG	(32 * sizeof (sigset_t) / sizeof (uint32_t))
1087c478bd9Sstevel@tonic-gate #define	PRMAXFAULT	(32 * sizeof (fltset_t) / sizeof (uint32_t))
1097c478bd9Sstevel@tonic-gate #define	PRMAXSYS	(32 * sizeof (sysset_t) / sizeof (uint32_t))
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate /* State values returned by Pstate() */
1127c478bd9Sstevel@tonic-gate #define	PS_RUN		1	/* process is running */
1137c478bd9Sstevel@tonic-gate #define	PS_STOP		2	/* process is stopped */
1147c478bd9Sstevel@tonic-gate #define	PS_LOST		3	/* process is lost to control (EAGAIN) */
1157c478bd9Sstevel@tonic-gate #define	PS_UNDEAD	4	/* process is terminated (zombie) */
1167c478bd9Sstevel@tonic-gate #define	PS_DEAD		5	/* process is terminated (core file) */
1177c478bd9Sstevel@tonic-gate #define	PS_IDLE		6	/* process has not been run */
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /* Flags accepted by Pgrab() */
1207c478bd9Sstevel@tonic-gate #define	PGRAB_RETAIN	0x01	/* Retain tracing flags, else clear flags */
1217c478bd9Sstevel@tonic-gate #define	PGRAB_FORCE	0x02	/* Open the process w/o O_EXCL */
1227c478bd9Sstevel@tonic-gate #define	PGRAB_RDONLY	0x04	/* Open the process or core w/ O_RDONLY */
1237c478bd9Sstevel@tonic-gate #define	PGRAB_NOSTOP	0x08	/* Open the process but do not stop it */
1242a12f85aSJeremy Jones #define	PGRAB_INCORE	0x10	/* Use in-core data to build symbol tables */
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate /* Error codes from Pcreate() */
1277c478bd9Sstevel@tonic-gate #define	C_STRANGE	-1	/* Unanticipated error, errno is meaningful */
1287c478bd9Sstevel@tonic-gate #define	C_FORK		1	/* Unable to fork */
1297c478bd9Sstevel@tonic-gate #define	C_PERM		2	/* No permission (file set-id or unreadable) */
1307c478bd9Sstevel@tonic-gate #define	C_NOEXEC	3	/* Cannot execute file */
1317c478bd9Sstevel@tonic-gate #define	C_INTR		4	/* Interrupt received while creating */
1327c478bd9Sstevel@tonic-gate #define	C_LP64		5	/* Program is _LP64, self is _ILP32 */
1337c478bd9Sstevel@tonic-gate #define	C_NOENT		6	/* Cannot find executable file */
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate /* Error codes from Pgrab(), Pfgrab_core(), and Pgrab_core() */
1367c478bd9Sstevel@tonic-gate #define	G_STRANGE	-1	/* Unanticipated error, errno is meaningful */
1377c478bd9Sstevel@tonic-gate #define	G_NOPROC	1	/* No such process */
1387c478bd9Sstevel@tonic-gate #define	G_NOCORE	2	/* No such core file */
1397c478bd9Sstevel@tonic-gate #define	G_NOPROCORCORE	3	/* No such proc or core (for proc_arg_grab) */
1407c478bd9Sstevel@tonic-gate #define	G_NOEXEC	4	/* Cannot locate executable file */
1417c478bd9Sstevel@tonic-gate #define	G_ZOMB		5	/* Zombie process */
1427c478bd9Sstevel@tonic-gate #define	G_PERM		6	/* No permission */
1437c478bd9Sstevel@tonic-gate #define	G_BUSY		7	/* Another process has control */
1447c478bd9Sstevel@tonic-gate #define	G_SYS		8	/* System process */
1457c478bd9Sstevel@tonic-gate #define	G_SELF		9	/* Process is self */
1467c478bd9Sstevel@tonic-gate #define	G_INTR		10	/* Interrupt received while grabbing */
1477c478bd9Sstevel@tonic-gate #define	G_LP64		11	/* Process is _LP64, self is ILP32 */
1487c478bd9Sstevel@tonic-gate #define	G_FORMAT	12	/* File is not an ELF format core file */
1497c478bd9Sstevel@tonic-gate #define	G_ELF		13	/* Libelf error, elf_errno() is meaningful */
1507c478bd9Sstevel@tonic-gate #define	G_NOTE		14	/* Required PT_NOTE Phdr not present in core */
1517c478bd9Sstevel@tonic-gate #define	G_ISAINVAL	15	/* Wrong ELF machine type */
1527c478bd9Sstevel@tonic-gate #define	G_BADLWPS	16	/* Bad '/lwps' specification */
153cd11e192Sjhaslam #define	G_NOFD		17	/* No more file descriptors */
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate /* Flags accepted by Prelease */
1577c478bd9Sstevel@tonic-gate #define	PRELEASE_CLEAR	0x10	/* Clear all tracing flags */
1587c478bd9Sstevel@tonic-gate #define	PRELEASE_RETAIN	0x20	/* Retain final tracing flags */
1597c478bd9Sstevel@tonic-gate #define	PRELEASE_HANG	0x40	/* Leave the process stopped */
1607c478bd9Sstevel@tonic-gate #define	PRELEASE_KILL	0x80	/* Terminate the process */
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate typedef	struct {	/* argument descriptor for system call (Psyscall) */
1637c478bd9Sstevel@tonic-gate 	long	arg_value;	/* value of argument given to system call */
1647c478bd9Sstevel@tonic-gate 	void	*arg_object;	/* pointer to object in controlling process */
1657c478bd9Sstevel@tonic-gate 	char	arg_type;	/* AT_BYVAL, AT_BYREF */
1667c478bd9Sstevel@tonic-gate 	char	arg_inout;	/* AI_INPUT, AI_OUTPUT, AI_INOUT */
1677c478bd9Sstevel@tonic-gate 	ushort_t arg_size;	/* if AT_BYREF, size of object in bytes */
1687c478bd9Sstevel@tonic-gate } argdes_t;
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate /* values for type */
1717c478bd9Sstevel@tonic-gate #define	AT_BYVAL	1
1727c478bd9Sstevel@tonic-gate #define	AT_BYREF	2
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate /* values for inout */
1757c478bd9Sstevel@tonic-gate #define	AI_INPUT	1
1767c478bd9Sstevel@tonic-gate #define	AI_OUTPUT	2
1777c478bd9Sstevel@tonic-gate #define	AI_INOUT	3
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate /* maximum number of syscall arguments */
1807c478bd9Sstevel@tonic-gate #define	MAXARGS		8
1817c478bd9Sstevel@tonic-gate 
1827c478bd9Sstevel@tonic-gate /* maximum size in bytes of a BYREF argument */
1837c478bd9Sstevel@tonic-gate #define	MAXARGL		(4*1024)
1847c478bd9Sstevel@tonic-gate 
1852a12f85aSJeremy Jones /*
1862a12f85aSJeremy Jones  * Ops vector definition for the Pgrab_ops().
1872a12f85aSJeremy Jones  */
1882a12f85aSJeremy Jones typedef ssize_t (*pop_pread_t)(struct ps_prochandle *, void *, size_t,
1892a12f85aSJeremy Jones     uintptr_t, void *);
1902a12f85aSJeremy Jones typedef ssize_t (*pop_pwrite_t)(struct ps_prochandle *, const void *, size_t,
1912a12f85aSJeremy Jones     uintptr_t, void *);
1922a12f85aSJeremy Jones typedef int (*pop_read_maps_t)(struct ps_prochandle *, prmap_t **, ssize_t *,
1932a12f85aSJeremy Jones     void *);
1942a12f85aSJeremy Jones typedef void (*pop_read_aux_t)(struct ps_prochandle *, auxv_t **, int *,
1952a12f85aSJeremy Jones     void *);
1962a12f85aSJeremy Jones typedef int (*pop_cred_t)(struct ps_prochandle *, prcred_t *, int,
1972a12f85aSJeremy Jones     void *);
1982a12f85aSJeremy Jones typedef int (*pop_priv_t)(struct ps_prochandle *, prpriv_t **, void *);
199d2a70789SRichard Lowe typedef int (*pop_secflags_t)(struct ps_prochandle *, prsecflags_t **, void *);
2002a12f85aSJeremy Jones typedef const psinfo_t *(*pop_psinfo_t)(struct ps_prochandle *, psinfo_t *,
2012a12f85aSJeremy Jones     void *);
2022a12f85aSJeremy Jones typedef void (*pop_status_t)(struct ps_prochandle *, pstatus_t *, void *);
2032a12f85aSJeremy Jones typedef prheader_t *(*pop_lstatus_t)(struct ps_prochandle *, void *);
2042a12f85aSJeremy Jones typedef prheader_t *(*pop_lpsinfo_t)(struct ps_prochandle *, void *);
2052a12f85aSJeremy Jones typedef void (*pop_fini_t)(struct ps_prochandle *, void *);
2062a12f85aSJeremy Jones typedef char *(*pop_platform_t)(struct ps_prochandle *, char *, size_t, void *);
2072a12f85aSJeremy Jones typedef int (*pop_uname_t)(struct ps_prochandle *, struct utsname *, void *);
2082a12f85aSJeremy Jones typedef char *(*pop_zonename_t)(struct ps_prochandle *, char *, size_t, void *);
2092a12f85aSJeremy Jones typedef char *(*pop_execname_t)(struct ps_prochandle *, char *, size_t, void *);
2102a12f85aSJeremy Jones #if defined(__i386) || defined(__amd64)
2112a12f85aSJeremy Jones typedef int (*pop_ldt_t)(struct ps_prochandle *, struct ssd *, int, void *);
2122a12f85aSJeremy Jones #endif
2132a12f85aSJeremy Jones 
2142a12f85aSJeremy Jones typedef struct ps_ops {
2152a12f85aSJeremy Jones 	pop_pread_t		pop_pread;
2162a12f85aSJeremy Jones 	pop_pwrite_t		pop_pwrite;
2172a12f85aSJeremy Jones 	pop_read_maps_t		pop_read_maps;
2182a12f85aSJeremy Jones 	pop_read_aux_t		pop_read_aux;
2192a12f85aSJeremy Jones 	pop_cred_t		pop_cred;
2202a12f85aSJeremy Jones 	pop_priv_t		pop_priv;
2212a12f85aSJeremy Jones 	pop_psinfo_t		pop_psinfo;
2222a12f85aSJeremy Jones 	pop_status_t		pop_status;
2232a12f85aSJeremy Jones 	pop_lstatus_t		pop_lstatus;
2242a12f85aSJeremy Jones 	pop_lpsinfo_t		pop_lpsinfo;
2252a12f85aSJeremy Jones 	pop_fini_t		pop_fini;
2262a12f85aSJeremy Jones 	pop_platform_t		pop_platform;
2272a12f85aSJeremy Jones 	pop_uname_t		pop_uname;
2282a12f85aSJeremy Jones 	pop_zonename_t		pop_zonename;
2292a12f85aSJeremy Jones 	pop_execname_t		pop_execname;
230d2a70789SRichard Lowe 	pop_secflags_t		pop_secflags;
2312a12f85aSJeremy Jones #if defined(__i386) || defined(__amd64)
2322a12f85aSJeremy Jones 	pop_ldt_t		pop_ldt;
2332a12f85aSJeremy Jones #endif
2342a12f85aSJeremy Jones } ps_ops_t;
2352a12f85aSJeremy Jones 
2367c478bd9Sstevel@tonic-gate /*
2377c478bd9Sstevel@tonic-gate  * Function prototypes for routines in the process control package.
2387c478bd9Sstevel@tonic-gate  */
2397c478bd9Sstevel@tonic-gate extern struct ps_prochandle *Pcreate(const char *, char *const *,
2407c478bd9Sstevel@tonic-gate     int *, char *, size_t);
2417c478bd9Sstevel@tonic-gate extern struct ps_prochandle *Pxcreate(const char *, char *const *,
2427c478bd9Sstevel@tonic-gate     char *const *, int *, char *, size_t);
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate extern const char *Pcreate_error(int);
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate extern struct ps_prochandle *Pgrab(pid_t, int, int *);
2477c478bd9Sstevel@tonic-gate extern struct ps_prochandle *Pgrab_core(const char *, const char *, int, int *);
2487c478bd9Sstevel@tonic-gate extern struct ps_prochandle *Pfgrab_core(int, const char *, int *);
2497c478bd9Sstevel@tonic-gate extern struct ps_prochandle *Pgrab_file(const char *, int *);
2502a12f85aSJeremy Jones extern struct ps_prochandle *Pgrab_ops(pid_t, void *, const ps_ops_t *, int);
2517c478bd9Sstevel@tonic-gate extern const char *Pgrab_error(int);
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate extern	int	Preopen(struct ps_prochandle *);
2547c478bd9Sstevel@tonic-gate extern	void	Prelease(struct ps_prochandle *, int);
2557c478bd9Sstevel@tonic-gate extern	void	Pfree(struct ps_prochandle *);
2567c478bd9Sstevel@tonic-gate 
2577c478bd9Sstevel@tonic-gate extern	int	Pasfd(struct ps_prochandle *);
2589acbbeafSnn extern	char   *Pbrandname(struct ps_prochandle *, char *, size_t);
2597c478bd9Sstevel@tonic-gate extern	int	Pctlfd(struct ps_prochandle *);
2607c478bd9Sstevel@tonic-gate extern	int	Pcreate_agent(struct ps_prochandle *);
2617c478bd9Sstevel@tonic-gate extern	void	Pdestroy_agent(struct ps_prochandle *);
2627c478bd9Sstevel@tonic-gate extern	int	Pstopstatus(struct ps_prochandle *, long, uint_t);
2637c478bd9Sstevel@tonic-gate extern	int	Pwait(struct ps_prochandle *, uint_t);
2647c478bd9Sstevel@tonic-gate extern	int	Pstop(struct ps_prochandle *, uint_t);
2657c478bd9Sstevel@tonic-gate extern	int	Pdstop(struct ps_prochandle *);
2667c478bd9Sstevel@tonic-gate extern	int	Pstate(struct ps_prochandle *);
2677c478bd9Sstevel@tonic-gate extern	const psinfo_t *Ppsinfo(struct ps_prochandle *);
2687c478bd9Sstevel@tonic-gate extern	const pstatus_t *Pstatus(struct ps_prochandle *);
2697c478bd9Sstevel@tonic-gate extern	int	Pcred(struct ps_prochandle *, prcred_t *, int);
2707c478bd9Sstevel@tonic-gate extern	int	Psetcred(struct ps_prochandle *, const prcred_t *);
2712a12f85aSJeremy Jones extern	int	Ppriv(struct ps_prochandle *, prpriv_t **);
27243051d27SRobert Mustacchi extern	void	Ppriv_free(struct ps_prochandle *, prpriv_t *);
2737c478bd9Sstevel@tonic-gate extern	int	Psetpriv(struct ps_prochandle *, prpriv_t *);
2747c478bd9Sstevel@tonic-gate extern	void   *Pprivinfo(struct ps_prochandle *);
2757c478bd9Sstevel@tonic-gate extern	int	Psetzoneid(struct ps_prochandle *, zoneid_t);
2767c478bd9Sstevel@tonic-gate extern	int	Pgetareg(struct ps_prochandle *, int, prgreg_t *);
2777c478bd9Sstevel@tonic-gate extern	int	Pputareg(struct ps_prochandle *, int, prgreg_t);
2787c478bd9Sstevel@tonic-gate extern	int	Psetrun(struct ps_prochandle *, int, int);
279d2a70789SRichard Lowe extern	int	Psecflags(struct ps_prochandle *, prsecflags_t **);
280d2a70789SRichard Lowe extern	void	Psecflags_free(prsecflags_t *);
2817c478bd9Sstevel@tonic-gate extern	ssize_t	Pread(struct ps_prochandle *, void *, size_t, uintptr_t);
2827c478bd9Sstevel@tonic-gate extern	ssize_t Pread_string(struct ps_prochandle *, char *, size_t, uintptr_t);
2837c478bd9Sstevel@tonic-gate extern	ssize_t	Pwrite(struct ps_prochandle *, const void *, size_t, uintptr_t);
2847c478bd9Sstevel@tonic-gate extern	int	Pclearsig(struct ps_prochandle *);
2857c478bd9Sstevel@tonic-gate extern	int	Pclearfault(struct ps_prochandle *);
2867c478bd9Sstevel@tonic-gate extern	int	Psetbkpt(struct ps_prochandle *, uintptr_t, ulong_t *);
2877c478bd9Sstevel@tonic-gate extern	int	Pdelbkpt(struct ps_prochandle *, uintptr_t, ulong_t);
2887c478bd9Sstevel@tonic-gate extern	int	Pxecbkpt(struct ps_prochandle *, ulong_t);
2897c478bd9Sstevel@tonic-gate extern	int	Psetwapt(struct ps_prochandle *, const prwatch_t *);
2907c478bd9Sstevel@tonic-gate extern	int	Pdelwapt(struct ps_prochandle *, const prwatch_t *);
2917c478bd9Sstevel@tonic-gate extern	int	Pxecwapt(struct ps_prochandle *, const prwatch_t *);
2927c478bd9Sstevel@tonic-gate extern	int	Psetflags(struct ps_prochandle *, long);
2937c478bd9Sstevel@tonic-gate extern	int	Punsetflags(struct ps_prochandle *, long);
2947c478bd9Sstevel@tonic-gate extern	int	Psignal(struct ps_prochandle *, int, int);
2957c478bd9Sstevel@tonic-gate extern	int	Pfault(struct ps_prochandle *, int, int);
2967c478bd9Sstevel@tonic-gate extern	int	Psysentry(struct ps_prochandle *, int, int);
2977c478bd9Sstevel@tonic-gate extern	int	Psysexit(struct ps_prochandle *, int, int);
2987c478bd9Sstevel@tonic-gate extern	void	Psetsignal(struct ps_prochandle *, const sigset_t *);
2997c478bd9Sstevel@tonic-gate extern	void	Psetfault(struct ps_prochandle *, const fltset_t *);
3007c478bd9Sstevel@tonic-gate extern	void	Psetsysentry(struct ps_prochandle *, const sysset_t *);
3017c478bd9Sstevel@tonic-gate extern	void	Psetsysexit(struct ps_prochandle *, const sysset_t *);
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate extern	void	Psync(struct ps_prochandle *);
3047c478bd9Sstevel@tonic-gate extern	int	Psyscall(struct ps_prochandle *, sysret_t *,
3057c478bd9Sstevel@tonic-gate 			int, uint_t, argdes_t *);
3067c478bd9Sstevel@tonic-gate extern	int	Pisprocdir(struct ps_prochandle *, const char *);
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate /*
3097c478bd9Sstevel@tonic-gate  * Function prototypes for lwp-specific operations.
3107c478bd9Sstevel@tonic-gate  */
3117c478bd9Sstevel@tonic-gate extern	struct ps_lwphandle *Lgrab(struct ps_prochandle *, lwpid_t, int *);
3127c478bd9Sstevel@tonic-gate extern	const char *Lgrab_error(int);
3137c478bd9Sstevel@tonic-gate 
3147c478bd9Sstevel@tonic-gate extern	struct ps_prochandle *Lprochandle(struct ps_lwphandle *);
3157c478bd9Sstevel@tonic-gate extern	void	Lfree(struct ps_lwphandle *);
3167c478bd9Sstevel@tonic-gate 
3177c478bd9Sstevel@tonic-gate extern	int	Lctlfd(struct ps_lwphandle *);
3187c478bd9Sstevel@tonic-gate extern	int	Lwait(struct ps_lwphandle *, uint_t);
3197c478bd9Sstevel@tonic-gate extern	int	Lstop(struct ps_lwphandle *, uint_t);
3207c478bd9Sstevel@tonic-gate extern	int	Ldstop(struct ps_lwphandle *);
3217c478bd9Sstevel@tonic-gate extern	int	Lstate(struct ps_lwphandle *);
3227c478bd9Sstevel@tonic-gate extern	const lwpsinfo_t *Lpsinfo(struct ps_lwphandle *);
3237c478bd9Sstevel@tonic-gate extern	const lwpstatus_t *Lstatus(struct ps_lwphandle *);
3247c478bd9Sstevel@tonic-gate extern	int	Lgetareg(struct ps_lwphandle *, int, prgreg_t *);
3257c478bd9Sstevel@tonic-gate extern	int	Lputareg(struct ps_lwphandle *, int, prgreg_t);
3267c478bd9Sstevel@tonic-gate extern	int	Lsetrun(struct ps_lwphandle *, int, int);
3277c478bd9Sstevel@tonic-gate extern	int	Lclearsig(struct ps_lwphandle *);
3287c478bd9Sstevel@tonic-gate extern	int	Lclearfault(struct ps_lwphandle *);
3297c478bd9Sstevel@tonic-gate extern	int	Lxecbkpt(struct ps_lwphandle *, ulong_t);
3307c478bd9Sstevel@tonic-gate extern	int	Lxecwapt(struct ps_lwphandle *, const prwatch_t *);
3317c478bd9Sstevel@tonic-gate extern	void	Lsync(struct ps_lwphandle *);
3327c478bd9Sstevel@tonic-gate 
3337c478bd9Sstevel@tonic-gate extern	int	Lstack(struct ps_lwphandle *, stack_t *);
3347c478bd9Sstevel@tonic-gate extern	int	Lmain_stack(struct ps_lwphandle *, stack_t *);
3357c478bd9Sstevel@tonic-gate extern	int	Lalt_stack(struct ps_lwphandle *, stack_t *);
3367c478bd9Sstevel@tonic-gate 
337ed093b41SRobert Mustacchi extern int	Lgetregs(struct ps_lwphandle *, prgregset_t *);
338ed093b41SRobert Mustacchi extern int	Lsetregs(struct ps_lwphandle *, const prgregset_t *);
339ed093b41SRobert Mustacchi extern int	Lgetfpregs(struct ps_lwphandle *, prfpregset_t *);
340ed093b41SRobert Mustacchi extern int	Lsetfpregs(struct ps_lwphandle *, const prfpregset_t *);
341ed093b41SRobert Mustacchi extern int	Lgetxregs(struct ps_lwphandle *, prxregset_t **, size_t *);
342ed093b41SRobert Mustacchi extern int	Lsetxregs(struct ps_lwphandle *, const prxregset_t *, size_t);
343ed093b41SRobert Mustacchi 
3447c478bd9Sstevel@tonic-gate /*
3457c478bd9Sstevel@tonic-gate  * Function prototypes for system calls forced on the victim process.
3467c478bd9Sstevel@tonic-gate  */
3477c478bd9Sstevel@tonic-gate extern	int	pr_open(struct ps_prochandle *, const char *, int, mode_t);
3487c478bd9Sstevel@tonic-gate extern	int	pr_creat(struct ps_prochandle *, const char *, mode_t);
3497c478bd9Sstevel@tonic-gate extern	int	pr_close(struct ps_prochandle *, int);
3507c478bd9Sstevel@tonic-gate extern	int	pr_access(struct ps_prochandle *, const char *, int);
3517c478bd9Sstevel@tonic-gate extern	int	pr_door_info(struct ps_prochandle *, int, struct door_info *);
3527c478bd9Sstevel@tonic-gate extern	void	*pr_mmap(struct ps_prochandle *,
3537c478bd9Sstevel@tonic-gate 			void *, size_t, int, int, int, off_t);
3547c478bd9Sstevel@tonic-gate extern	void	*pr_zmap(struct ps_prochandle *,
3557c478bd9Sstevel@tonic-gate 			void *, size_t, int, int);
3567c478bd9Sstevel@tonic-gate extern	int	pr_munmap(struct ps_prochandle *, void *, size_t);
3577c478bd9Sstevel@tonic-gate extern	int	pr_memcntl(struct ps_prochandle *,
3587c478bd9Sstevel@tonic-gate 			caddr_t, size_t, int, caddr_t, int, int);
3597c478bd9Sstevel@tonic-gate extern	int	pr_meminfo(struct ps_prochandle *, const uint64_t *addrs,
3607c478bd9Sstevel@tonic-gate 			int addr_count, const uint_t *info, int info_count,
3617c478bd9Sstevel@tonic-gate 			uint64_t *outdata, uint_t *validity);
3627c478bd9Sstevel@tonic-gate extern	int	pr_sigaction(struct ps_prochandle *,
3637c478bd9Sstevel@tonic-gate 			int, const struct sigaction *, struct sigaction *);
3647c478bd9Sstevel@tonic-gate extern	int	pr_getitimer(struct ps_prochandle *,
3657c478bd9Sstevel@tonic-gate 			int, struct itimerval *);
3667c478bd9Sstevel@tonic-gate extern	int	pr_setitimer(struct ps_prochandle *,
3677c478bd9Sstevel@tonic-gate 			int, const struct itimerval *, struct itimerval *);
3687c478bd9Sstevel@tonic-gate extern	int	pr_ioctl(struct ps_prochandle *, int, int, void *, size_t);
3697c478bd9Sstevel@tonic-gate extern	int	pr_fcntl(struct ps_prochandle *, int, int, void *);
3707c478bd9Sstevel@tonic-gate extern	int	pr_stat(struct ps_prochandle *, const char *, struct stat *);
3717c478bd9Sstevel@tonic-gate extern	int	pr_lstat(struct ps_prochandle *, const char *, struct stat *);
3727c478bd9Sstevel@tonic-gate extern	int	pr_fstat(struct ps_prochandle *, int, struct stat *);
3737c478bd9Sstevel@tonic-gate extern	int	pr_stat64(struct ps_prochandle *, const char *,
3747c478bd9Sstevel@tonic-gate 			struct stat64 *);
3757c478bd9Sstevel@tonic-gate extern	int	pr_lstat64(struct ps_prochandle *, const char *,
3767c478bd9Sstevel@tonic-gate 			struct stat64 *);
3777c478bd9Sstevel@tonic-gate extern	int	pr_fstat64(struct ps_prochandle *, int, struct stat64 *);
3787c478bd9Sstevel@tonic-gate extern	int	pr_statvfs(struct ps_prochandle *, const char *, statvfs_t *);
3797c478bd9Sstevel@tonic-gate extern	int	pr_fstatvfs(struct ps_prochandle *, int, statvfs_t *);
3807c478bd9Sstevel@tonic-gate extern	projid_t pr_getprojid(struct ps_prochandle *Pr);
3817c478bd9Sstevel@tonic-gate extern	taskid_t pr_gettaskid(struct ps_prochandle *Pr);
3827c478bd9Sstevel@tonic-gate extern	taskid_t pr_settaskid(struct ps_prochandle *Pr, projid_t project,
3837c478bd9Sstevel@tonic-gate 			int flags);
3847c478bd9Sstevel@tonic-gate extern	zoneid_t pr_getzoneid(struct ps_prochandle *Pr);
3857c478bd9Sstevel@tonic-gate extern	int	pr_getrctl(struct ps_prochandle *,
3867c478bd9Sstevel@tonic-gate 			const char *, rctlblk_t *, rctlblk_t *, int);
3877c478bd9Sstevel@tonic-gate extern	int	pr_setrctl(struct ps_prochandle *,
3887c478bd9Sstevel@tonic-gate 			const char *, rctlblk_t *, rctlblk_t *, int);
3897c478bd9Sstevel@tonic-gate extern	int	pr_getrlimit(struct ps_prochandle *,
3907c478bd9Sstevel@tonic-gate 			int, struct rlimit *);
3917c478bd9Sstevel@tonic-gate extern	int	pr_setrlimit(struct ps_prochandle *,
3927c478bd9Sstevel@tonic-gate 			int, const struct rlimit *);
393532877c4Srd extern	int	pr_setprojrctl(struct ps_prochandle *, const char *,
394532877c4Srd 			rctlblk_t *, size_t, int);
3957c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE)
3967c478bd9Sstevel@tonic-gate extern	int	pr_getrlimit64(struct ps_prochandle *,
3977c478bd9Sstevel@tonic-gate 			int, struct rlimit64 *);
3987c478bd9Sstevel@tonic-gate extern	int	pr_setrlimit64(struct ps_prochandle *,
3997c478bd9Sstevel@tonic-gate 			int, const struct rlimit64 *);
4007c478bd9Sstevel@tonic-gate #endif	/* _LARGEFILE64_SOURCE */
4017c478bd9Sstevel@tonic-gate extern	int	pr_lwp_exit(struct ps_prochandle *);
4027c478bd9Sstevel@tonic-gate extern	int	pr_exit(struct ps_prochandle *, int);
4037c478bd9Sstevel@tonic-gate extern	int	pr_waitid(struct ps_prochandle *,
4047c478bd9Sstevel@tonic-gate 			idtype_t, id_t, siginfo_t *, int);
4057c478bd9Sstevel@tonic-gate extern	off_t	pr_lseek(struct ps_prochandle *, int, off_t, int);
4067c478bd9Sstevel@tonic-gate extern	offset_t pr_llseek(struct ps_prochandle *, int, offset_t, int);
4077c478bd9Sstevel@tonic-gate extern	int	pr_rename(struct ps_prochandle *, const char *, const char *);
4087c478bd9Sstevel@tonic-gate extern	int	pr_link(struct ps_prochandle *, const char *, const char *);
4097c478bd9Sstevel@tonic-gate extern	int	pr_unlink(struct ps_prochandle *, const char *);
410a154f012SAlexander Stetsenko extern	int	pr_getpeerucred(struct ps_prochandle *, int, ucred_t **);
4117c478bd9Sstevel@tonic-gate extern	int	pr_getpeername(struct ps_prochandle *,
4127c478bd9Sstevel@tonic-gate 			int, struct sockaddr *, socklen_t *);
4137c478bd9Sstevel@tonic-gate extern	int	pr_getsockname(struct ps_prochandle *,
4147c478bd9Sstevel@tonic-gate 			int, struct sockaddr *, socklen_t *);
4157c478bd9Sstevel@tonic-gate extern	int	pr_getsockopt(struct ps_prochandle *,
4167c478bd9Sstevel@tonic-gate 			int, int, int, void *, int *);
4177c478bd9Sstevel@tonic-gate extern	int	pr_processor_bind(struct ps_prochandle *,
4187c478bd9Sstevel@tonic-gate 			idtype_t, id_t, int, int *);
4197c478bd9Sstevel@tonic-gate 
4207c478bd9Sstevel@tonic-gate /*
4217c478bd9Sstevel@tonic-gate  * Function prototypes for accessing per-LWP register information.
4227c478bd9Sstevel@tonic-gate  */
4237c478bd9Sstevel@tonic-gate extern int Plwp_getregs(struct ps_prochandle *, lwpid_t, prgregset_t);
4247c478bd9Sstevel@tonic-gate extern int Plwp_setregs(struct ps_prochandle *, lwpid_t, const prgregset_t);
4257c478bd9Sstevel@tonic-gate 
4267c478bd9Sstevel@tonic-gate extern int Plwp_getfpregs(struct ps_prochandle *, lwpid_t, prfpregset_t *);
4277c478bd9Sstevel@tonic-gate extern int Plwp_setfpregs(struct ps_prochandle *, lwpid_t,
4287c478bd9Sstevel@tonic-gate     const prfpregset_t *);
4297c478bd9Sstevel@tonic-gate 
430ed093b41SRobert Mustacchi extern int Plwp_getxregs(struct ps_prochandle *, lwpid_t, prxregset_t **,
431ed093b41SRobert Mustacchi     size_t *);
432ed093b41SRobert Mustacchi extern void Plwp_freexregs(struct ps_prochandle *, prxregset_t *, size_t);
433ed093b41SRobert Mustacchi extern int Plwp_setxregs(struct ps_prochandle *, lwpid_t, const prxregset_t *,
434ed093b41SRobert Mustacchi     size_t);
4357c478bd9Sstevel@tonic-gate 
436ed093b41SRobert Mustacchi #if defined(__sparc)
4377c478bd9Sstevel@tonic-gate extern int Plwp_getgwindows(struct ps_prochandle *, lwpid_t, gwindows_t *);
4387c478bd9Sstevel@tonic-gate 
4397c478bd9Sstevel@tonic-gate #if defined(__sparcv9)
4407c478bd9Sstevel@tonic-gate extern int Plwp_getasrs(struct ps_prochandle *, lwpid_t, asrset_t);
4417c478bd9Sstevel@tonic-gate extern int Plwp_setasrs(struct ps_prochandle *, lwpid_t, const asrset_t);
4427c478bd9Sstevel@tonic-gate #endif	/* __sparcv9 */
4437c478bd9Sstevel@tonic-gate 
4447c478bd9Sstevel@tonic-gate #endif	/* __sparc */
4457c478bd9Sstevel@tonic-gate 
4467c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
4477c478bd9Sstevel@tonic-gate extern	int	Pldt(struct ps_prochandle *, struct ssd *, int);
4487c478bd9Sstevel@tonic-gate extern	int	proc_get_ldt(pid_t, struct ssd *, int);
4497c478bd9Sstevel@tonic-gate #endif	/* __i386 || __amd64 */
4507c478bd9Sstevel@tonic-gate 
451ab618543SJohn Levon extern int Plwp_getname(struct ps_prochandle *, lwpid_t, char *, size_t);
4527c478bd9Sstevel@tonic-gate extern int Plwp_getpsinfo(struct ps_prochandle *, lwpid_t, lwpsinfo_t *);
453f971a346SBryan Cantrill extern int Plwp_getspymaster(struct ps_prochandle *, lwpid_t, psinfo_t *);
4547c478bd9Sstevel@tonic-gate 
4557c478bd9Sstevel@tonic-gate extern int Plwp_stack(struct ps_prochandle *, lwpid_t, stack_t *);
4567c478bd9Sstevel@tonic-gate extern int Plwp_main_stack(struct ps_prochandle *, lwpid_t, stack_t *);
4577c478bd9Sstevel@tonic-gate extern int Plwp_alt_stack(struct ps_prochandle *, lwpid_t, stack_t *);
4587c478bd9Sstevel@tonic-gate 
4597c478bd9Sstevel@tonic-gate /*
4607c478bd9Sstevel@tonic-gate  * LWP iteration interface; iterate over all active LWPs.
4617c478bd9Sstevel@tonic-gate  */
4627c478bd9Sstevel@tonic-gate typedef int proc_lwp_f(void *, const lwpstatus_t *);
4637c478bd9Sstevel@tonic-gate extern int Plwp_iter(struct ps_prochandle *, proc_lwp_f *, void *);
4647c478bd9Sstevel@tonic-gate 
4657c478bd9Sstevel@tonic-gate /*
4667c478bd9Sstevel@tonic-gate  * LWP iteration interface; iterate over all LWPs, active and zombie.
4677c478bd9Sstevel@tonic-gate  */
4687c478bd9Sstevel@tonic-gate typedef int proc_lwp_all_f(void *, const lwpstatus_t *, const lwpsinfo_t *);
4697c478bd9Sstevel@tonic-gate extern int Plwp_iter_all(struct ps_prochandle *, proc_lwp_all_f *, void *);
4707c478bd9Sstevel@tonic-gate 
4717c478bd9Sstevel@tonic-gate /*
472ed9c9f97SRoger A. Faulkner  * Process iteration interface; iterate over all non-system processes.
4737c478bd9Sstevel@tonic-gate  */
4747c478bd9Sstevel@tonic-gate typedef int proc_walk_f(psinfo_t *, lwpsinfo_t *, void *);
4757c478bd9Sstevel@tonic-gate extern int proc_walk(proc_walk_f *, void *, int);
4767c478bd9Sstevel@tonic-gate 
477a63fed2aSJason King #define	PR_WALK_PROC		0		/* walk processes only */
478a63fed2aSJason King #define	PR_WALK_LWP		1		/* walk all lwps */
479a63fed2aSJason King #define	PR_WALK_INCLUDE_SYS	0x80000000	/* include SSYS processes */
4807c478bd9Sstevel@tonic-gate 
481a02120c4SAndy Fiddaman /*
482a02120c4SAndy Fiddaman  * File descriptor iteration.
483a02120c4SAndy Fiddaman  */
484a02120c4SAndy Fiddaman typedef int proc_fdwalk_f(const prfdinfo_t *, void *);
485a02120c4SAndy Fiddaman extern int proc_fdwalk(pid_t, proc_fdwalk_f *, void *);
486a02120c4SAndy Fiddaman 
487a02120c4SAndy Fiddaman /*
488a02120c4SAndy Fiddaman  * fdinfo iteration.
489a02120c4SAndy Fiddaman  */
490a02120c4SAndy Fiddaman typedef int proc_fdinfowalk_f(uint_t, const void *, size_t, void *);
491a02120c4SAndy Fiddaman extern int proc_fdinfowalk(const prfdinfo_t *, proc_fdinfowalk_f *, void *);
492a02120c4SAndy Fiddaman 
4937c478bd9Sstevel@tonic-gate /*
4947c478bd9Sstevel@tonic-gate  * Determine if an lwp is in a set as returned from proc_arg_xgrab().
4957c478bd9Sstevel@tonic-gate  */
4967c478bd9Sstevel@tonic-gate extern int proc_lwp_in_set(const char *, lwpid_t);
4977c478bd9Sstevel@tonic-gate extern int proc_lwp_range_valid(const char *);
4987c478bd9Sstevel@tonic-gate 
4997c478bd9Sstevel@tonic-gate /*
5007c478bd9Sstevel@tonic-gate  * Symbol table interfaces.
5017c478bd9Sstevel@tonic-gate  */
5027c478bd9Sstevel@tonic-gate 
5037c478bd9Sstevel@tonic-gate /*
5047c478bd9Sstevel@tonic-gate  * Pseudo-names passed to Plookup_by_name() for well-known load objects.
5057c478bd9Sstevel@tonic-gate  * NOTE: It is required that PR_OBJ_EXEC and PR_OBJ_LDSO exactly match
5067c478bd9Sstevel@tonic-gate  * the definitions of PS_OBJ_EXEC and PS_OBJ_LDSO from <proc_service.h>.
5077c478bd9Sstevel@tonic-gate  */
5087c478bd9Sstevel@tonic-gate #define	PR_OBJ_EXEC	((const char *)0)	/* search the executable file */
5097c478bd9Sstevel@tonic-gate #define	PR_OBJ_LDSO	((const char *)1)	/* search ld.so.1 */
5107c478bd9Sstevel@tonic-gate #define	PR_OBJ_EVERY	((const char *)-1)	/* search every load object */
5117c478bd9Sstevel@tonic-gate 
5127c478bd9Sstevel@tonic-gate /*
5137c478bd9Sstevel@tonic-gate  * Special Lmid_t passed to Plookup_by_lmid() to search all link maps.  The
5147c478bd9Sstevel@tonic-gate  * special values LM_ID_BASE and LM_ID_LDSO from <link.h> may also be used.
5157c478bd9Sstevel@tonic-gate  * If PR_OBJ_EXEC is used as the object name, the lmid must be PR_LMID_EVERY
5167c478bd9Sstevel@tonic-gate  * or LM_ID_BASE in order to return a match.  If PR_OBJ_LDSO is used as the
5177c478bd9Sstevel@tonic-gate  * object name, the lmid must be PR_LMID_EVERY or LM_ID_LDSO to return a match.
5187c478bd9Sstevel@tonic-gate  */
5197c478bd9Sstevel@tonic-gate #define	PR_LMID_EVERY	((Lmid_t)-1UL)		/* search every link map */
5207c478bd9Sstevel@tonic-gate 
5217c478bd9Sstevel@tonic-gate /*
5227c478bd9Sstevel@tonic-gate  * 'object_name' is the name of a load object obtained from an
5237c478bd9Sstevel@tonic-gate  * iteration over the process's address space mappings (Pmapping_iter),
5247c478bd9Sstevel@tonic-gate  * or an iteration over the process's mapped objects (Pobject_iter),
5257c478bd9Sstevel@tonic-gate  * or else it is one of the special PR_OBJ_* values above.
5267c478bd9Sstevel@tonic-gate  */
5277c478bd9Sstevel@tonic-gate extern int Plookup_by_name(struct ps_prochandle *,
5287c478bd9Sstevel@tonic-gate     const char *, const char *, GElf_Sym *);
5297c478bd9Sstevel@tonic-gate 
5307c478bd9Sstevel@tonic-gate extern int Plookup_by_addr(struct ps_prochandle *,
5317c478bd9Sstevel@tonic-gate     uintptr_t, char *, size_t, GElf_Sym *);
5327c478bd9Sstevel@tonic-gate 
5337c478bd9Sstevel@tonic-gate typedef struct prsyminfo {
5347c478bd9Sstevel@tonic-gate 	const char	*prs_object;		/* object name */
5357c478bd9Sstevel@tonic-gate 	const char	*prs_name;		/* symbol name */
5367c478bd9Sstevel@tonic-gate 	Lmid_t		prs_lmid;		/* link map id */
5377c478bd9Sstevel@tonic-gate 	uint_t		prs_id;			/* symbol id */
5387c478bd9Sstevel@tonic-gate 	uint_t		prs_table;		/* symbol table id */
5397c478bd9Sstevel@tonic-gate } prsyminfo_t;
5407c478bd9Sstevel@tonic-gate 
5417c478bd9Sstevel@tonic-gate extern int Pxlookup_by_name(struct ps_prochandle *,
5427c478bd9Sstevel@tonic-gate     Lmid_t, const char *, const char *, GElf_Sym *, prsyminfo_t *);
5437c478bd9Sstevel@tonic-gate 
5447c478bd9Sstevel@tonic-gate extern int Pxlookup_by_addr(struct ps_prochandle *,
5457c478bd9Sstevel@tonic-gate     uintptr_t, char *, size_t, GElf_Sym *, prsyminfo_t *);
546186f7fbfSEdward Pilatowicz extern int Pxlookup_by_addr_resolved(struct ps_prochandle *,
547186f7fbfSEdward Pilatowicz     uintptr_t, char *, size_t, GElf_Sym *, prsyminfo_t *);
5487c478bd9Sstevel@tonic-gate 
5497c478bd9Sstevel@tonic-gate typedef int proc_map_f(void *, const prmap_t *, const char *);
5507c478bd9Sstevel@tonic-gate 
5517c478bd9Sstevel@tonic-gate extern int Pmapping_iter(struct ps_prochandle *, proc_map_f *, void *);
552186f7fbfSEdward Pilatowicz extern int Pmapping_iter_resolved(struct ps_prochandle *, proc_map_f *, void *);
5537c478bd9Sstevel@tonic-gate extern int Pobject_iter(struct ps_prochandle *, proc_map_f *, void *);
554186f7fbfSEdward Pilatowicz extern int Pobject_iter_resolved(struct ps_prochandle *, proc_map_f *, void *);
5557c478bd9Sstevel@tonic-gate 
5567c478bd9Sstevel@tonic-gate extern const prmap_t *Paddr_to_map(struct ps_prochandle *, uintptr_t);
5577c478bd9Sstevel@tonic-gate extern const prmap_t *Paddr_to_text_map(struct ps_prochandle *, uintptr_t);
5587c478bd9Sstevel@tonic-gate extern const prmap_t *Pname_to_map(struct ps_prochandle *, const char *);
5597c478bd9Sstevel@tonic-gate extern const prmap_t *Plmid_to_map(struct ps_prochandle *,
5607c478bd9Sstevel@tonic-gate     Lmid_t, const char *);
5617c478bd9Sstevel@tonic-gate 
5627c478bd9Sstevel@tonic-gate extern const rd_loadobj_t *Paddr_to_loadobj(struct ps_prochandle *, uintptr_t);
5637c478bd9Sstevel@tonic-gate extern const rd_loadobj_t *Pname_to_loadobj(struct ps_prochandle *,
5647c478bd9Sstevel@tonic-gate     const char *);
5657c478bd9Sstevel@tonic-gate extern const rd_loadobj_t *Plmid_to_loadobj(struct ps_prochandle *,
5667c478bd9Sstevel@tonic-gate     Lmid_t, const char *);
5677c478bd9Sstevel@tonic-gate 
5687c478bd9Sstevel@tonic-gate extern ctf_file_t *Paddr_to_ctf(struct ps_prochandle *, uintptr_t);
5697c478bd9Sstevel@tonic-gate extern ctf_file_t *Pname_to_ctf(struct ps_prochandle *, const char *);
5707c478bd9Sstevel@tonic-gate 
5717c478bd9Sstevel@tonic-gate extern char *Pplatform(struct ps_prochandle *, char *, size_t);
5727c478bd9Sstevel@tonic-gate extern int Puname(struct ps_prochandle *, struct utsname *);
5737c478bd9Sstevel@tonic-gate extern char *Pzonename(struct ps_prochandle *, char *, size_t);
574186f7fbfSEdward Pilatowicz extern char *Pfindobj(struct ps_prochandle *, const char *, char *, size_t);
5757c478bd9Sstevel@tonic-gate 
5767c478bd9Sstevel@tonic-gate extern char *Pexecname(struct ps_prochandle *, char *, size_t);
5777c478bd9Sstevel@tonic-gate extern char *Pobjname(struct ps_prochandle *, uintptr_t, char *, size_t);
578186f7fbfSEdward Pilatowicz extern char *Pobjname_resolved(struct ps_prochandle *, uintptr_t, char *,
579186f7fbfSEdward Pilatowicz     size_t);
5807c478bd9Sstevel@tonic-gate extern int Plmid(struct ps_prochandle *, uintptr_t, Lmid_t *);
5817c478bd9Sstevel@tonic-gate 
5827c478bd9Sstevel@tonic-gate typedef int proc_env_f(void *, struct ps_prochandle *, uintptr_t, const char *);
5837c478bd9Sstevel@tonic-gate extern	int Penv_iter(struct ps_prochandle *, proc_env_f *, void *);
5847c478bd9Sstevel@tonic-gate extern char *Pgetenv(struct ps_prochandle *, const char *, char *, size_t);
5857c478bd9Sstevel@tonic-gate extern long Pgetauxval(struct ps_prochandle *, int);
5867c478bd9Sstevel@tonic-gate extern const auxv_t *Pgetauxvec(struct ps_prochandle *);
5877c478bd9Sstevel@tonic-gate 
5889acbbeafSnn extern void Pset_procfs_path(const char *);
5899acbbeafSnn 
5907c478bd9Sstevel@tonic-gate /*
5917c478bd9Sstevel@tonic-gate  * Symbol table iteration interface.  The special lmid constants LM_ID_BASE,
5927c478bd9Sstevel@tonic-gate  * LM_ID_LDSO, and PR_LMID_EVERY may be used with Psymbol_iter_by_lmid.
5937c478bd9Sstevel@tonic-gate  */
5947c478bd9Sstevel@tonic-gate typedef int proc_sym_f(void *, const GElf_Sym *, const char *);
5957c478bd9Sstevel@tonic-gate typedef int proc_xsym_f(void *, const GElf_Sym *, const char *,
5967c478bd9Sstevel@tonic-gate     const prsyminfo_t *);
5977c478bd9Sstevel@tonic-gate 
5987c478bd9Sstevel@tonic-gate extern int Psymbol_iter(struct ps_prochandle *,
5997c478bd9Sstevel@tonic-gate     const char *, int, int, proc_sym_f *, void *);
6007c478bd9Sstevel@tonic-gate extern int Psymbol_iter_by_addr(struct ps_prochandle *,
6017c478bd9Sstevel@tonic-gate     const char *, int, int, proc_sym_f *, void *);
6027c478bd9Sstevel@tonic-gate extern int Psymbol_iter_by_name(struct ps_prochandle *,
6037c478bd9Sstevel@tonic-gate     const char *, int, int, proc_sym_f *, void *);
6047c478bd9Sstevel@tonic-gate 
6057c478bd9Sstevel@tonic-gate extern int Psymbol_iter_by_lmid(struct ps_prochandle *,
6067c478bd9Sstevel@tonic-gate     Lmid_t, const char *, int, int, proc_sym_f *, void *);
6077c478bd9Sstevel@tonic-gate 
6087c478bd9Sstevel@tonic-gate extern int Pxsymbol_iter(struct ps_prochandle *,
6097c478bd9Sstevel@tonic-gate     Lmid_t, const char *, int, int, proc_xsym_f *, void *);
6107c478bd9Sstevel@tonic-gate 
6117c478bd9Sstevel@tonic-gate /*
6127c478bd9Sstevel@tonic-gate  * 'which' selects which symbol table and can be one of the following.
6137c478bd9Sstevel@tonic-gate  */
6147c478bd9Sstevel@tonic-gate #define	PR_SYMTAB	1
6157c478bd9Sstevel@tonic-gate #define	PR_DYNSYM	2
6167c478bd9Sstevel@tonic-gate /*
6177c478bd9Sstevel@tonic-gate  * 'type' selects the symbols of interest by binding and type.  It is a bit-
6187c478bd9Sstevel@tonic-gate  * mask of one or more of the following flags, whose order MUST match the
6197c478bd9Sstevel@tonic-gate  * order of STB and STT constants in <sys/elf.h>.
6207c478bd9Sstevel@tonic-gate  */
6217c478bd9Sstevel@tonic-gate #define	BIND_LOCAL	0x0001
6227c478bd9Sstevel@tonic-gate #define	BIND_GLOBAL	0x0002
6237c478bd9Sstevel@tonic-gate #define	BIND_WEAK	0x0004
6247c478bd9Sstevel@tonic-gate #define	BIND_ANY (BIND_LOCAL|BIND_GLOBAL|BIND_WEAK)
6257c478bd9Sstevel@tonic-gate #define	TYPE_NOTYPE	0x0100
6267c478bd9Sstevel@tonic-gate #define	TYPE_OBJECT	0x0200
6277c478bd9Sstevel@tonic-gate #define	TYPE_FUNC	0x0400
6287c478bd9Sstevel@tonic-gate #define	TYPE_SECTION	0x0800
6297c478bd9Sstevel@tonic-gate #define	TYPE_FILE	0x1000
6307c478bd9Sstevel@tonic-gate #define	TYPE_ANY (TYPE_NOTYPE|TYPE_OBJECT|TYPE_FUNC|TYPE_SECTION|TYPE_FILE)
6317c478bd9Sstevel@tonic-gate 
6327c478bd9Sstevel@tonic-gate /*
6337c478bd9Sstevel@tonic-gate  * This returns the rtld_db agent handle for the process.
6347c478bd9Sstevel@tonic-gate  * The handle will become invalid at the next successful exec() and
6357c478bd9Sstevel@tonic-gate  * must not be used beyond that point (see Preset_maps(), below).
6367c478bd9Sstevel@tonic-gate  */
6377c478bd9Sstevel@tonic-gate extern rd_agent_t *Prd_agent(struct ps_prochandle *);
6387c478bd9Sstevel@tonic-gate 
6397c478bd9Sstevel@tonic-gate /*
6407c478bd9Sstevel@tonic-gate  * This should be called when an RD_DLACTIVITY event with the
6417c478bd9Sstevel@tonic-gate  * RD_CONSISTENT state occurs via librtld_db's event mechanism.
6427c478bd9Sstevel@tonic-gate  * This makes libproc's address space mappings and symbol tables current.
6437c478bd9Sstevel@tonic-gate  * The variant Pupdate_syms() can be used to preload all symbol tables as well.
6447c478bd9Sstevel@tonic-gate  */
6457c478bd9Sstevel@tonic-gate extern void Pupdate_maps(struct ps_prochandle *);
6467c478bd9Sstevel@tonic-gate extern void Pupdate_syms(struct ps_prochandle *);
6477c478bd9Sstevel@tonic-gate 
6487c478bd9Sstevel@tonic-gate /*
6497c478bd9Sstevel@tonic-gate  * This must be called after the victim process performs a successful
6507c478bd9Sstevel@tonic-gate  * exec() if any of the symbol table interface functions have been called
6517c478bd9Sstevel@tonic-gate  * prior to that point.  This is essential because an exec() invalidates
6527c478bd9Sstevel@tonic-gate  * all previous symbol table and address space mapping information.
6537c478bd9Sstevel@tonic-gate  * It is always safe to call, but if it is called other than after an
6547c478bd9Sstevel@tonic-gate  * exec() by the victim process it just causes unnecessary overhead.
6557c478bd9Sstevel@tonic-gate  *
6567c478bd9Sstevel@tonic-gate  * The rtld_db agent handle obtained from a previous call to Prd_agent() is
6577c478bd9Sstevel@tonic-gate  * made invalid by Preset_maps() and Prd_agent() must be called again to get
6587c478bd9Sstevel@tonic-gate  * the new handle.
6597c478bd9Sstevel@tonic-gate  */
6607c478bd9Sstevel@tonic-gate extern void Preset_maps(struct ps_prochandle *);
6617c478bd9Sstevel@tonic-gate 
6627c478bd9Sstevel@tonic-gate /*
6637c478bd9Sstevel@tonic-gate  * Given an address, Ppltdest() determines if this is part of a PLT, and if
6647c478bd9Sstevel@tonic-gate  * so returns a pointer to the symbol name that will be used for resolution.
6657c478bd9Sstevel@tonic-gate  * If the specified address is not part of a PLT, the function returns NULL.
6667c478bd9Sstevel@tonic-gate  */
6677c478bd9Sstevel@tonic-gate extern const char *Ppltdest(struct ps_prochandle *, uintptr_t);
6687c478bd9Sstevel@tonic-gate 
6697c478bd9Sstevel@tonic-gate /*
6707c478bd9Sstevel@tonic-gate  * See comments for Pissyscall(), in Pisadep.h
6717c478bd9Sstevel@tonic-gate  */
6727c478bd9Sstevel@tonic-gate extern int Pissyscall_prev(struct ps_prochandle *, uintptr_t, uintptr_t *);
6737c478bd9Sstevel@tonic-gate 
6747c478bd9Sstevel@tonic-gate /*
6757c478bd9Sstevel@tonic-gate  * Stack frame iteration interface.
6767c478bd9Sstevel@tonic-gate  */
6777c478bd9Sstevel@tonic-gate typedef int proc_stack_f(void *, prgregset_t, uint_t, const long *);
6787c478bd9Sstevel@tonic-gate 
6797c478bd9Sstevel@tonic-gate extern int Pstack_iter(struct ps_prochandle *,
6807c478bd9Sstevel@tonic-gate     const prgregset_t, proc_stack_f *, void *);
6817c478bd9Sstevel@tonic-gate 
6827c478bd9Sstevel@tonic-gate /*
6837c478bd9Sstevel@tonic-gate  * The following functions define a set of passive interfaces: libproc provides
6847c478bd9Sstevel@tonic-gate  * default, empty definitions that are called internally.  If a client wishes
6857c478bd9Sstevel@tonic-gate  * to override these definitions, it can simply provide its own version with
6867c478bd9Sstevel@tonic-gate  * the same signature that interposes on the libproc definition.
6877c478bd9Sstevel@tonic-gate  *
6887c478bd9Sstevel@tonic-gate  * If the client program wishes to report additional error information, it
6897c478bd9Sstevel@tonic-gate  * can provide its own version of Perror_printf.
6907c478bd9Sstevel@tonic-gate  *
6917c478bd9Sstevel@tonic-gate  * If the client program wishes to receive a callback after Pcreate forks
6927c478bd9Sstevel@tonic-gate  * but before it execs, it can provide its own version of Pcreate_callback.
6937c478bd9Sstevel@tonic-gate  */
6947c478bd9Sstevel@tonic-gate extern void Perror_printf(struct ps_prochandle *P, const char *format, ...);
6957c478bd9Sstevel@tonic-gate extern void Pcreate_callback(struct ps_prochandle *);
6967c478bd9Sstevel@tonic-gate 
6977c478bd9Sstevel@tonic-gate /*
6987c478bd9Sstevel@tonic-gate  * Remove unprintable characters from psinfo.pr_psargs and replace with
6997c478bd9Sstevel@tonic-gate  * whitespace characters so it is safe for printing.
7007c478bd9Sstevel@tonic-gate  */
7017c478bd9Sstevel@tonic-gate extern void proc_unctrl_psinfo(psinfo_t *);
7027c478bd9Sstevel@tonic-gate 
7037c478bd9Sstevel@tonic-gate /*
7047c478bd9Sstevel@tonic-gate  * Utility functions for processing arguments which should be /proc files,
7057c478bd9Sstevel@tonic-gate  * pids, and/or core files.  The returned error code can be passed to
7067c478bd9Sstevel@tonic-gate  * Pgrab_error() in order to convert it to an error string.
7077c478bd9Sstevel@tonic-gate  */
7087c478bd9Sstevel@tonic-gate #define	PR_ARG_PIDS	0x1	/* Allow pid and /proc file arguments */
7097c478bd9Sstevel@tonic-gate #define	PR_ARG_CORES	0x2	/* Allow core file arguments */
7107c478bd9Sstevel@tonic-gate 
7117c478bd9Sstevel@tonic-gate #define	PR_ARG_ANY	(PR_ARG_PIDS | PR_ARG_CORES)
7127c478bd9Sstevel@tonic-gate 
7137c478bd9Sstevel@tonic-gate extern struct ps_prochandle *proc_arg_grab(const char *, int, int, int *);
7147c478bd9Sstevel@tonic-gate extern struct ps_prochandle *proc_arg_xgrab(const char *, const char *, int,
7157c478bd9Sstevel@tonic-gate     int, int *, const char **);
7167c478bd9Sstevel@tonic-gate extern pid_t proc_arg_psinfo(const char *, int, psinfo_t *, int *);
7177c478bd9Sstevel@tonic-gate extern pid_t proc_arg_xpsinfo(const char *, int, psinfo_t *, int *,
7187c478bd9Sstevel@tonic-gate     const char **);
7197c478bd9Sstevel@tonic-gate 
7207c478bd9Sstevel@tonic-gate /*
7217c478bd9Sstevel@tonic-gate  * Utility functions for obtaining information via /proc without actually
7227c478bd9Sstevel@tonic-gate  * performing a Pcreate() or Pgrab():
7237c478bd9Sstevel@tonic-gate  */
7247c478bd9Sstevel@tonic-gate extern int proc_get_auxv(pid_t, auxv_t *, int);
7257c478bd9Sstevel@tonic-gate extern int proc_get_cred(pid_t, prcred_t *, int);
7267c478bd9Sstevel@tonic-gate extern prpriv_t *proc_get_priv(pid_t);
72743051d27SRobert Mustacchi extern void proc_free_priv(prpriv_t *);
7287c478bd9Sstevel@tonic-gate extern int proc_get_psinfo(pid_t, psinfo_t *);
7297c478bd9Sstevel@tonic-gate extern int proc_get_status(pid_t, pstatus_t *);
730d2a70789SRichard Lowe extern int proc_get_secflags(pid_t, prsecflags_t **);
731a02120c4SAndy Fiddaman extern prfdinfo_t *proc_get_fdinfo(pid_t, int);
732a02120c4SAndy Fiddaman extern const void *proc_fdinfo_misc(const prfdinfo_t *, uint_t, size_t *);
733a02120c4SAndy Fiddaman extern void proc_fdinfo_free(prfdinfo_t *);
734dea9f5e6SRobert Mustacchi extern int proc_get_lwpsinfo(pid_t, uint_t, lwpsinfo_t *);
735*a7d7cafeSRobert Mustacchi extern int proc_get_lwpstatus(pid_t, uint_t, lwpstatus_t *);
7367c478bd9Sstevel@tonic-gate 
7377c478bd9Sstevel@tonic-gate /*
7387c478bd9Sstevel@tonic-gate  * Utility functions for debugging tools to convert numeric fault,
7397c478bd9Sstevel@tonic-gate  * signal, and system call numbers to symbolic names:
7407c478bd9Sstevel@tonic-gate  */
7417c478bd9Sstevel@tonic-gate #define	FLT2STR_MAX 32	/* max. string length of faults (like SIG2STR_MAX) */
7427c478bd9Sstevel@tonic-gate #define	SYS2STR_MAX 32	/* max. string length of syscalls (like SIG2STR_MAX) */
743542a7b7fSCarlos Neira #define	DMODELSTR_MAX 32 /* max. string length of data model names */
7447c478bd9Sstevel@tonic-gate 
7457c478bd9Sstevel@tonic-gate extern char *proc_fltname(int, char *, size_t);
7467c478bd9Sstevel@tonic-gate extern char *proc_signame(int, char *, size_t);
7477c478bd9Sstevel@tonic-gate extern char *proc_sysname(int, char *, size_t);
748542a7b7fSCarlos Neira extern char *proc_dmodelname(int, char *, size_t);
7497c478bd9Sstevel@tonic-gate 
7507c478bd9Sstevel@tonic-gate /*
7517c478bd9Sstevel@tonic-gate  * Utility functions for debugging tools to convert fault, signal, and system
7527c478bd9Sstevel@tonic-gate  * call names back to the numeric constants:
7537c478bd9Sstevel@tonic-gate  */
7547c478bd9Sstevel@tonic-gate extern int proc_str2flt(const char *, int *);
7557c478bd9Sstevel@tonic-gate extern int proc_str2sig(const char *, int *);
7567c478bd9Sstevel@tonic-gate extern int proc_str2sys(const char *, int *);
7577c478bd9Sstevel@tonic-gate 
7587c478bd9Sstevel@tonic-gate /*
7597c478bd9Sstevel@tonic-gate  * Utility functions for debugging tools to convert a fault, signal or system
7607c478bd9Sstevel@tonic-gate  * call set to a string representation (e.g. "BUS,SEGV" or "open,close,read").
7617c478bd9Sstevel@tonic-gate  */
7627c478bd9Sstevel@tonic-gate #define	PRSIGBUFSZ	1024	/* buffer size for proc_sigset2str() */
7637c478bd9Sstevel@tonic-gate 
7647c478bd9Sstevel@tonic-gate extern char *proc_fltset2str(const fltset_t *, const char *, int,
7657c478bd9Sstevel@tonic-gate     char *, size_t);
7667c478bd9Sstevel@tonic-gate extern char *proc_sigset2str(const sigset_t *, const char *, int,
7677c478bd9Sstevel@tonic-gate     char *, size_t);
7687c478bd9Sstevel@tonic-gate extern char *proc_sysset2str(const sysset_t *, const char *, int,
7697c478bd9Sstevel@tonic-gate     char *, size_t);
7707c478bd9Sstevel@tonic-gate 
7717c478bd9Sstevel@tonic-gate extern int Pgcore(struct ps_prochandle *, const char *, core_content_t);
7727c478bd9Sstevel@tonic-gate extern int Pfgcore(struct ps_prochandle *, int, core_content_t);
7737c478bd9Sstevel@tonic-gate extern core_content_t Pcontent(struct ps_prochandle *);
7747c478bd9Sstevel@tonic-gate 
7757c478bd9Sstevel@tonic-gate /*
7767c478bd9Sstevel@tonic-gate  * Utility functions for debugging tools to convert a string representation of
7777c478bd9Sstevel@tonic-gate  * a fault, signal or system call set back to the numeric value of the
7787c478bd9Sstevel@tonic-gate  * corresponding set type.
7797c478bd9Sstevel@tonic-gate  */
7807c478bd9Sstevel@tonic-gate extern char *proc_str2fltset(const char *, const char *, int, fltset_t *);
7817c478bd9Sstevel@tonic-gate extern char *proc_str2sigset(const char *, const char *, int, sigset_t *);
7827c478bd9Sstevel@tonic-gate extern char *proc_str2sysset(const char *, const char *, int, sysset_t *);
7837c478bd9Sstevel@tonic-gate 
7847c478bd9Sstevel@tonic-gate /*
7857c478bd9Sstevel@tonic-gate  * Utility functions for converting between strings and core_content_t.
7867c478bd9Sstevel@tonic-gate  */
7877c478bd9Sstevel@tonic-gate #define	PRCONTENTBUFSZ	80	/* buffer size for proc_content2str() */
7887c478bd9Sstevel@tonic-gate 
7897c478bd9Sstevel@tonic-gate extern int proc_str2content(const char *, core_content_t *);
7907c478bd9Sstevel@tonic-gate extern int proc_content2str(core_content_t, char *, size_t);
7917c478bd9Sstevel@tonic-gate 
7927c478bd9Sstevel@tonic-gate /*
7937c478bd9Sstevel@tonic-gate  * Utility functions for buffering output to stdout, stderr while
7947c478bd9Sstevel@tonic-gate  * process is grabbed.  Prevents deadlocks due to pfiles `pgrep xterm`
7957c478bd9Sstevel@tonic-gate  * and other varients.
7967c478bd9Sstevel@tonic-gate  */
7977c478bd9Sstevel@tonic-gate extern int proc_initstdio(void);
7987c478bd9Sstevel@tonic-gate extern int proc_flushstdio(void);
7997c478bd9Sstevel@tonic-gate extern int proc_finistdio(void);
8007c478bd9Sstevel@tonic-gate 
80134bdffbfSGarrett D'Amore /*
80234bdffbfSGarrett D'Amore  * Iterate over all open files.
80334bdffbfSGarrett D'Amore  */
804a02120c4SAndy Fiddaman typedef int proc_fdinfo_f(void *, const prfdinfo_t *);
80534bdffbfSGarrett D'Amore extern int Pfdinfo_iter(struct ps_prochandle *, proc_fdinfo_f *, void *);
80634bdffbfSGarrett D'Amore 
807350ffdd5SRobert Mustacchi /*
808350ffdd5SRobert Mustacchi  * NT_UPANIC information.
809350ffdd5SRobert Mustacchi  */
810350ffdd5SRobert Mustacchi extern int Pupanic(struct ps_prochandle *, prupanic_t **);
811350ffdd5SRobert Mustacchi extern void Pupanic_free(prupanic_t *);
812350ffdd5SRobert Mustacchi 
8137c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
8147c478bd9Sstevel@tonic-gate }
8157c478bd9Sstevel@tonic-gate #endif
8167c478bd9Sstevel@tonic-gate 
8177c478bd9Sstevel@tonic-gate #endif	/* _LIBPROC_H */
818