1*0a6a1f1dSLionel Sambuc.\" $NetBSD: elf_strptr.3,v 1.2 2014/03/09 16:58:04 christos Exp $ 2*0a6a1f1dSLionel Sambuc.\" 3*0a6a1f1dSLionel Sambuc.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. 4*0a6a1f1dSLionel Sambuc.\" 5*0a6a1f1dSLionel Sambuc.\" Redistribution and use in source and binary forms, with or without 6*0a6a1f1dSLionel Sambuc.\" modification, are permitted provided that the following conditions 7*0a6a1f1dSLionel Sambuc.\" are met: 8*0a6a1f1dSLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright 9*0a6a1f1dSLionel Sambuc.\" notice, this list of conditions and the following disclaimer. 10*0a6a1f1dSLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright 11*0a6a1f1dSLionel Sambuc.\" notice, this list of conditions and the following disclaimer in the 12*0a6a1f1dSLionel Sambuc.\" documentation and/or other materials provided with the distribution. 13*0a6a1f1dSLionel Sambuc.\" 14*0a6a1f1dSLionel Sambuc.\" This software is provided by Joseph Koshy ``as is'' and 15*0a6a1f1dSLionel Sambuc.\" any express or implied warranties, including, but not limited to, the 16*0a6a1f1dSLionel Sambuc.\" implied warranties of merchantability and fitness for a particular purpose 17*0a6a1f1dSLionel Sambuc.\" are disclaimed. in no event shall Joseph Koshy be liable 18*0a6a1f1dSLionel Sambuc.\" for any direct, indirect, incidental, special, exemplary, or consequential 19*0a6a1f1dSLionel Sambuc.\" damages (including, but not limited to, procurement of substitute goods 20*0a6a1f1dSLionel Sambuc.\" or services; loss of use, data, or profits; or business interruption) 21*0a6a1f1dSLionel Sambuc.\" however caused and on any theory of liability, whether in contract, strict 22*0a6a1f1dSLionel Sambuc.\" liability, or tort (including negligence or otherwise) arising in any way 23*0a6a1f1dSLionel Sambuc.\" out of the use of this software, even if advised of the possibility of 24*0a6a1f1dSLionel Sambuc.\" such damage. 25*0a6a1f1dSLionel Sambuc.\" 26*0a6a1f1dSLionel Sambuc.\" Id: elf_strptr.3 1081 2010-08-14 02:23:48Z jkoshy 27*0a6a1f1dSLionel Sambuc.\" 28*0a6a1f1dSLionel Sambuc.Dd December 16, 2006 29*0a6a1f1dSLionel Sambuc.Os 30*0a6a1f1dSLionel Sambuc.Dt ELF_STRPTR 3 31*0a6a1f1dSLionel Sambuc.Sh NAME 32*0a6a1f1dSLionel Sambuc.Nm elf_strptr 33*0a6a1f1dSLionel Sambuc.Nd retrieve a string pointer in a string table 34*0a6a1f1dSLionel Sambuc.Sh LIBRARY 35*0a6a1f1dSLionel Sambuc.Lb libelf 36*0a6a1f1dSLionel Sambuc.Sh SYNOPSIS 37*0a6a1f1dSLionel Sambuc.In libelf.h 38*0a6a1f1dSLionel Sambuc.Ft "char *" 39*0a6a1f1dSLionel Sambuc.Fn elf_strptr "Elf *elf" "size_t scndx" "size_t stroffset" 40*0a6a1f1dSLionel Sambuc.Sh DESCRIPTION 41*0a6a1f1dSLionel SambucFunction 42*0a6a1f1dSLionel Sambuc.Fn elf_strptr 43*0a6a1f1dSLionel Sambucallows an application to convert a string table offset to a string 44*0a6a1f1dSLionel Sambucpointer, correctly translating the offset in the presence 45*0a6a1f1dSLionel Sambucof multiple 46*0a6a1f1dSLionel Sambuc.Vt Elf_Data 47*0a6a1f1dSLionel Sambucdescriptors covering the contents of the section. 48*0a6a1f1dSLionel Sambuc.Pp 49*0a6a1f1dSLionel SambucArgument 50*0a6a1f1dSLionel Sambuc.Ar elf 51*0a6a1f1dSLionel Sambucis a descriptor for an ELF object. 52*0a6a1f1dSLionel SambucArgument 53*0a6a1f1dSLionel Sambuc.Ar scndx 54*0a6a1f1dSLionel Sambucis the section index for an ELF string table. 55*0a6a1f1dSLionel SambucArgument 56*0a6a1f1dSLionel Sambuc.Ar stroffset 57*0a6a1f1dSLionel Sambucis the index of the desired string in the string 58*0a6a1f1dSLionel Sambuctable. 59*0a6a1f1dSLionel Sambuc.Sh RETURN VALUES 60*0a6a1f1dSLionel SambucFunction 61*0a6a1f1dSLionel Sambuc.Fn elf_strptr 62*0a6a1f1dSLionel Sambucreturns a valid pointer on success or NULL in case an error was 63*0a6a1f1dSLionel Sambucencountered. 64*0a6a1f1dSLionel Sambuc.Sh ERRORS 65*0a6a1f1dSLionel Sambuc.Bl -tag -width "[ELF_E_RESOURCE]" 66*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT 67*0a6a1f1dSLionel SambucArgument 68*0a6a1f1dSLionel Sambuc.Ar elf 69*0a6a1f1dSLionel Sambucwas NULL 70*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT 71*0a6a1f1dSLionel SambucArgument 72*0a6a1f1dSLionel Sambuc.Ar elf 73*0a6a1f1dSLionel Sambucwas not a descriptor for an ELF object. 74*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT 75*0a6a1f1dSLionel SambucArgument 76*0a6a1f1dSLionel Sambuc.Ar scndx 77*0a6a1f1dSLionel Sambucwas not the section index for a string table. 78*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT 79*0a6a1f1dSLionel SambucArgument 80*0a6a1f1dSLionel Sambuc.Ar stroffset 81*0a6a1f1dSLionel Sambucexceeded the size of the string table. 82*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT 83*0a6a1f1dSLionel SambucArgument 84*0a6a1f1dSLionel Sambuc.Ar stroffset 85*0a6a1f1dSLionel Sambucindex an unallocated region of the string table. 86*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_DATA 87*0a6a1f1dSLionel SambucOffset 88*0a6a1f1dSLionel Sambuc.Ar stroffset 89*0a6a1f1dSLionel Sambucindexed a region that was not covered by any Elf_Data 90*0a6a1f1dSLionel Sambucdescriptor. 91*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_DATA 92*0a6a1f1dSLionel SambucAn erroneous 93*0a6a1f1dSLionel Sambuc.Vt Elf_Data 94*0a6a1f1dSLionel Sambucdescriptor was part of the section specified by argument 95*0a6a1f1dSLionel Sambuc.Ar scndx . 96*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_HEADER 97*0a6a1f1dSLionel SambucELF descriptor 98*0a6a1f1dSLionel Sambuc.Ar elf 99*0a6a1f1dSLionel Sambuccontained an invalid section header. 100*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_RESOURCE 101*0a6a1f1dSLionel SambucAn out of memory condition was detected. 102*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_SECTION 103*0a6a1f1dSLionel SambucSection 104*0a6a1f1dSLionel Sambuc.Ar scndx 105*0a6a1f1dSLionel Sambuccontained a malformed section header. 106*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_SECTION 107*0a6a1f1dSLionel SambucThe ELF descriptor in argument 108*0a6a1f1dSLionel Sambuc.Ar elf 109*0a6a1f1dSLionel Sambucdid not adhere to the conventions used for extended numbering. 110*0a6a1f1dSLionel Sambuc.El 111*0a6a1f1dSLionel Sambuc.Sh SEE ALSO 112*0a6a1f1dSLionel Sambuc.Xr elf 3 , 113*0a6a1f1dSLionel Sambuc.Xr elf32_getshdr 3 , 114*0a6a1f1dSLionel Sambuc.Xr elf64_getshdr 3 , 115*0a6a1f1dSLionel Sambuc.Xr elf_getdata 3 , 116*0a6a1f1dSLionel Sambuc.Xr elf_rawdata 3 , 117*0a6a1f1dSLionel Sambuc.Xr gelf 3 , 118*0a6a1f1dSLionel Sambuc.Xr gelf_getshdr 3 119