Path: blob/main/cddl/contrib/opensolaris/common/ctf/ctf_error.c
39507 views
/*1* CDDL HEADER START2*3* The contents of this file are subject to the terms of the4* Common Development and Distribution License, Version 1.0 only5* (the "License"). You may not use this file except in compliance6* with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or http://www.opensolaris.org/os/licensing.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/21/*22* Copyright 2003 Sun Microsystems, Inc. All rights reserved.23* Use is subject to license terms.24*/25/*26* Copyright (c) 2012, Joyent, Inc.27*/2829#include <ctf_impl.h>3031static const char *const _ctf_errlist[] = {32"File is not in CTF or ELF format", /* ECTF_FMT */33"File uses more recent ELF version than libctf", /* ECTF_ELFVERS */34"File uses more recent CTF version than libctf", /* ECTF_CTFVERS */35"File is a different endian-ness than libctf", /* ECTF_ENDIAN */36"Symbol table uses invalid entry size", /* ECTF_SYMTAB */37"Symbol table data buffer is not valid", /* ECTF_SYMBAD */38"String table data buffer is not valid", /* ECTF_STRBAD */39"File data structure corruption detected", /* ECTF_CORRUPT */40"File does not contain CTF data", /* ECTF_NOCTFDATA */41"Buffer does not contain CTF data", /* ECTF_NOCTFBUF */42"Symbol table information is not available", /* ECTF_NOSYMTAB */43"Type information is in parent and unavailable", /* ECTF_NOPARENT */44"Cannot import types with different data model", /* ECTF_DMODEL */45"Failed to mmap a needed data section", /* ECTF_MMAP */46"Decompression package SUNWzlib not installed", /* ECTF_ZMISSING */47"Failed to initialize decompression library", /* ECTF_ZINIT */48"Failed to allocate decompression buffer", /* ECTF_ZALLOC */49"Failed to decompress CTF data", /* ECTF_DECOMPRESS */50"External string table is not available", /* ECTF_STRTAB */51"String name offset is corrupt", /* ECTF_BADNAME */52"Invalid type identifier", /* ECTF_BADID */53"Type is not a struct or union", /* ECTF_NOTSOU */54"Type is not an enum", /* ECTF_NOTENUM */55"Type is not a struct, union, or enum", /* ECTF_NOTSUE */56"Type is not an integer or float", /* ECTF_NOTINTFP */57"Type is not an array", /* ECTF_NOTARRAY */58"Type does not reference another type", /* ECTF_NOTREF */59"Input buffer is too small for type name", /* ECTF_NAMELEN */60"No type information available for that name", /* ECTF_NOTYPE */61"Syntax error in type name", /* ECTF_SYNTAX */62"Symbol table entry is not a function", /* ECTF_NOTFUNC */63"No function information available for symbol", /* ECTF_NOFUNCDAT */64"Symbol table entry is not a data object", /* ECTF_NOTDATA */65"No type information available for symbol", /* ECTF_NOTYPEDAT */66"No label information available for that name", /* ECTF_NOLABEL */67"File does not contain any labels", /* ECTF_NOLABELDATA */68"Feature not supported", /* ECTF_NOTSUP */69"Invalid enum element name", /* ECTF_NOENUMNAM */70"Invalid member name", /* ECTF_NOMEMBNAM */71"CTF container is read-only", /* ECTF_RDONLY */72"Limit on number of dynamic type members reached", /* ECTF_DTFULL */73"Limit on number of dynamic types reached", /* ECTF_FULL */74"Duplicate member name definition", /* ECTF_DUPMEMBER */75"Conflicting type is already defined", /* ECTF_CONFLICT */76"Type has outstanding references", /* ECTF_REFERENCED */77"Type is not a dynamic type" /* ECTF_NOTDYN */78};7980static const int _ctf_nerr = sizeof (_ctf_errlist) / sizeof (_ctf_errlist[0]);8182const char *83ctf_errmsg(int error)84{85const char *str;8687if (error >= ECTF_BASE && (error - ECTF_BASE) < _ctf_nerr)88str = _ctf_errlist[error - ECTF_BASE];89else90str = ctf_strerror(error);9192return (str ? str : "Unknown error");93}9495int96ctf_errno(ctf_file_t *fp)97{98return (fp->ctf_errno);99}100101102