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 59acbbeafSnn35248 * Common Development and Distribution License (the "License"). 69acbbeafSnn35248 * 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 /* 22186f7fbfSEdward Pilatowicz * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 2534bdffbfSGarrett D'Amore /* 2634bdffbfSGarrett D'Amore * Copyright 2012 DEY Storage Systems, Inc. All rights reserved. 27*3c457126STimothy J Fontaine * Copyright (c) 2014, Joyent, Inc. All rights reserved. 282a12f85aSJeremy Jones * Copyright (c) 2013 by Delphix. All rights reserved. 2934bdffbfSGarrett D'Amore */ 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifndef _PCONTROL_H 327c478bd9Sstevel@tonic-gate #define _PCONTROL_H 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate /* 357c478bd9Sstevel@tonic-gate * Implemention-specific include file for libproc process management. 367c478bd9Sstevel@tonic-gate * This is not to be seen by the clients of libproc. 377c478bd9Sstevel@tonic-gate */ 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #include <stdio.h> 407c478bd9Sstevel@tonic-gate #include <gelf.h> 417c478bd9Sstevel@tonic-gate #include <synch.h> 427c478bd9Sstevel@tonic-gate #include <procfs.h> 437c478bd9Sstevel@tonic-gate #include <rtld_db.h> 447c478bd9Sstevel@tonic-gate #include <libproc.h> 457c478bd9Sstevel@tonic-gate #include <libctf.h> 469acbbeafSnn35248 #include <limits.h> 472a12f85aSJeremy Jones #include <libproc.h> 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate #ifdef __cplusplus 507c478bd9Sstevel@tonic-gate extern "C" { 517c478bd9Sstevel@tonic-gate #endif 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #include "Putil.h" 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* 567c478bd9Sstevel@tonic-gate * Definitions of the process control structures, internal to libproc. 577c478bd9Sstevel@tonic-gate * These may change without affecting clients of libproc. 587c478bd9Sstevel@tonic-gate */ 597c478bd9Sstevel@tonic-gate 60d51e9074Sab196087 /* 61d51e9074Sab196087 * sym_tbl_t contains a primary and an (optional) auxiliary symbol table, which 62d51e9074Sab196087 * we wish to treat as a single logical symbol table. In this logical table, 63d51e9074Sab196087 * the data from the auxiliary table preceeds that from the primary. Symbol 64d51e9074Sab196087 * indices start at [0], which is the first item in the auxiliary table 65d51e9074Sab196087 * if there is one. The sole purpose for this is so that we can treat the 66d51e9074Sab196087 * combination of .SUNW_ldynsym and .dynsym sections as a logically single 67d51e9074Sab196087 * entity without having to violate the public interface to libelf. 68d51e9074Sab196087 * 69d51e9074Sab196087 * Both tables must share the same string table section. 70d51e9074Sab196087 * 71d51e9074Sab196087 * The symtab_getsym() function serves as a gelf_getsym() replacement 72d51e9074Sab196087 * that is aware of the two tables and makes them look like a single table 73d51e9074Sab196087 * to the caller. 74d51e9074Sab196087 * 75d51e9074Sab196087 */ 7630da1432Sahl typedef struct sym_tbl { /* symbol table */ 77d51e9074Sab196087 Elf_Data *sym_data_pri; /* primary table */ 78d51e9074Sab196087 Elf_Data *sym_data_aux; /* auxiliary table */ 79d51e9074Sab196087 size_t sym_symn_aux; /* number of entries in auxiliary table */ 80d51e9074Sab196087 size_t sym_symn; /* total number of entries in both tables */ 817c478bd9Sstevel@tonic-gate char *sym_strs; /* ptr to strings */ 827c478bd9Sstevel@tonic-gate size_t sym_strsz; /* size of string table */ 83d51e9074Sab196087 GElf_Shdr sym_hdr_pri; /* primary symbol table section header */ 84d51e9074Sab196087 GElf_Shdr sym_hdr_aux; /* auxiliary symbol table section header */ 857c478bd9Sstevel@tonic-gate GElf_Shdr sym_strhdr; /* string table section header */ 8630da1432Sahl Elf *sym_elf; /* faked-up ELF handle from core file */ 8730da1432Sahl void *sym_elfmem; /* data for faked-up ELF handle */ 887c478bd9Sstevel@tonic-gate uint_t *sym_byname; /* symbols sorted by name */ 897c478bd9Sstevel@tonic-gate uint_t *sym_byaddr; /* symbols sorted by addr */ 907c478bd9Sstevel@tonic-gate size_t sym_count; /* number of symbols in each sorted list */ 917c478bd9Sstevel@tonic-gate } sym_tbl_t; 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate typedef struct file_info { /* symbol information for a mapped file */ 94fa9e4066Sahrens plist_t file_list; /* linked list */ 957c478bd9Sstevel@tonic-gate char file_pname[PRMAPSZ]; /* name from prmap_t */ 967c478bd9Sstevel@tonic-gate struct map_info *file_map; /* primary (text) mapping */ 977c478bd9Sstevel@tonic-gate int file_ref; /* references from map_info_t structures */ 987c478bd9Sstevel@tonic-gate int file_fd; /* file descriptor for the mapped file */ 997c478bd9Sstevel@tonic-gate int file_init; /* 0: initialization yet to be performed */ 1007c478bd9Sstevel@tonic-gate GElf_Half file_etype; /* ELF e_type from ehdr */ 1017c478bd9Sstevel@tonic-gate GElf_Half file_class; /* ELF e_ident[EI_CLASS] from ehdr */ 1027c478bd9Sstevel@tonic-gate rd_loadobj_t *file_lo; /* load object structure from rtld_db */ 1037c478bd9Sstevel@tonic-gate char *file_lname; /* load object name from rtld_db */ 1047c478bd9Sstevel@tonic-gate char *file_lbase; /* pointer to basename of file_lname */ 105186f7fbfSEdward Pilatowicz char *file_rname; /* resolved on-disk object pathname */ 106186f7fbfSEdward Pilatowicz char *file_rbase; /* pointer to basename of file_rname */ 10730da1432Sahl Elf *file_elf; /* ELF handle so we can close */ 10830da1432Sahl void *file_elfmem; /* data for faked-up ELF handle */ 1097c478bd9Sstevel@tonic-gate sym_tbl_t file_symtab; /* symbol table */ 1107c478bd9Sstevel@tonic-gate sym_tbl_t file_dynsym; /* dynamic symbol table */ 1117c478bd9Sstevel@tonic-gate uintptr_t file_dyn_base; /* load address for ET_DYN files */ 1127c478bd9Sstevel@tonic-gate uintptr_t file_plt_base; /* base address for PLT */ 1137c478bd9Sstevel@tonic-gate size_t file_plt_size; /* size of PLT region */ 1147c478bd9Sstevel@tonic-gate uintptr_t file_jmp_rel; /* base address of PLT relocations */ 1157c478bd9Sstevel@tonic-gate uintptr_t file_ctf_off; /* offset of CTF data in object file */ 1167c478bd9Sstevel@tonic-gate size_t file_ctf_size; /* size of CTF data in object file */ 1177c478bd9Sstevel@tonic-gate int file_ctf_dyn; /* does the CTF data reference the dynsym */ 1187c478bd9Sstevel@tonic-gate void *file_ctf_buf; /* CTF data for this file */ 1197c478bd9Sstevel@tonic-gate ctf_file_t *file_ctfp; /* CTF container for this file */ 120f957ecc1Svb160487 char *file_shstrs; /* section header string table */ 121f957ecc1Svb160487 size_t file_shstrsz; /* section header string table size */ 12212e72dbbSrh87107 uintptr_t *file_saddrs; /* section header addresses */ 12312e72dbbSrh87107 uint_t file_nsaddrs; /* number of section header addresses */ 1247c478bd9Sstevel@tonic-gate } file_info_t; 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate typedef struct map_info { /* description of an address space mapping */ 1277c478bd9Sstevel@tonic-gate prmap_t map_pmap; /* /proc description of this mapping */ 1287c478bd9Sstevel@tonic-gate file_info_t *map_file; /* pointer into list of mapped files */ 1297c478bd9Sstevel@tonic-gate off64_t map_offset; /* offset into core file (if core) */ 1307c478bd9Sstevel@tonic-gate int map_relocate; /* associated file_map needs to be relocated */ 1317c478bd9Sstevel@tonic-gate } map_info_t; 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate typedef struct lwp_info { /* per-lwp information from core file */ 134fa9e4066Sahrens plist_t lwp_list; /* linked list */ 1357c478bd9Sstevel@tonic-gate lwpid_t lwp_id; /* lwp identifier */ 1367c478bd9Sstevel@tonic-gate lwpsinfo_t lwp_psinfo; /* /proc/<pid>/lwp/<lwpid>/lwpsinfo data */ 1377c478bd9Sstevel@tonic-gate lwpstatus_t lwp_status; /* /proc/<pid>/lwp/<lwpid>/lwpstatus data */ 1387c478bd9Sstevel@tonic-gate #if defined(sparc) || defined(__sparc) 1397c478bd9Sstevel@tonic-gate gwindows_t *lwp_gwins; /* /proc/<pid>/lwp/<lwpid>/gwindows data */ 1407c478bd9Sstevel@tonic-gate prxregset_t *lwp_xregs; /* /proc/<pid>/lwp/<lwpid>/xregs data */ 1417c478bd9Sstevel@tonic-gate int64_t *lwp_asrs; /* /proc/<pid>/lwp/<lwpid>/asrs data */ 1427c478bd9Sstevel@tonic-gate #endif 1437c478bd9Sstevel@tonic-gate } lwp_info_t; 1447c478bd9Sstevel@tonic-gate 14534bdffbfSGarrett D'Amore typedef struct fd_info { 14634bdffbfSGarrett D'Amore plist_t fd_list; /* linked list */ 14734bdffbfSGarrett D'Amore prfdinfo_t fd_info; /* fd info */ 14834bdffbfSGarrett D'Amore } fd_info_t; 14934bdffbfSGarrett D'Amore 1507c478bd9Sstevel@tonic-gate typedef struct core_info { /* information specific to core files */ 1517c478bd9Sstevel@tonic-gate char core_dmodel; /* data model for core file */ 152*3c457126STimothy J Fontaine char core_osabi; /* ELF OS ABI */ 1537c478bd9Sstevel@tonic-gate int core_errno; /* error during initialization if != 0 */ 154fa9e4066Sahrens plist_t core_lwp_head; /* head of list of lwp info */ 1557c478bd9Sstevel@tonic-gate lwp_info_t *core_lwp; /* current lwp information */ 1567c478bd9Sstevel@tonic-gate uint_t core_nlwp; /* number of lwp's in list */ 1577c478bd9Sstevel@tonic-gate off64_t core_size; /* size of core file in bytes */ 1587c478bd9Sstevel@tonic-gate char *core_platform; /* platform string from core file */ 1597c478bd9Sstevel@tonic-gate struct utsname *core_uts; /* uname(2) data from core file */ 1607c478bd9Sstevel@tonic-gate prcred_t *core_cred; /* process credential from core file */ 1617c478bd9Sstevel@tonic-gate core_content_t core_content; /* content dumped to core file */ 1627c478bd9Sstevel@tonic-gate prpriv_t *core_priv; /* process privileges from core file */ 1637c478bd9Sstevel@tonic-gate size_t core_priv_size; /* size of the privileges */ 1647c478bd9Sstevel@tonic-gate void *core_privinfo; /* system privileges info from core file */ 1657c478bd9Sstevel@tonic-gate priv_impl_info_t *core_ppii; /* NOTE entry for core_privinfo */ 1667c478bd9Sstevel@tonic-gate char *core_zonename; /* zone name from core file */ 1677c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64) 1687c478bd9Sstevel@tonic-gate struct ssd *core_ldt; /* LDT entries from core file */ 1697c478bd9Sstevel@tonic-gate uint_t core_nldt; /* number of LDT entries in core file */ 1707c478bd9Sstevel@tonic-gate #endif 1717c478bd9Sstevel@tonic-gate } core_info_t; 1727c478bd9Sstevel@tonic-gate 17330da1432Sahl typedef struct elf_file_header { /* extended ELF header */ 17430da1432Sahl unsigned char e_ident[EI_NIDENT]; 17530da1432Sahl Elf64_Half e_type; 17630da1432Sahl Elf64_Half e_machine; 17730da1432Sahl Elf64_Word e_version; 17830da1432Sahl Elf64_Addr e_entry; 17930da1432Sahl Elf64_Off e_phoff; 18030da1432Sahl Elf64_Off e_shoff; 18130da1432Sahl Elf64_Word e_flags; 18230da1432Sahl Elf64_Half e_ehsize; 18330da1432Sahl Elf64_Half e_phentsize; 18430da1432Sahl Elf64_Half e_shentsize; 18530da1432Sahl Elf64_Word e_phnum; /* phdr count extended to 32 bits */ 18630da1432Sahl Elf64_Word e_shnum; /* shdr count extended to 32 bits */ 18730da1432Sahl Elf64_Word e_shstrndx; /* shdr string index extended to 32 bits */ 18830da1432Sahl } elf_file_header_t; 18930da1432Sahl 1907c478bd9Sstevel@tonic-gate typedef struct elf_file { /* convenience for managing ELF files */ 19130da1432Sahl elf_file_header_t e_hdr; /* Extended ELF header */ 1927c478bd9Sstevel@tonic-gate Elf *e_elf; /* ELF library handle */ 1937c478bd9Sstevel@tonic-gate int e_fd; /* file descriptor */ 1947c478bd9Sstevel@tonic-gate } elf_file_t; 1957c478bd9Sstevel@tonic-gate 1967c478bd9Sstevel@tonic-gate #define HASHSIZE 1024 /* hash table size, power of 2 */ 1977c478bd9Sstevel@tonic-gate 1987c478bd9Sstevel@tonic-gate struct ps_prochandle { 1997c478bd9Sstevel@tonic-gate struct ps_lwphandle **hashtab; /* hash table for LWPs (Lgrab()) */ 2007c478bd9Sstevel@tonic-gate mutex_t proc_lock; /* protects hash table; serializes Lgrab() */ 2017c478bd9Sstevel@tonic-gate pstatus_t orig_status; /* remembered status on Pgrab() */ 2027c478bd9Sstevel@tonic-gate pstatus_t status; /* status when stopped */ 2037c478bd9Sstevel@tonic-gate psinfo_t psinfo; /* psinfo_t from last Ppsinfo() request */ 2047c478bd9Sstevel@tonic-gate uintptr_t sysaddr; /* address of most recent syscall instruction */ 2057c478bd9Sstevel@tonic-gate pid_t pid; /* process-ID */ 2067c478bd9Sstevel@tonic-gate int state; /* state of the process, see "libproc.h" */ 2077c478bd9Sstevel@tonic-gate uint_t flags; /* see defines below */ 2087c478bd9Sstevel@tonic-gate uint_t agentcnt; /* Pcreate_agent()/Pdestroy_agent() ref count */ 2097c478bd9Sstevel@tonic-gate int asfd; /* /proc/<pid>/as filedescriptor */ 2107c478bd9Sstevel@tonic-gate int ctlfd; /* /proc/<pid>/ctl filedescriptor */ 2117c478bd9Sstevel@tonic-gate int statfd; /* /proc/<pid>/status filedescriptor */ 2127c478bd9Sstevel@tonic-gate int agentctlfd; /* /proc/<pid>/lwp/agent/ctl */ 2137c478bd9Sstevel@tonic-gate int agentstatfd; /* /proc/<pid>/lwp/agent/status */ 2147c478bd9Sstevel@tonic-gate int info_valid; /* if zero, map and file info need updating */ 2157c478bd9Sstevel@tonic-gate map_info_t *mappings; /* cached process mappings */ 2167c478bd9Sstevel@tonic-gate size_t map_count; /* number of mappings */ 2177c478bd9Sstevel@tonic-gate size_t map_alloc; /* number of mappings allocated */ 2187c478bd9Sstevel@tonic-gate uint_t num_files; /* number of file elements in file_info */ 219fa9e4066Sahrens plist_t file_head; /* head of mapped files w/ symbol table info */ 2207c478bd9Sstevel@tonic-gate char *execname; /* name of the executable file */ 2217c478bd9Sstevel@tonic-gate auxv_t *auxv; /* the process's aux vector */ 2227c478bd9Sstevel@tonic-gate int nauxv; /* number of aux vector entries */ 2237c478bd9Sstevel@tonic-gate rd_agent_t *rap; /* cookie for rtld_db */ 2247c478bd9Sstevel@tonic-gate map_info_t *map_exec; /* the mapping for the executable file */ 2257c478bd9Sstevel@tonic-gate map_info_t *map_ldso; /* the mapping for ld.so.1 */ 2262a12f85aSJeremy Jones ps_ops_t ops; /* ops-vector */ 2277c478bd9Sstevel@tonic-gate uintptr_t *ucaddrs; /* ucontext-list addresses */ 2287c478bd9Sstevel@tonic-gate uint_t ucnelems; /* number of elements in the ucaddrs list */ 229186f7fbfSEdward Pilatowicz char *zoneroot; /* cached path to zone root */ 23034bdffbfSGarrett D'Amore plist_t fd_head; /* head of file desc info list */ 23134bdffbfSGarrett D'Amore int num_fd; /* number of file descs in list */ 232f971a346SBryan Cantrill uintptr_t map_missing; /* first missing mapping in core due to sig */ 233f971a346SBryan Cantrill siginfo_t killinfo; /* signal that interrupted core dump */ 234f971a346SBryan Cantrill psinfo_t spymaster; /* agent LWP's spymaster, if any */ 2352a12f85aSJeremy Jones void *data; /* private data */ 2367c478bd9Sstevel@tonic-gate }; 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate /* flags */ 2397c478bd9Sstevel@tonic-gate #define CREATED 0x01 /* process was created by Pcreate() */ 2407c478bd9Sstevel@tonic-gate #define SETSIG 0x02 /* set signal trace mask before continuing */ 2417c478bd9Sstevel@tonic-gate #define SETFAULT 0x04 /* set fault trace mask before continuing */ 2427c478bd9Sstevel@tonic-gate #define SETENTRY 0x08 /* set sysentry trace mask before continuing */ 2437c478bd9Sstevel@tonic-gate #define SETEXIT 0x10 /* set sysexit trace mask before continuing */ 2447c478bd9Sstevel@tonic-gate #define SETHOLD 0x20 /* set signal hold mask before continuing */ 2457c478bd9Sstevel@tonic-gate #define SETREGS 0x40 /* set registers before continuing */ 2462a12f85aSJeremy Jones #define INCORE 0x80 /* use in-core data to build symbol tables */ 2477c478bd9Sstevel@tonic-gate 2487c478bd9Sstevel@tonic-gate struct ps_lwphandle { 2497c478bd9Sstevel@tonic-gate struct ps_prochandle *lwp_proc; /* process to which this lwp belongs */ 2507c478bd9Sstevel@tonic-gate struct ps_lwphandle *lwp_hash; /* hash table linked list */ 2517c478bd9Sstevel@tonic-gate lwpstatus_t lwp_status; /* status when stopped */ 2527c478bd9Sstevel@tonic-gate lwpsinfo_t lwp_psinfo; /* lwpsinfo_t from last Lpsinfo() */ 2537c478bd9Sstevel@tonic-gate lwpid_t lwp_id; /* lwp identifier */ 2547c478bd9Sstevel@tonic-gate int lwp_state; /* state of the lwp, see "libproc.h" */ 2557c478bd9Sstevel@tonic-gate uint_t lwp_flags; /* SETHOLD and/or SETREGS */ 2567c478bd9Sstevel@tonic-gate int lwp_ctlfd; /* /proc/<pid>/lwp/<lwpid>/lwpctl */ 2577c478bd9Sstevel@tonic-gate int lwp_statfd; /* /proc/<pid>/lwp/<lwpid>/lwpstatus */ 2587c478bd9Sstevel@tonic-gate }; 2597c478bd9Sstevel@tonic-gate 2607c478bd9Sstevel@tonic-gate /* 2617c478bd9Sstevel@tonic-gate * Implementation functions in the process control library. 2627c478bd9Sstevel@tonic-gate * These are not exported to clients of the library. 2637c478bd9Sstevel@tonic-gate */ 2647c478bd9Sstevel@tonic-gate extern void prldump(const char *, lwpstatus_t *); 2657c478bd9Sstevel@tonic-gate extern int dupfd(int, int); 2667c478bd9Sstevel@tonic-gate extern int set_minfd(void); 2677c478bd9Sstevel@tonic-gate extern int Pscantext(struct ps_prochandle *); 2687c478bd9Sstevel@tonic-gate extern void Pinitsym(struct ps_prochandle *); 2697c478bd9Sstevel@tonic-gate extern void Preadauxvec(struct ps_prochandle *); 2707c478bd9Sstevel@tonic-gate extern void optimize_symtab(sym_tbl_t *); 2717c478bd9Sstevel@tonic-gate extern void Pbuild_file_symtab(struct ps_prochandle *, file_info_t *); 2727c478bd9Sstevel@tonic-gate extern ctf_file_t *Pbuild_file_ctf(struct ps_prochandle *, file_info_t *); 2737c478bd9Sstevel@tonic-gate extern map_info_t *Paddr2mptr(struct ps_prochandle *, uintptr_t); 2747c478bd9Sstevel@tonic-gate extern char *Pfindexec(struct ps_prochandle *, const char *, 2757c478bd9Sstevel@tonic-gate int (*)(const char *, void *), void *); 2767c478bd9Sstevel@tonic-gate extern int getlwpstatus(struct ps_prochandle *, lwpid_t, lwpstatus_t *); 2777c478bd9Sstevel@tonic-gate int Pstopstatus(struct ps_prochandle *, long, uint32_t); 278d7755b5aSrh87107 extern file_info_t *file_info_new(struct ps_prochandle *, map_info_t *); 279186f7fbfSEdward Pilatowicz extern char *Plofspath(const char *, char *, size_t); 280186f7fbfSEdward Pilatowicz extern char *Pzoneroot(struct ps_prochandle *, char *, size_t); 281186f7fbfSEdward Pilatowicz extern char *Pzonepath(struct ps_prochandle *, const char *, char *, 282186f7fbfSEdward Pilatowicz size_t); 28334bdffbfSGarrett D'Amore extern fd_info_t *Pfd2info(struct ps_prochandle *, int); 28434bdffbfSGarrett D'Amore 285186f7fbfSEdward Pilatowicz extern char *Pfindmap(struct ps_prochandle *, map_info_t *, char *, 286186f7fbfSEdward Pilatowicz size_t); 2877c478bd9Sstevel@tonic-gate 2887c478bd9Sstevel@tonic-gate extern int Padd_mapping(struct ps_prochandle *, off64_t, file_info_t *, 2897c478bd9Sstevel@tonic-gate prmap_t *); 2907c478bd9Sstevel@tonic-gate extern void Psort_mappings(struct ps_prochandle *); 2917c478bd9Sstevel@tonic-gate 2929acbbeafSnn35248 extern char procfs_path[PATH_MAX]; 293fa9e4066Sahrens 2947c478bd9Sstevel@tonic-gate /* 2957c478bd9Sstevel@tonic-gate * Architecture-dependent definition of the breakpoint instruction. 2967c478bd9Sstevel@tonic-gate */ 2977c478bd9Sstevel@tonic-gate #if defined(sparc) || defined(__sparc) 2987c478bd9Sstevel@tonic-gate #define BPT ((instr_t)0x91d02001) 2997c478bd9Sstevel@tonic-gate #elif defined(__i386) || defined(__amd64) 3007c478bd9Sstevel@tonic-gate #define BPT ((instr_t)0xcc) 3017c478bd9Sstevel@tonic-gate #endif 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate /* 3047c478bd9Sstevel@tonic-gate * Simple convenience. 3057c478bd9Sstevel@tonic-gate */ 3067c478bd9Sstevel@tonic-gate #define TRUE 1 3077c478bd9Sstevel@tonic-gate #define FALSE 0 3087c478bd9Sstevel@tonic-gate 3097c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3107c478bd9Sstevel@tonic-gate } 3117c478bd9Sstevel@tonic-gate #endif 3127c478bd9Sstevel@tonic-gate 3137c478bd9Sstevel@tonic-gate #endif /* _PCONTROL_H */ 314