1*5ac3bc71Schristos.\" $NetBSD: gelf_getdyn.3,v 1.6 2024/03/03 17:37:34 christos Exp $ 2e81373b4Schristos.\" 39dd9d0cfSchristos.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. 49dd9d0cfSchristos.\" 59dd9d0cfSchristos.\" Redistribution and use in source and binary forms, with or without 69dd9d0cfSchristos.\" modification, are permitted provided that the following conditions 79dd9d0cfSchristos.\" are met: 89dd9d0cfSchristos.\" 1. Redistributions of source code must retain the above copyright 99dd9d0cfSchristos.\" notice, this list of conditions and the following disclaimer. 109dd9d0cfSchristos.\" 2. Redistributions in binary form must reproduce the above copyright 119dd9d0cfSchristos.\" notice, this list of conditions and the following disclaimer in the 129dd9d0cfSchristos.\" documentation and/or other materials provided with the distribution. 139dd9d0cfSchristos.\" 149dd9d0cfSchristos.\" This software is provided by Joseph Koshy ``as is'' and 159dd9d0cfSchristos.\" any express or implied warranties, including, but not limited to, the 169dd9d0cfSchristos.\" implied warranties of merchantability and fitness for a particular purpose 179dd9d0cfSchristos.\" are disclaimed. in no event shall Joseph Koshy be liable 189dd9d0cfSchristos.\" for any direct, indirect, incidental, special, exemplary, or consequential 199dd9d0cfSchristos.\" damages (including, but not limited to, procurement of substitute goods 209dd9d0cfSchristos.\" or services; loss of use, data, or profits; or business interruption) 219dd9d0cfSchristos.\" however caused and on any theory of liability, whether in contract, strict 229dd9d0cfSchristos.\" liability, or tort (including negligence or otherwise) arising in any way 239dd9d0cfSchristos.\" out of the use of this software, even if advised of the possibility of 249dd9d0cfSchristos.\" such damage. 259dd9d0cfSchristos.\" 263f622274Sjkoshy.\" Id: gelf_getdyn.3 3958 2022-03-12 14:31:32Z jkoshy 279dd9d0cfSchristos.\" 28c5261b83Sjkoshy.Dd April 22, 2019 299dd9d0cfSchristos.Dt GELF_GETDYN 3 30c5261b83Sjkoshy.Os 319dd9d0cfSchristos.Sh NAME 329dd9d0cfSchristos.Nm gelf_getdyn , 339dd9d0cfSchristos.Nm gelf_update_dyn 349dd9d0cfSchristos.Nd read and update ELF dynamic entries 359dd9d0cfSchristos.Sh LIBRARY 369dd9d0cfSchristos.Lb libelf 379dd9d0cfSchristos.Sh SYNOPSIS 389dd9d0cfSchristos.In gelf.h 399dd9d0cfSchristos.Ft "GElf_Dyn *" 409dd9d0cfSchristos.Fn gelf_getdyn "Elf_Data *data" "int ndx" "GElf_Dyn *dyn" 419dd9d0cfSchristos.Ft int 429dd9d0cfSchristos.Fn gelf_update_dyn "Elf_Data *data" "int ndx" "GElf_Dyn *dyn" 439dd9d0cfSchristos.Sh DESCRIPTION 449dd9d0cfSchristosThese convenience functions are used to retrieve and update class-dependent 459dd9d0cfSchristos.Vt Elf32_Dyn 469dd9d0cfSchristosor 479dd9d0cfSchristos.Vt Elf64_Dyn 489dd9d0cfSchristosinformation in the 499dd9d0cfSchristos.Sy dynamic 509dd9d0cfSchristostable of an ELF object. 519dd9d0cfSchristos.Pp 529dd9d0cfSchristosArgument 533f622274Sjkoshy.Fa data 549dd9d0cfSchristosis an 559dd9d0cfSchristos.Vt Elf_Data 569dd9d0cfSchristosdescriptor associated with a section of type 579dd9d0cfSchristos.Dv SHT_DYNAMIC . 589dd9d0cfSchristosArgument 593f622274Sjkoshy.Fa ndx 609dd9d0cfSchristosis the index of the entry being retrieved or updated. 619dd9d0cfSchristosThe class-independent 629dd9d0cfSchristos.Vt GElf_Dyn 639dd9d0cfSchristosstructure is described in 649dd9d0cfSchristos.Xr gelf 3 . 659dd9d0cfSchristos.Pp 669dd9d0cfSchristosFunction 679dd9d0cfSchristos.Fn gelf_getdyn 689dd9d0cfSchristosretrieves the class-dependent entry at index 693f622274Sjkoshy.Fa ndx 709dd9d0cfSchristosin data buffer 713f622274Sjkoshy.Fa data 729dd9d0cfSchristosand copies it to the destination pointed to by argument 733f622274Sjkoshy.Fa dyn 749dd9d0cfSchristosafter translation to class-independent form. 759dd9d0cfSchristos.Pp 769dd9d0cfSchristosFunction 779dd9d0cfSchristos.Fn gelf_update_dyn 789dd9d0cfSchristosconverts the class-independent entry pointed to 799dd9d0cfSchristosby argument 803f622274Sjkoshy.Fa dyn 819dd9d0cfSchristosto class-dependent form, and writes it to the entry at index 823f622274Sjkoshy.Fa ndx 839dd9d0cfSchristosin the data buffer described by argument 843f622274Sjkoshy.Fa data . 859dd9d0cfSchristosFunction 869dd9d0cfSchristos.Fn gelf_update_dyn 879dd9d0cfSchristossignals an error if any of the values in the class-independent 889dd9d0cfSchristosrepresentation exceeds the representable limits of the target 899dd9d0cfSchristostype. 909dd9d0cfSchristos.Sh RETURN VALUES 919dd9d0cfSchristosFunction 929dd9d0cfSchristos.Fn gelf_getdyn 939dd9d0cfSchristosreturns the value of argument 943f622274Sjkoshy.Fa dyn 95c5261b83Sjkoshyif successful, or 96c5261b83Sjkoshy.Dv NULL 97c5261b83Sjkoshyin case of an error. 989dd9d0cfSchristosFunction 999dd9d0cfSchristos.Fn gelf_update_dyn 1009dd9d0cfSchristosreturns a non-zero value if successful, or zero in case of an error. 1019dd9d0cfSchristos.Sh ERRORS 1029dd9d0cfSchristosThese functions may fail with the following errors: 1039dd9d0cfSchristos.Bl -tag -width "[ELF_E_RESOURCE]" 1049dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT 1059dd9d0cfSchristosArguments 1063f622274Sjkoshy.Fa data 1079dd9d0cfSchristosor 1083f622274Sjkoshy.Fa dyn 109c5261b83Sjkoshywere 110c5261b83Sjkoshy.Dv NULL . 1119dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT 1129dd9d0cfSchristosArgument 1133f622274Sjkoshy.Fa ndx 1149dd9d0cfSchristoswas less than zero or larger than the number of entries in the data 1159dd9d0cfSchristosdescriptor. 1169dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT 1179dd9d0cfSchristosData descriptor 1183f622274Sjkoshy.Fa data 1199dd9d0cfSchristoswas not associated with a section of type 1209dd9d0cfSchristos.Dv SHT_DYNAMIC . 1219dd9d0cfSchristos.It Bq Er ELF_E_RANGE 1229dd9d0cfSchristosA value was not representable in the target type. 123c5261b83Sjkoshy.It Bq Er ELF_E_VERSION 124c5261b83SjkoshyThe 125c5261b83Sjkoshy.Vt Elf_Data 126c5261b83Sjkoshydescriptor denoted by argument 1273f622274Sjkoshy.Fa data 128c5261b83Sjkoshyis associated with an ELF object with an unsupported version. 129c5261b83Sjkoshy.El 1309dd9d0cfSchristos.El 1319dd9d0cfSchristos.Sh SEE ALSO 1329dd9d0cfSchristos.Xr elf 3 , 1339dd9d0cfSchristos.Xr elf_getdata 3 , 1349dd9d0cfSchristos.Xr elf_getscn 3 , 1359dd9d0cfSchristos.Xr gelf 3 136