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 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 22e4586ebfSmws 237c478bd9Sstevel@tonic-gate /* 24e4586ebfSmws * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 257c478bd9Sstevel@tonic-gate * Use is subject to license terms. 267c478bd9Sstevel@tonic-gate */ 270a47c91cSRobert Mustacchi /* 28*f3e7f55eSRobert Mustacchi * Copyright (c) 2015, Joyent, Inc. All rights reserved. 290a47c91cSRobert Mustacchi */ 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifndef _CTF_IMPL_H 327c478bd9Sstevel@tonic-gate #define _CTF_IMPL_H 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <sys/types.h> 357c478bd9Sstevel@tonic-gate #include <sys/errno.h> 367c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h> 377c478bd9Sstevel@tonic-gate #include <sys/ctf_api.h> 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #ifdef _KERNEL 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #include <sys/systm.h> 427c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h> 437c478bd9Sstevel@tonic-gate #include <sys/varargs.h> 44*f3e7f55eSRobert Mustacchi #include <sys/ddi.h> 45*f3e7f55eSRobert Mustacchi #include <sys/sunddi.h> 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate #define isspace(c) \ 487c478bd9Sstevel@tonic-gate ((c) == ' ' || (c) == '\t' || (c) == '\n' || \ 497c478bd9Sstevel@tonic-gate (c) == '\r' || (c) == '\f' || (c) == '\v') 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate #define MAP_FAILED ((void *)-1) 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #else /* _KERNEL */ 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate #include <strings.h> 567c478bd9Sstevel@tonic-gate #include <stdlib.h> 577c478bd9Sstevel@tonic-gate #include <stdarg.h> 587c478bd9Sstevel@tonic-gate #include <stdio.h> 597c478bd9Sstevel@tonic-gate #include <limits.h> 607c478bd9Sstevel@tonic-gate #include <ctype.h> 61*f3e7f55eSRobert Mustacchi #include <stddef.h> 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate #ifdef __cplusplus 667c478bd9Sstevel@tonic-gate extern "C" { 677c478bd9Sstevel@tonic-gate #endif 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate typedef struct ctf_helem { 707c478bd9Sstevel@tonic-gate uint_t h_name; /* reference to name in string table */ 717c478bd9Sstevel@tonic-gate ushort_t h_type; /* corresponding type ID number */ 727c478bd9Sstevel@tonic-gate ushort_t h_next; /* index of next element in hash chain */ 737c478bd9Sstevel@tonic-gate } ctf_helem_t; 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate typedef struct ctf_hash { 767c478bd9Sstevel@tonic-gate ushort_t *h_buckets; /* hash bucket array (chain indices) */ 777c478bd9Sstevel@tonic-gate ctf_helem_t *h_chains; /* hash chains buffer */ 787c478bd9Sstevel@tonic-gate ushort_t h_nbuckets; /* number of elements in bucket array */ 797c478bd9Sstevel@tonic-gate ushort_t h_nelems; /* number of elements in hash table */ 807c478bd9Sstevel@tonic-gate uint_t h_free; /* index of next free hash element */ 817c478bd9Sstevel@tonic-gate } ctf_hash_t; 827c478bd9Sstevel@tonic-gate 83*f3e7f55eSRobert Mustacchi struct ctf_idhash_iter { 84*f3e7f55eSRobert Mustacchi int cii_id; /* Current iteration id */ 85*f3e7f55eSRobert Mustacchi }; 86*f3e7f55eSRobert Mustacchi 877c478bd9Sstevel@tonic-gate typedef struct ctf_strs { 887c478bd9Sstevel@tonic-gate const char *cts_strs; /* base address of string table */ 897c478bd9Sstevel@tonic-gate size_t cts_len; /* size of string table in bytes */ 907c478bd9Sstevel@tonic-gate } ctf_strs_t; 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate typedef struct ctf_dmodel { 937c478bd9Sstevel@tonic-gate const char *ctd_name; /* data model name */ 947c478bd9Sstevel@tonic-gate int ctd_code; /* data model code */ 957c478bd9Sstevel@tonic-gate size_t ctd_pointer; /* size of void * in bytes */ 967c478bd9Sstevel@tonic-gate size_t ctd_char; /* size of char in bytes */ 977c478bd9Sstevel@tonic-gate size_t ctd_short; /* size of short in bytes */ 987c478bd9Sstevel@tonic-gate size_t ctd_int; /* size of int in bytes */ 997c478bd9Sstevel@tonic-gate size_t ctd_long; /* size of long in bytes */ 1007c478bd9Sstevel@tonic-gate } ctf_dmodel_t; 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate typedef struct ctf_lookup { 1037c478bd9Sstevel@tonic-gate const char *ctl_prefix; /* string prefix for this lookup */ 1047c478bd9Sstevel@tonic-gate size_t ctl_len; /* length of prefix string in bytes */ 1057c478bd9Sstevel@tonic-gate ctf_hash_t *ctl_hash; /* pointer to hash table for lookup */ 1067c478bd9Sstevel@tonic-gate } ctf_lookup_t; 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate typedef struct ctf_fileops { 1097c478bd9Sstevel@tonic-gate ushort_t (*ctfo_get_kind)(ushort_t); 1107c478bd9Sstevel@tonic-gate ushort_t (*ctfo_get_root)(ushort_t); 1117c478bd9Sstevel@tonic-gate ushort_t (*ctfo_get_vlen)(ushort_t); 1127c478bd9Sstevel@tonic-gate } ctf_fileops_t; 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate typedef struct ctf_list { 1157c478bd9Sstevel@tonic-gate struct ctf_list *l_prev; /* previous pointer or tail pointer */ 1167c478bd9Sstevel@tonic-gate struct ctf_list *l_next; /* next pointer or head pointer */ 1177c478bd9Sstevel@tonic-gate } ctf_list_t; 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate typedef enum { 1207c478bd9Sstevel@tonic-gate CTF_PREC_BASE, 1217c478bd9Sstevel@tonic-gate CTF_PREC_POINTER, 1227c478bd9Sstevel@tonic-gate CTF_PREC_ARRAY, 1237c478bd9Sstevel@tonic-gate CTF_PREC_FUNCTION, 1247c478bd9Sstevel@tonic-gate CTF_PREC_MAX 1257c478bd9Sstevel@tonic-gate } ctf_decl_prec_t; 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gate typedef struct ctf_decl_node { 1287c478bd9Sstevel@tonic-gate ctf_list_t cd_list; /* linked list pointers */ 1297c478bd9Sstevel@tonic-gate ctf_id_t cd_type; /* type identifier */ 1307c478bd9Sstevel@tonic-gate uint_t cd_kind; /* type kind */ 1317c478bd9Sstevel@tonic-gate uint_t cd_n; /* type dimension if array */ 1327c478bd9Sstevel@tonic-gate } ctf_decl_node_t; 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate typedef struct ctf_decl { 1357c478bd9Sstevel@tonic-gate ctf_list_t cd_nodes[CTF_PREC_MAX]; /* declaration node stacks */ 1367c478bd9Sstevel@tonic-gate int cd_order[CTF_PREC_MAX]; /* storage order of decls */ 1377c478bd9Sstevel@tonic-gate ctf_decl_prec_t cd_qualp; /* qualifier precision */ 1387c478bd9Sstevel@tonic-gate ctf_decl_prec_t cd_ordp; /* ordered precision */ 1397c478bd9Sstevel@tonic-gate char *cd_buf; /* buffer for output */ 1407c478bd9Sstevel@tonic-gate char *cd_ptr; /* buffer location */ 1417c478bd9Sstevel@tonic-gate char *cd_end; /* buffer limit */ 1427c478bd9Sstevel@tonic-gate size_t cd_len; /* buffer space required */ 1437c478bd9Sstevel@tonic-gate int cd_err; /* saved error value */ 1447c478bd9Sstevel@tonic-gate } ctf_decl_t; 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate typedef struct ctf_dmdef { 1477c478bd9Sstevel@tonic-gate ctf_list_t dmd_list; /* list forward/back pointers */ 1487c478bd9Sstevel@tonic-gate char *dmd_name; /* name of this member */ 1497c478bd9Sstevel@tonic-gate ctf_id_t dmd_type; /* type of this member (for sou) */ 1507c478bd9Sstevel@tonic-gate ulong_t dmd_offset; /* offset of this member in bits (for sou) */ 1517c478bd9Sstevel@tonic-gate int dmd_value; /* value of this member (for enum) */ 1527c478bd9Sstevel@tonic-gate } ctf_dmdef_t; 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate typedef struct ctf_dtdef { 1557c478bd9Sstevel@tonic-gate ctf_list_t dtd_list; /* list forward/back pointers */ 156e4586ebfSmws struct ctf_dtdef *dtd_hash; /* hash chain pointer for ctf_dthash */ 1577c478bd9Sstevel@tonic-gate char *dtd_name; /* name associated with definition (if any) */ 1587c478bd9Sstevel@tonic-gate ctf_id_t dtd_type; /* type identifier for this definition */ 1597c478bd9Sstevel@tonic-gate ctf_type_t dtd_data; /* type node (see <sys/ctf.h>) */ 1600a47c91cSRobert Mustacchi int dtd_ref; /* recfount for dyanmic types */ 1617c478bd9Sstevel@tonic-gate union { 1627c478bd9Sstevel@tonic-gate ctf_list_t dtu_members; /* struct, union, or enum */ 1637c478bd9Sstevel@tonic-gate ctf_arinfo_t dtu_arr; /* array */ 1647c478bd9Sstevel@tonic-gate ctf_encoding_t dtu_enc; /* integer or float */ 1657c478bd9Sstevel@tonic-gate ctf_id_t *dtu_argv; /* function */ 1667c478bd9Sstevel@tonic-gate } dtd_u; 1677c478bd9Sstevel@tonic-gate } ctf_dtdef_t; 1687c478bd9Sstevel@tonic-gate 169*f3e7f55eSRobert Mustacchi typedef struct ctf_dsdef { 170*f3e7f55eSRobert Mustacchi ctf_list_t dsd_list; /* list forward/back pointers */ 171*f3e7f55eSRobert Mustacchi ulong_t dsd_symidx; /* symbol id */ 172*f3e7f55eSRobert Mustacchi ctf_id_t dsd_tid; /* type for obj, 0 if function */ 173*f3e7f55eSRobert Mustacchi uint_t dsd_nargs; 174*f3e7f55eSRobert Mustacchi ctf_id_t *dsd_argc; /* function argv */ 175*f3e7f55eSRobert Mustacchi } ctf_dsdef_t; 176*f3e7f55eSRobert Mustacchi 177*f3e7f55eSRobert Mustacchi typedef struct ctf_dldef { 178*f3e7f55eSRobert Mustacchi ctf_list_t dld_list; /* list forward/back pointers */ 179*f3e7f55eSRobert Mustacchi char *dld_name; /* name of the label */ 180*f3e7f55eSRobert Mustacchi ctf_id_t dld_type; /* type ID associated with the label */ 181*f3e7f55eSRobert Mustacchi } ctf_dldef_t; 182*f3e7f55eSRobert Mustacchi 1837c478bd9Sstevel@tonic-gate typedef struct ctf_bundle { 1847c478bd9Sstevel@tonic-gate ctf_file_t *ctb_file; /* CTF container handle */ 1857c478bd9Sstevel@tonic-gate ctf_id_t ctb_type; /* CTF type identifier */ 1867c478bd9Sstevel@tonic-gate ctf_dtdef_t *ctb_dtd; /* CTF dynamic type definition (if any) */ 1877c478bd9Sstevel@tonic-gate } ctf_bundle_t; 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate /* 1907c478bd9Sstevel@tonic-gate * The ctf_file is the structure used to represent a CTF container to library 1917c478bd9Sstevel@tonic-gate * clients, who see it only as an opaque pointer. Modifications can therefore 1927c478bd9Sstevel@tonic-gate * be made freely to this structure without regard to client versioning. The 1937c478bd9Sstevel@tonic-gate * ctf_file_t typedef appears in <sys/ctf_api.h> and declares a forward tag. 1947c478bd9Sstevel@tonic-gate * 1957c478bd9Sstevel@tonic-gate * NOTE: ctf_update() requires that everything inside of ctf_file either be an 1967c478bd9Sstevel@tonic-gate * immediate value, a pointer to dynamically allocated data *outside* of the 1977c478bd9Sstevel@tonic-gate * ctf_file itself, or a pointer to statically allocated data. If you add a 1987c478bd9Sstevel@tonic-gate * pointer to ctf_file that points to something within the ctf_file itself, 1997c478bd9Sstevel@tonic-gate * you must make corresponding changes to ctf_update(). 2007c478bd9Sstevel@tonic-gate */ 2017c478bd9Sstevel@tonic-gate struct ctf_file { 2027c478bd9Sstevel@tonic-gate const ctf_fileops_t *ctf_fileops; /* version-specific file operations */ 2037c478bd9Sstevel@tonic-gate ctf_sect_t ctf_data; /* CTF data from object file */ 2047c478bd9Sstevel@tonic-gate ctf_sect_t ctf_symtab; /* symbol table from object file */ 2057c478bd9Sstevel@tonic-gate ctf_sect_t ctf_strtab; /* string table from object file */ 2067c478bd9Sstevel@tonic-gate ctf_hash_t ctf_structs; /* hash table of struct types */ 2077c478bd9Sstevel@tonic-gate ctf_hash_t ctf_unions; /* hash table of union types */ 2087c478bd9Sstevel@tonic-gate ctf_hash_t ctf_enums; /* hash table of enum types */ 2097c478bd9Sstevel@tonic-gate ctf_hash_t ctf_names; /* hash table of remaining type names */ 2107c478bd9Sstevel@tonic-gate ctf_lookup_t ctf_lookups[5]; /* pointers to hashes for name lookup */ 2117c478bd9Sstevel@tonic-gate ctf_strs_t ctf_str[2]; /* array of string table base and bounds */ 2127c478bd9Sstevel@tonic-gate const uchar_t *ctf_base; /* base of CTF header + uncompressed buffer */ 2137c478bd9Sstevel@tonic-gate const uchar_t *ctf_buf; /* uncompressed CTF data buffer */ 2147c478bd9Sstevel@tonic-gate size_t ctf_size; /* size of CTF header + uncompressed data */ 2157c478bd9Sstevel@tonic-gate uint_t *ctf_sxlate; /* translation table for symtab entries */ 2167c478bd9Sstevel@tonic-gate ulong_t ctf_nsyms; /* number of entries in symtab xlate table */ 2177c478bd9Sstevel@tonic-gate uint_t *ctf_txlate; /* translation table for type IDs */ 2187c478bd9Sstevel@tonic-gate ushort_t *ctf_ptrtab; /* translation table for pointer-to lookups */ 2197c478bd9Sstevel@tonic-gate ulong_t ctf_typemax; /* maximum valid type ID number */ 2207c478bd9Sstevel@tonic-gate const ctf_dmodel_t *ctf_dmodel; /* data model pointer (see above) */ 2217c478bd9Sstevel@tonic-gate struct ctf_file *ctf_parent; /* parent CTF container (if any) */ 2227c478bd9Sstevel@tonic-gate const char *ctf_parlabel; /* label in parent container (if any) */ 2237c478bd9Sstevel@tonic-gate const char *ctf_parname; /* basename of parent (if any) */ 2247c478bd9Sstevel@tonic-gate uint_t ctf_refcnt; /* reference count (for parent links) */ 2257c478bd9Sstevel@tonic-gate uint_t ctf_flags; /* libctf flags (see below) */ 2267c478bd9Sstevel@tonic-gate int ctf_errno; /* error code for most recent error */ 2277c478bd9Sstevel@tonic-gate int ctf_version; /* CTF data version */ 228e4586ebfSmws ctf_dtdef_t **ctf_dthash; /* hash of dynamic type definitions */ 229e4586ebfSmws ulong_t ctf_dthashlen; /* size of dynamic type hash bucket array */ 2307c478bd9Sstevel@tonic-gate ctf_list_t ctf_dtdefs; /* list of dynamic type definitions */ 2317c478bd9Sstevel@tonic-gate size_t ctf_dtstrlen; /* total length of dynamic type strings */ 2327c478bd9Sstevel@tonic-gate ulong_t ctf_dtnextid; /* next dynamic type id to assign */ 2337c478bd9Sstevel@tonic-gate ulong_t ctf_dtoldid; /* oldest id that has been committed */ 2347c478bd9Sstevel@tonic-gate void *ctf_specific; /* data for ctf_get/setspecific */ 235*f3e7f55eSRobert Mustacchi ctf_list_t ctf_dsdefs; /* list of dynamic obj/func definitions */ 236*f3e7f55eSRobert Mustacchi ctf_list_t ctf_dldefs; /* list of dynamic labels */ 237*f3e7f55eSRobert Mustacchi uint_t ctf_hflags; /* original flags on the header */ 2387c478bd9Sstevel@tonic-gate }; 2397c478bd9Sstevel@tonic-gate 2407c478bd9Sstevel@tonic-gate #define LCTF_INDEX_TO_TYPEPTR(fp, i) \ 2417c478bd9Sstevel@tonic-gate ((ctf_type_t *)((uintptr_t)(fp)->ctf_buf + (fp)->ctf_txlate[(i)])) 2427c478bd9Sstevel@tonic-gate 2437c478bd9Sstevel@tonic-gate #define LCTF_INFO_KIND(fp, info) ((fp)->ctf_fileops->ctfo_get_kind(info)) 2447c478bd9Sstevel@tonic-gate #define LCTF_INFO_ROOT(fp, info) ((fp)->ctf_fileops->ctfo_get_root(info)) 2457c478bd9Sstevel@tonic-gate #define LCTF_INFO_VLEN(fp, info) ((fp)->ctf_fileops->ctfo_get_vlen(info)) 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate #define LCTF_MMAP 0x0001 /* libctf should munmap buffers on close */ 2487c478bd9Sstevel@tonic-gate #define LCTF_CHILD 0x0002 /* CTF container is a child */ 2497c478bd9Sstevel@tonic-gate #define LCTF_RDWR 0x0004 /* CTF container is writable */ 2507c478bd9Sstevel@tonic-gate #define LCTF_DIRTY 0x0008 /* CTF container has been modified */ 2517c478bd9Sstevel@tonic-gate 252*f3e7f55eSRobert Mustacchi #define CTF_ELF_SCN_NAME ".SUNW_ctf" 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gate extern ssize_t ctf_get_ctt_size(const ctf_file_t *, const ctf_type_t *, 2557c478bd9Sstevel@tonic-gate ssize_t *, ssize_t *); 2567c478bd9Sstevel@tonic-gate 2577c478bd9Sstevel@tonic-gate extern const ctf_type_t *ctf_lookup_by_id(ctf_file_t **, ctf_id_t); 2587c478bd9Sstevel@tonic-gate 259*f3e7f55eSRobert Mustacchi extern ctf_file_t *ctf_fdcreate_int(int, int *, ctf_sect_t *); 260*f3e7f55eSRobert Mustacchi 2617c478bd9Sstevel@tonic-gate extern int ctf_hash_create(ctf_hash_t *, ulong_t); 2627c478bd9Sstevel@tonic-gate extern int ctf_hash_insert(ctf_hash_t *, ctf_file_t *, ushort_t, uint_t); 263e4586ebfSmws extern int ctf_hash_define(ctf_hash_t *, ctf_file_t *, ushort_t, uint_t); 2647c478bd9Sstevel@tonic-gate extern ctf_helem_t *ctf_hash_lookup(ctf_hash_t *, ctf_file_t *, 2657c478bd9Sstevel@tonic-gate const char *, size_t); 2667c478bd9Sstevel@tonic-gate extern uint_t ctf_hash_size(const ctf_hash_t *); 2677c478bd9Sstevel@tonic-gate extern void ctf_hash_destroy(ctf_hash_t *); 2687c478bd9Sstevel@tonic-gate 2697c478bd9Sstevel@tonic-gate #define ctf_list_prev(elem) ((void *)(((ctf_list_t *)(elem))->l_prev)) 2707c478bd9Sstevel@tonic-gate #define ctf_list_next(elem) ((void *)(((ctf_list_t *)(elem))->l_next)) 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate extern void ctf_list_append(ctf_list_t *, void *); 2737c478bd9Sstevel@tonic-gate extern void ctf_list_prepend(ctf_list_t *, void *); 274*f3e7f55eSRobert Mustacchi extern void ctf_list_insert_before(ctf_list_t *, void *, void *); 2757c478bd9Sstevel@tonic-gate extern void ctf_list_delete(ctf_list_t *, void *); 2767c478bd9Sstevel@tonic-gate 277e4586ebfSmws extern void ctf_dtd_insert(ctf_file_t *, ctf_dtdef_t *); 278e4586ebfSmws extern void ctf_dtd_delete(ctf_file_t *, ctf_dtdef_t *); 279e4586ebfSmws extern ctf_dtdef_t *ctf_dtd_lookup(ctf_file_t *, ctf_id_t); 280e4586ebfSmws 281*f3e7f55eSRobert Mustacchi extern void ctf_dsd_delete(ctf_file_t *, ctf_dsdef_t *); 282*f3e7f55eSRobert Mustacchi extern void ctf_dld_delete(ctf_file_t *, ctf_dldef_t *); 283*f3e7f55eSRobert Mustacchi 2847c478bd9Sstevel@tonic-gate extern void ctf_decl_init(ctf_decl_t *, char *, size_t); 2857c478bd9Sstevel@tonic-gate extern void ctf_decl_fini(ctf_decl_t *); 2867c478bd9Sstevel@tonic-gate extern void ctf_decl_push(ctf_decl_t *, ctf_file_t *, ctf_id_t); 2877c478bd9Sstevel@tonic-gate extern void ctf_decl_sprintf(ctf_decl_t *, const char *, ...); 2887c478bd9Sstevel@tonic-gate 2897c478bd9Sstevel@tonic-gate extern const char *ctf_strraw(ctf_file_t *, uint_t); 2907c478bd9Sstevel@tonic-gate extern const char *ctf_strptr(ctf_file_t *, uint_t); 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate extern ctf_file_t *ctf_set_open_errno(int *, int); 2937c478bd9Sstevel@tonic-gate extern long ctf_set_errno(ctf_file_t *, int); 2947c478bd9Sstevel@tonic-gate 2957c478bd9Sstevel@tonic-gate extern const void *ctf_sect_mmap(ctf_sect_t *, int); 2967c478bd9Sstevel@tonic-gate extern void ctf_sect_munmap(const ctf_sect_t *); 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gate extern void *ctf_data_alloc(size_t); 2997c478bd9Sstevel@tonic-gate extern void ctf_data_free(void *, size_t); 3007c478bd9Sstevel@tonic-gate extern void ctf_data_protect(void *, size_t); 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gate extern void *ctf_alloc(size_t); 3037c478bd9Sstevel@tonic-gate extern void ctf_free(void *, size_t); 3047c478bd9Sstevel@tonic-gate 3057c478bd9Sstevel@tonic-gate extern char *ctf_strdup(const char *); 3067c478bd9Sstevel@tonic-gate extern const char *ctf_strerror(int); 3077c478bd9Sstevel@tonic-gate extern void ctf_dprintf(const char *, ...); 3087c478bd9Sstevel@tonic-gate 3097c478bd9Sstevel@tonic-gate extern void *ctf_zopen(int *); 3107c478bd9Sstevel@tonic-gate 311*f3e7f55eSRobert Mustacchi extern ctf_id_t ctf_add_encoded(ctf_file_t *, uint_t, const char *, 312*f3e7f55eSRobert Mustacchi const ctf_encoding_t *, uint_t); 313*f3e7f55eSRobert Mustacchi extern ctf_id_t ctf_add_reftype(ctf_file_t *, uint_t, const char *, ctf_id_t, 314*f3e7f55eSRobert Mustacchi uint_t); 315*f3e7f55eSRobert Mustacchi extern boolean_t ctf_sym_valid(uintptr_t, int, uint16_t, uint64_t, 316*f3e7f55eSRobert Mustacchi uint32_t); 317*f3e7f55eSRobert Mustacchi 3187c478bd9Sstevel@tonic-gate extern const char _CTF_SECTION[]; /* name of CTF ELF section */ 3197c478bd9Sstevel@tonic-gate extern const char _CTF_NULLSTR[]; /* empty string */ 3207c478bd9Sstevel@tonic-gate 3217c478bd9Sstevel@tonic-gate extern int _libctf_version; /* library client version */ 3227c478bd9Sstevel@tonic-gate extern int _libctf_debug; /* debugging messages enabled */ 3237c478bd9Sstevel@tonic-gate 3247c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3257c478bd9Sstevel@tonic-gate } 3267c478bd9Sstevel@tonic-gate #endif 3277c478bd9Sstevel@tonic-gate 3287c478bd9Sstevel@tonic-gate #endif /* _CTF_IMPL_H */ 329