1*0a6a1f1dSLionel Sambuc.\" $NetBSD: gelf_getdyn.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: gelf_getdyn.3 189 2008-07-20 10:38:08Z jkoshy 27*0a6a1f1dSLionel Sambuc.\" 28*0a6a1f1dSLionel Sambuc.Dd August 29, 2006 29*0a6a1f1dSLionel Sambuc.Os 30*0a6a1f1dSLionel Sambuc.Dt GELF_GETDYN 3 31*0a6a1f1dSLionel Sambuc.Sh NAME 32*0a6a1f1dSLionel Sambuc.Nm gelf_getdyn , 33*0a6a1f1dSLionel Sambuc.Nm gelf_update_dyn 34*0a6a1f1dSLionel Sambuc.Nd read and update ELF dynamic entries 35*0a6a1f1dSLionel Sambuc.Sh LIBRARY 36*0a6a1f1dSLionel Sambuc.Lb libelf 37*0a6a1f1dSLionel Sambuc.Sh SYNOPSIS 38*0a6a1f1dSLionel Sambuc.In gelf.h 39*0a6a1f1dSLionel Sambuc.Ft "GElf_Dyn *" 40*0a6a1f1dSLionel Sambuc.Fn gelf_getdyn "Elf_Data *data" "int ndx" "GElf_Dyn *dyn" 41*0a6a1f1dSLionel Sambuc.Ft int 42*0a6a1f1dSLionel Sambuc.Fn gelf_update_dyn "Elf_Data *data" "int ndx" "GElf_Dyn *dyn" 43*0a6a1f1dSLionel Sambuc.Sh DESCRIPTION 44*0a6a1f1dSLionel SambucThese convenience functions are used to retrieve and update class-dependent 45*0a6a1f1dSLionel Sambuc.Vt Elf32_Dyn 46*0a6a1f1dSLionel Sambucor 47*0a6a1f1dSLionel Sambuc.Vt Elf64_Dyn 48*0a6a1f1dSLionel Sambucinformation in the 49*0a6a1f1dSLionel Sambuc.Sy dynamic 50*0a6a1f1dSLionel Sambuctable of an ELF object. 51*0a6a1f1dSLionel Sambuc.Pp 52*0a6a1f1dSLionel SambucArgument 53*0a6a1f1dSLionel Sambuc.Ar data 54*0a6a1f1dSLionel Sambucis an 55*0a6a1f1dSLionel Sambuc.Vt Elf_Data 56*0a6a1f1dSLionel Sambucdescriptor associated with a section of type 57*0a6a1f1dSLionel Sambuc.Dv SHT_DYNAMIC . 58*0a6a1f1dSLionel SambucArgument 59*0a6a1f1dSLionel Sambuc.Ar ndx 60*0a6a1f1dSLionel Sambucis the index of the entry being retrieved or updated. 61*0a6a1f1dSLionel SambucThe class-independent 62*0a6a1f1dSLionel Sambuc.Vt GElf_Dyn 63*0a6a1f1dSLionel Sambucstructure is described in 64*0a6a1f1dSLionel Sambuc.Xr gelf 3 . 65*0a6a1f1dSLionel Sambuc.Pp 66*0a6a1f1dSLionel SambucFunction 67*0a6a1f1dSLionel Sambuc.Fn gelf_getdyn 68*0a6a1f1dSLionel Sambucretrieves the class-dependent entry at index 69*0a6a1f1dSLionel Sambuc.Ar ndx 70*0a6a1f1dSLionel Sambucin data buffer 71*0a6a1f1dSLionel Sambuc.Ar data 72*0a6a1f1dSLionel Sambucand copies it to the destination pointed to by argument 73*0a6a1f1dSLionel Sambuc.Ar dyn 74*0a6a1f1dSLionel Sambucafter translation to class-independent form. 75*0a6a1f1dSLionel Sambuc.Pp 76*0a6a1f1dSLionel SambucFunction 77*0a6a1f1dSLionel Sambuc.Fn gelf_update_dyn 78*0a6a1f1dSLionel Sambucconverts the class-independent entry pointed to 79*0a6a1f1dSLionel Sambucby argument 80*0a6a1f1dSLionel Sambuc.Ar dyn 81*0a6a1f1dSLionel Sambucto class-dependent form, and writes it to the entry at index 82*0a6a1f1dSLionel Sambuc.Ar ndx 83*0a6a1f1dSLionel Sambucin the data buffer described by argument 84*0a6a1f1dSLionel Sambuc.Ar data . 85*0a6a1f1dSLionel SambucFunction 86*0a6a1f1dSLionel Sambuc.Fn gelf_update_dyn 87*0a6a1f1dSLionel Sambucsignals an error if any of the values in the class-independent 88*0a6a1f1dSLionel Sambucrepresentation exceeds the representable limits of the target 89*0a6a1f1dSLionel Sambuctype. 90*0a6a1f1dSLionel Sambuc.Sh RETURN VALUES 91*0a6a1f1dSLionel SambucFunction 92*0a6a1f1dSLionel Sambuc.Fn gelf_getdyn 93*0a6a1f1dSLionel Sambucreturns the value of argument 94*0a6a1f1dSLionel Sambuc.Ar dyn 95*0a6a1f1dSLionel Sambucif successful, or NULL in case of an error. 96*0a6a1f1dSLionel SambucFunction 97*0a6a1f1dSLionel Sambuc.Fn gelf_update_dyn 98*0a6a1f1dSLionel Sambucreturns a non-zero value if successful, or zero in case of an error. 99*0a6a1f1dSLionel Sambuc.Sh ERRORS 100*0a6a1f1dSLionel SambucThese functions may fail with the following errors: 101*0a6a1f1dSLionel Sambuc.Bl -tag -width "[ELF_E_RESOURCE]" 102*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT 103*0a6a1f1dSLionel SambucArguments 104*0a6a1f1dSLionel Sambuc.Ar data 105*0a6a1f1dSLionel Sambucor 106*0a6a1f1dSLionel Sambuc.Ar dyn 107*0a6a1f1dSLionel Sambucwere NULL. 108*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT 109*0a6a1f1dSLionel SambucArgument 110*0a6a1f1dSLionel Sambuc.Ar ndx 111*0a6a1f1dSLionel Sambucwas less than zero or larger than the number of entries in the data 112*0a6a1f1dSLionel Sambucdescriptor. 113*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT 114*0a6a1f1dSLionel SambucData descriptor 115*0a6a1f1dSLionel Sambuc.Ar data 116*0a6a1f1dSLionel Sambucwas not associated with a section of type 117*0a6a1f1dSLionel Sambuc.Dv SHT_DYNAMIC . 118*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_RANGE 119*0a6a1f1dSLionel SambucA value was not representable in the target type. 120*0a6a1f1dSLionel Sambuc.El 121*0a6a1f1dSLionel Sambuc.Sh SEE ALSO 122*0a6a1f1dSLionel Sambuc.Xr elf 3 , 123*0a6a1f1dSLionel Sambuc.Xr elf_getdata 3 , 124*0a6a1f1dSLionel Sambuc.Xr elf_getscn 3 , 125*0a6a1f1dSLionel Sambuc.Xr gelf 3 126