10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 22*1222Smws 230Sstevel@tonic-gate /* 24*1222Smws * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 250Sstevel@tonic-gate * Use is subject to license terms. 260Sstevel@tonic-gate */ 270Sstevel@tonic-gate 280Sstevel@tonic-gate #ifndef _CTF_IMPL_H 290Sstevel@tonic-gate #define _CTF_IMPL_H 300Sstevel@tonic-gate 310Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/types.h> 340Sstevel@tonic-gate #include <sys/errno.h> 350Sstevel@tonic-gate #include <sys/sysmacros.h> 360Sstevel@tonic-gate #include <sys/ctf_api.h> 370Sstevel@tonic-gate 380Sstevel@tonic-gate #ifdef _KERNEL 390Sstevel@tonic-gate 400Sstevel@tonic-gate #include <sys/systm.h> 410Sstevel@tonic-gate #include <sys/cmn_err.h> 420Sstevel@tonic-gate #include <sys/varargs.h> 430Sstevel@tonic-gate 440Sstevel@tonic-gate #define isspace(c) \ 450Sstevel@tonic-gate ((c) == ' ' || (c) == '\t' || (c) == '\n' || \ 460Sstevel@tonic-gate (c) == '\r' || (c) == '\f' || (c) == '\v') 470Sstevel@tonic-gate 480Sstevel@tonic-gate #define MAP_FAILED ((void *)-1) 490Sstevel@tonic-gate 500Sstevel@tonic-gate #else /* _KERNEL */ 510Sstevel@tonic-gate 520Sstevel@tonic-gate #include <strings.h> 530Sstevel@tonic-gate #include <stdlib.h> 540Sstevel@tonic-gate #include <stdarg.h> 550Sstevel@tonic-gate #include <stdio.h> 560Sstevel@tonic-gate #include <limits.h> 570Sstevel@tonic-gate #include <ctype.h> 580Sstevel@tonic-gate 590Sstevel@tonic-gate #endif /* _KERNEL */ 600Sstevel@tonic-gate 610Sstevel@tonic-gate #ifdef __cplusplus 620Sstevel@tonic-gate extern "C" { 630Sstevel@tonic-gate #endif 640Sstevel@tonic-gate 650Sstevel@tonic-gate typedef struct ctf_helem { 660Sstevel@tonic-gate uint_t h_name; /* reference to name in string table */ 670Sstevel@tonic-gate ushort_t h_type; /* corresponding type ID number */ 680Sstevel@tonic-gate ushort_t h_next; /* index of next element in hash chain */ 690Sstevel@tonic-gate } ctf_helem_t; 700Sstevel@tonic-gate 710Sstevel@tonic-gate typedef struct ctf_hash { 720Sstevel@tonic-gate ushort_t *h_buckets; /* hash bucket array (chain indices) */ 730Sstevel@tonic-gate ctf_helem_t *h_chains; /* hash chains buffer */ 740Sstevel@tonic-gate ushort_t h_nbuckets; /* number of elements in bucket array */ 750Sstevel@tonic-gate ushort_t h_nelems; /* number of elements in hash table */ 760Sstevel@tonic-gate uint_t h_free; /* index of next free hash element */ 770Sstevel@tonic-gate } ctf_hash_t; 780Sstevel@tonic-gate 790Sstevel@tonic-gate typedef struct ctf_strs { 800Sstevel@tonic-gate const char *cts_strs; /* base address of string table */ 810Sstevel@tonic-gate size_t cts_len; /* size of string table in bytes */ 820Sstevel@tonic-gate } ctf_strs_t; 830Sstevel@tonic-gate 840Sstevel@tonic-gate typedef struct ctf_dmodel { 850Sstevel@tonic-gate const char *ctd_name; /* data model name */ 860Sstevel@tonic-gate int ctd_code; /* data model code */ 870Sstevel@tonic-gate size_t ctd_pointer; /* size of void * in bytes */ 880Sstevel@tonic-gate size_t ctd_char; /* size of char in bytes */ 890Sstevel@tonic-gate size_t ctd_short; /* size of short in bytes */ 900Sstevel@tonic-gate size_t ctd_int; /* size of int in bytes */ 910Sstevel@tonic-gate size_t ctd_long; /* size of long in bytes */ 920Sstevel@tonic-gate } ctf_dmodel_t; 930Sstevel@tonic-gate 940Sstevel@tonic-gate typedef struct ctf_lookup { 950Sstevel@tonic-gate const char *ctl_prefix; /* string prefix for this lookup */ 960Sstevel@tonic-gate size_t ctl_len; /* length of prefix string in bytes */ 970Sstevel@tonic-gate ctf_hash_t *ctl_hash; /* pointer to hash table for lookup */ 980Sstevel@tonic-gate } ctf_lookup_t; 990Sstevel@tonic-gate 1000Sstevel@tonic-gate typedef struct ctf_fileops { 1010Sstevel@tonic-gate ushort_t (*ctfo_get_kind)(ushort_t); 1020Sstevel@tonic-gate ushort_t (*ctfo_get_root)(ushort_t); 1030Sstevel@tonic-gate ushort_t (*ctfo_get_vlen)(ushort_t); 1040Sstevel@tonic-gate } ctf_fileops_t; 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate typedef struct ctf_list { 1070Sstevel@tonic-gate struct ctf_list *l_prev; /* previous pointer or tail pointer */ 1080Sstevel@tonic-gate struct ctf_list *l_next; /* next pointer or head pointer */ 1090Sstevel@tonic-gate } ctf_list_t; 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate typedef enum { 1120Sstevel@tonic-gate CTF_PREC_BASE, 1130Sstevel@tonic-gate CTF_PREC_POINTER, 1140Sstevel@tonic-gate CTF_PREC_ARRAY, 1150Sstevel@tonic-gate CTF_PREC_FUNCTION, 1160Sstevel@tonic-gate CTF_PREC_MAX 1170Sstevel@tonic-gate } ctf_decl_prec_t; 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate typedef struct ctf_decl_node { 1200Sstevel@tonic-gate ctf_list_t cd_list; /* linked list pointers */ 1210Sstevel@tonic-gate ctf_id_t cd_type; /* type identifier */ 1220Sstevel@tonic-gate uint_t cd_kind; /* type kind */ 1230Sstevel@tonic-gate uint_t cd_n; /* type dimension if array */ 1240Sstevel@tonic-gate } ctf_decl_node_t; 1250Sstevel@tonic-gate 1260Sstevel@tonic-gate typedef struct ctf_decl { 1270Sstevel@tonic-gate ctf_list_t cd_nodes[CTF_PREC_MAX]; /* declaration node stacks */ 1280Sstevel@tonic-gate int cd_order[CTF_PREC_MAX]; /* storage order of decls */ 1290Sstevel@tonic-gate ctf_decl_prec_t cd_qualp; /* qualifier precision */ 1300Sstevel@tonic-gate ctf_decl_prec_t cd_ordp; /* ordered precision */ 1310Sstevel@tonic-gate char *cd_buf; /* buffer for output */ 1320Sstevel@tonic-gate char *cd_ptr; /* buffer location */ 1330Sstevel@tonic-gate char *cd_end; /* buffer limit */ 1340Sstevel@tonic-gate size_t cd_len; /* buffer space required */ 1350Sstevel@tonic-gate int cd_err; /* saved error value */ 1360Sstevel@tonic-gate } ctf_decl_t; 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate typedef struct ctf_dmdef { 1390Sstevel@tonic-gate ctf_list_t dmd_list; /* list forward/back pointers */ 1400Sstevel@tonic-gate char *dmd_name; /* name of this member */ 1410Sstevel@tonic-gate ctf_id_t dmd_type; /* type of this member (for sou) */ 1420Sstevel@tonic-gate ulong_t dmd_offset; /* offset of this member in bits (for sou) */ 1430Sstevel@tonic-gate int dmd_value; /* value of this member (for enum) */ 1440Sstevel@tonic-gate } ctf_dmdef_t; 1450Sstevel@tonic-gate 1460Sstevel@tonic-gate typedef struct ctf_dtdef { 1470Sstevel@tonic-gate ctf_list_t dtd_list; /* list forward/back pointers */ 148*1222Smws struct ctf_dtdef *dtd_hash; /* hash chain pointer for ctf_dthash */ 1490Sstevel@tonic-gate char *dtd_name; /* name associated with definition (if any) */ 1500Sstevel@tonic-gate ctf_id_t dtd_type; /* type identifier for this definition */ 1510Sstevel@tonic-gate ctf_type_t dtd_data; /* type node (see <sys/ctf.h>) */ 1520Sstevel@tonic-gate union { 1530Sstevel@tonic-gate ctf_list_t dtu_members; /* struct, union, or enum */ 1540Sstevel@tonic-gate ctf_arinfo_t dtu_arr; /* array */ 1550Sstevel@tonic-gate ctf_encoding_t dtu_enc; /* integer or float */ 1560Sstevel@tonic-gate ctf_id_t *dtu_argv; /* function */ 1570Sstevel@tonic-gate } dtd_u; 1580Sstevel@tonic-gate } ctf_dtdef_t; 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate typedef struct ctf_bundle { 1610Sstevel@tonic-gate ctf_file_t *ctb_file; /* CTF container handle */ 1620Sstevel@tonic-gate ctf_id_t ctb_type; /* CTF type identifier */ 1630Sstevel@tonic-gate ctf_dtdef_t *ctb_dtd; /* CTF dynamic type definition (if any) */ 1640Sstevel@tonic-gate } ctf_bundle_t; 1650Sstevel@tonic-gate 1660Sstevel@tonic-gate /* 1670Sstevel@tonic-gate * The ctf_file is the structure used to represent a CTF container to library 1680Sstevel@tonic-gate * clients, who see it only as an opaque pointer. Modifications can therefore 1690Sstevel@tonic-gate * be made freely to this structure without regard to client versioning. The 1700Sstevel@tonic-gate * ctf_file_t typedef appears in <sys/ctf_api.h> and declares a forward tag. 1710Sstevel@tonic-gate * 1720Sstevel@tonic-gate * NOTE: ctf_update() requires that everything inside of ctf_file either be an 1730Sstevel@tonic-gate * immediate value, a pointer to dynamically allocated data *outside* of the 1740Sstevel@tonic-gate * ctf_file itself, or a pointer to statically allocated data. If you add a 1750Sstevel@tonic-gate * pointer to ctf_file that points to something within the ctf_file itself, 1760Sstevel@tonic-gate * you must make corresponding changes to ctf_update(). 1770Sstevel@tonic-gate */ 1780Sstevel@tonic-gate struct ctf_file { 1790Sstevel@tonic-gate const ctf_fileops_t *ctf_fileops; /* version-specific file operations */ 1800Sstevel@tonic-gate ctf_sect_t ctf_data; /* CTF data from object file */ 1810Sstevel@tonic-gate ctf_sect_t ctf_symtab; /* symbol table from object file */ 1820Sstevel@tonic-gate ctf_sect_t ctf_strtab; /* string table from object file */ 1830Sstevel@tonic-gate ctf_hash_t ctf_structs; /* hash table of struct types */ 1840Sstevel@tonic-gate ctf_hash_t ctf_unions; /* hash table of union types */ 1850Sstevel@tonic-gate ctf_hash_t ctf_enums; /* hash table of enum types */ 1860Sstevel@tonic-gate ctf_hash_t ctf_names; /* hash table of remaining type names */ 1870Sstevel@tonic-gate ctf_lookup_t ctf_lookups[5]; /* pointers to hashes for name lookup */ 1880Sstevel@tonic-gate ctf_strs_t ctf_str[2]; /* array of string table base and bounds */ 1890Sstevel@tonic-gate const uchar_t *ctf_base; /* base of CTF header + uncompressed buffer */ 1900Sstevel@tonic-gate const uchar_t *ctf_buf; /* uncompressed CTF data buffer */ 1910Sstevel@tonic-gate size_t ctf_size; /* size of CTF header + uncompressed data */ 1920Sstevel@tonic-gate uint_t *ctf_sxlate; /* translation table for symtab entries */ 1930Sstevel@tonic-gate ulong_t ctf_nsyms; /* number of entries in symtab xlate table */ 1940Sstevel@tonic-gate uint_t *ctf_txlate; /* translation table for type IDs */ 1950Sstevel@tonic-gate ushort_t *ctf_ptrtab; /* translation table for pointer-to lookups */ 1960Sstevel@tonic-gate ulong_t ctf_typemax; /* maximum valid type ID number */ 1970Sstevel@tonic-gate const ctf_dmodel_t *ctf_dmodel; /* data model pointer (see above) */ 1980Sstevel@tonic-gate struct ctf_file *ctf_parent; /* parent CTF container (if any) */ 1990Sstevel@tonic-gate const char *ctf_parlabel; /* label in parent container (if any) */ 2000Sstevel@tonic-gate const char *ctf_parname; /* basename of parent (if any) */ 2010Sstevel@tonic-gate uint_t ctf_refcnt; /* reference count (for parent links) */ 2020Sstevel@tonic-gate uint_t ctf_flags; /* libctf flags (see below) */ 2030Sstevel@tonic-gate int ctf_errno; /* error code for most recent error */ 2040Sstevel@tonic-gate int ctf_version; /* CTF data version */ 205*1222Smws ctf_dtdef_t **ctf_dthash; /* hash of dynamic type definitions */ 206*1222Smws ulong_t ctf_dthashlen; /* size of dynamic type hash bucket array */ 2070Sstevel@tonic-gate ctf_list_t ctf_dtdefs; /* list of dynamic type definitions */ 2080Sstevel@tonic-gate size_t ctf_dtstrlen; /* total length of dynamic type strings */ 2090Sstevel@tonic-gate ulong_t ctf_dtnextid; /* next dynamic type id to assign */ 2100Sstevel@tonic-gate ulong_t ctf_dtoldid; /* oldest id that has been committed */ 2110Sstevel@tonic-gate void *ctf_specific; /* data for ctf_get/setspecific */ 2120Sstevel@tonic-gate }; 2130Sstevel@tonic-gate 2140Sstevel@tonic-gate #define LCTF_INDEX_TO_TYPEPTR(fp, i) \ 2150Sstevel@tonic-gate ((ctf_type_t *)((uintptr_t)(fp)->ctf_buf + (fp)->ctf_txlate[(i)])) 2160Sstevel@tonic-gate 2170Sstevel@tonic-gate #define LCTF_INFO_KIND(fp, info) ((fp)->ctf_fileops->ctfo_get_kind(info)) 2180Sstevel@tonic-gate #define LCTF_INFO_ROOT(fp, info) ((fp)->ctf_fileops->ctfo_get_root(info)) 2190Sstevel@tonic-gate #define LCTF_INFO_VLEN(fp, info) ((fp)->ctf_fileops->ctfo_get_vlen(info)) 2200Sstevel@tonic-gate 2210Sstevel@tonic-gate #define LCTF_MMAP 0x0001 /* libctf should munmap buffers on close */ 2220Sstevel@tonic-gate #define LCTF_CHILD 0x0002 /* CTF container is a child */ 2230Sstevel@tonic-gate #define LCTF_RDWR 0x0004 /* CTF container is writable */ 2240Sstevel@tonic-gate #define LCTF_DIRTY 0x0008 /* CTF container has been modified */ 2250Sstevel@tonic-gate 2260Sstevel@tonic-gate #define ECTF_BASE 1000 /* base value for libctf errnos */ 2270Sstevel@tonic-gate 2280Sstevel@tonic-gate enum { 2290Sstevel@tonic-gate ECTF_FMT = ECTF_BASE, /* file is not in CTF or ELF format */ 2300Sstevel@tonic-gate ECTF_ELFVERS, /* ELF version is more recent than libctf */ 2310Sstevel@tonic-gate ECTF_CTFVERS, /* CTF version is more recent than libctf */ 2320Sstevel@tonic-gate ECTF_ENDIAN, /* data is different endian-ness than lib */ 2330Sstevel@tonic-gate ECTF_SYMTAB, /* symbol table uses invalid entry size */ 2340Sstevel@tonic-gate ECTF_SYMBAD, /* symbol table data buffer invalid */ 2350Sstevel@tonic-gate ECTF_STRBAD, /* string table data buffer invalid */ 2360Sstevel@tonic-gate ECTF_CORRUPT, /* file data corruption detected */ 2370Sstevel@tonic-gate ECTF_NOCTFDATA, /* ELF file does not contain CTF data */ 2380Sstevel@tonic-gate ECTF_NOCTFBUF, /* buffer does not contain CTF data */ 2390Sstevel@tonic-gate ECTF_NOSYMTAB, /* symbol table data is not available */ 2400Sstevel@tonic-gate ECTF_NOPARENT, /* parent CTF container is not available */ 2410Sstevel@tonic-gate ECTF_DMODEL, /* data model mismatch */ 2420Sstevel@tonic-gate ECTF_MMAP, /* failed to mmap a data section */ 2430Sstevel@tonic-gate ECTF_ZMISSING, /* decompression library not installed */ 2440Sstevel@tonic-gate ECTF_ZINIT, /* failed to initialize decompression library */ 2450Sstevel@tonic-gate ECTF_ZALLOC, /* failed to allocate decompression buffer */ 2460Sstevel@tonic-gate ECTF_DECOMPRESS, /* failed to decompress CTF data */ 2470Sstevel@tonic-gate ECTF_STRTAB, /* string table for this string is missing */ 2480Sstevel@tonic-gate ECTF_BADNAME, /* string offset is corrupt w.r.t. strtab */ 2490Sstevel@tonic-gate ECTF_BADID, /* invalid type ID number */ 2500Sstevel@tonic-gate ECTF_NOTSOU, /* type is not a struct or union */ 2510Sstevel@tonic-gate ECTF_NOTENUM, /* type is not an enum */ 2520Sstevel@tonic-gate ECTF_NOTSUE, /* type is not a struct, union, or enum */ 2530Sstevel@tonic-gate ECTF_NOTINTFP, /* type is not an integer or float */ 2540Sstevel@tonic-gate ECTF_NOTARRAY, /* type is not an array */ 2550Sstevel@tonic-gate ECTF_NOTREF, /* type does not reference another type */ 2560Sstevel@tonic-gate ECTF_NAMELEN, /* buffer is too small to hold type name */ 2570Sstevel@tonic-gate ECTF_NOTYPE, /* no type found corresponding to name */ 2580Sstevel@tonic-gate ECTF_SYNTAX, /* syntax error in type name */ 2590Sstevel@tonic-gate ECTF_NOTFUNC, /* symtab entry does not refer to a function */ 2600Sstevel@tonic-gate ECTF_NOFUNCDAT, /* no func info available for function */ 2610Sstevel@tonic-gate ECTF_NOTDATA, /* symtab entry does not refer to a data obj */ 2620Sstevel@tonic-gate ECTF_NOTYPEDAT, /* no type info available for object */ 2630Sstevel@tonic-gate ECTF_NOLABEL, /* no label found corresponding to name */ 2640Sstevel@tonic-gate ECTF_NOLABELDATA, /* file does not contain any labels */ 2650Sstevel@tonic-gate ECTF_NOTSUP, /* feature not supported */ 2660Sstevel@tonic-gate ECTF_NOENUMNAM, /* enum element name not found */ 2670Sstevel@tonic-gate ECTF_NOMEMBNAM, /* member name not found */ 2680Sstevel@tonic-gate ECTF_RDONLY, /* CTF container is read-only */ 2690Sstevel@tonic-gate ECTF_DTFULL, /* CTF type is full (no more members allowed) */ 2700Sstevel@tonic-gate ECTF_FULL, /* CTF container is full */ 2710Sstevel@tonic-gate ECTF_DUPMEMBER, /* duplicate member name definition */ 2720Sstevel@tonic-gate ECTF_CONFLICT /* conflicting type definition present */ 2730Sstevel@tonic-gate }; 2740Sstevel@tonic-gate 2750Sstevel@tonic-gate extern ssize_t ctf_get_ctt_size(const ctf_file_t *, const ctf_type_t *, 2760Sstevel@tonic-gate ssize_t *, ssize_t *); 2770Sstevel@tonic-gate 2780Sstevel@tonic-gate extern const ctf_type_t *ctf_lookup_by_id(ctf_file_t **, ctf_id_t); 2790Sstevel@tonic-gate 2800Sstevel@tonic-gate extern int ctf_hash_create(ctf_hash_t *, ulong_t); 2810Sstevel@tonic-gate extern int ctf_hash_insert(ctf_hash_t *, ctf_file_t *, ushort_t, uint_t); 282*1222Smws extern int ctf_hash_define(ctf_hash_t *, ctf_file_t *, ushort_t, uint_t); 2830Sstevel@tonic-gate extern ctf_helem_t *ctf_hash_lookup(ctf_hash_t *, ctf_file_t *, 2840Sstevel@tonic-gate const char *, size_t); 2850Sstevel@tonic-gate extern uint_t ctf_hash_size(const ctf_hash_t *); 2860Sstevel@tonic-gate extern void ctf_hash_destroy(ctf_hash_t *); 2870Sstevel@tonic-gate 2880Sstevel@tonic-gate #define ctf_list_prev(elem) ((void *)(((ctf_list_t *)(elem))->l_prev)) 2890Sstevel@tonic-gate #define ctf_list_next(elem) ((void *)(((ctf_list_t *)(elem))->l_next)) 2900Sstevel@tonic-gate 2910Sstevel@tonic-gate extern void ctf_list_append(ctf_list_t *, void *); 2920Sstevel@tonic-gate extern void ctf_list_prepend(ctf_list_t *, void *); 2930Sstevel@tonic-gate extern void ctf_list_delete(ctf_list_t *, void *); 2940Sstevel@tonic-gate 295*1222Smws extern void ctf_dtd_insert(ctf_file_t *, ctf_dtdef_t *); 296*1222Smws extern void ctf_dtd_delete(ctf_file_t *, ctf_dtdef_t *); 297*1222Smws extern ctf_dtdef_t *ctf_dtd_lookup(ctf_file_t *, ctf_id_t); 298*1222Smws 2990Sstevel@tonic-gate extern void ctf_decl_init(ctf_decl_t *, char *, size_t); 3000Sstevel@tonic-gate extern void ctf_decl_fini(ctf_decl_t *); 3010Sstevel@tonic-gate extern void ctf_decl_push(ctf_decl_t *, ctf_file_t *, ctf_id_t); 3020Sstevel@tonic-gate extern void ctf_decl_sprintf(ctf_decl_t *, const char *, ...); 3030Sstevel@tonic-gate 3040Sstevel@tonic-gate extern const char *ctf_strraw(ctf_file_t *, uint_t); 3050Sstevel@tonic-gate extern const char *ctf_strptr(ctf_file_t *, uint_t); 3060Sstevel@tonic-gate 3070Sstevel@tonic-gate extern ctf_file_t *ctf_set_open_errno(int *, int); 3080Sstevel@tonic-gate extern long ctf_set_errno(ctf_file_t *, int); 3090Sstevel@tonic-gate 3100Sstevel@tonic-gate extern const void *ctf_sect_mmap(ctf_sect_t *, int); 3110Sstevel@tonic-gate extern void ctf_sect_munmap(const ctf_sect_t *); 3120Sstevel@tonic-gate 3130Sstevel@tonic-gate extern void *ctf_data_alloc(size_t); 3140Sstevel@tonic-gate extern void ctf_data_free(void *, size_t); 3150Sstevel@tonic-gate extern void ctf_data_protect(void *, size_t); 3160Sstevel@tonic-gate 3170Sstevel@tonic-gate extern void *ctf_alloc(size_t); 3180Sstevel@tonic-gate extern void ctf_free(void *, size_t); 3190Sstevel@tonic-gate 3200Sstevel@tonic-gate extern char *ctf_strdup(const char *); 3210Sstevel@tonic-gate extern const char *ctf_strerror(int); 3220Sstevel@tonic-gate extern void ctf_dprintf(const char *, ...); 3230Sstevel@tonic-gate 3240Sstevel@tonic-gate extern void *ctf_zopen(int *); 3250Sstevel@tonic-gate 3260Sstevel@tonic-gate extern const char _CTF_SECTION[]; /* name of CTF ELF section */ 3270Sstevel@tonic-gate extern const char _CTF_NULLSTR[]; /* empty string */ 3280Sstevel@tonic-gate 3290Sstevel@tonic-gate extern int _libctf_version; /* library client version */ 3300Sstevel@tonic-gate extern int _libctf_debug; /* debugging messages enabled */ 3310Sstevel@tonic-gate 3320Sstevel@tonic-gate #ifdef __cplusplus 3330Sstevel@tonic-gate } 3340Sstevel@tonic-gate #endif 3350Sstevel@tonic-gate 3360Sstevel@tonic-gate #endif /* _CTF_IMPL_H */ 337