1.\" $NetBSD: gelf_getdyn.3,v 1.2 2014/03/09 16:58:04 christos Exp $ 2.\" 3.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" This software is provided by Joseph Koshy ``as is'' and 15.\" any express or implied warranties, including, but not limited to, the 16.\" implied warranties of merchantability and fitness for a particular purpose 17.\" are disclaimed. in no event shall Joseph Koshy be liable 18.\" for any direct, indirect, incidental, special, exemplary, or consequential 19.\" damages (including, but not limited to, procurement of substitute goods 20.\" or services; loss of use, data, or profits; or business interruption) 21.\" however caused and on any theory of liability, whether in contract, strict 22.\" liability, or tort (including negligence or otherwise) arising in any way 23.\" out of the use of this software, even if advised of the possibility of 24.\" such damage. 25.\" 26.\" Id: gelf_getdyn.3 189 2008-07-20 10:38:08Z jkoshy 27.\" 28.Dd August 29, 2006 29.Os 30.Dt GELF_GETDYN 3 31.Sh NAME 32.Nm gelf_getdyn , 33.Nm gelf_update_dyn 34.Nd read and update ELF dynamic entries 35.Sh LIBRARY 36.Lb libelf 37.Sh SYNOPSIS 38.In gelf.h 39.Ft "GElf_Dyn *" 40.Fn gelf_getdyn "Elf_Data *data" "int ndx" "GElf_Dyn *dyn" 41.Ft int 42.Fn gelf_update_dyn "Elf_Data *data" "int ndx" "GElf_Dyn *dyn" 43.Sh DESCRIPTION 44These convenience functions are used to retrieve and update class-dependent 45.Vt Elf32_Dyn 46or 47.Vt Elf64_Dyn 48information in the 49.Sy dynamic 50table of an ELF object. 51.Pp 52Argument 53.Ar data 54is an 55.Vt Elf_Data 56descriptor associated with a section of type 57.Dv SHT_DYNAMIC . 58Argument 59.Ar ndx 60is the index of the entry being retrieved or updated. 61The class-independent 62.Vt GElf_Dyn 63structure is described in 64.Xr gelf 3 . 65.Pp 66Function 67.Fn gelf_getdyn 68retrieves the class-dependent entry at index 69.Ar ndx 70in data buffer 71.Ar data 72and copies it to the destination pointed to by argument 73.Ar dyn 74after translation to class-independent form. 75.Pp 76Function 77.Fn gelf_update_dyn 78converts the class-independent entry pointed to 79by argument 80.Ar dyn 81to class-dependent form, and writes it to the entry at index 82.Ar ndx 83in the data buffer described by argument 84.Ar data . 85Function 86.Fn gelf_update_dyn 87signals an error if any of the values in the class-independent 88representation exceeds the representable limits of the target 89type. 90.Sh RETURN VALUES 91Function 92.Fn gelf_getdyn 93returns the value of argument 94.Ar dyn 95if successful, or NULL in case of an error. 96Function 97.Fn gelf_update_dyn 98returns a non-zero value if successful, or zero in case of an error. 99.Sh ERRORS 100These functions may fail with the following errors: 101.Bl -tag -width "[ELF_E_RESOURCE]" 102.It Bq Er ELF_E_ARGUMENT 103Arguments 104.Ar data 105or 106.Ar dyn 107were NULL. 108.It Bq Er ELF_E_ARGUMENT 109Argument 110.Ar ndx 111was less than zero or larger than the number of entries in the data 112descriptor. 113.It Bq Er ELF_E_ARGUMENT 114Data descriptor 115.Ar data 116was not associated with a section of type 117.Dv SHT_DYNAMIC . 118.It Bq Er ELF_E_RANGE 119A value was not representable in the target type. 120.El 121.Sh SEE ALSO 122.Xr elf 3 , 123.Xr elf_getdata 3 , 124.Xr elf_getscn 3 , 125.Xr gelf 3 126