1.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. 2.\" 3.\" Redistribution and use in source and binary forms, with or without 4.\" modification, are permitted provided that the following conditions 5.\" are met: 6.\" 1. Redistributions of source code must retain the above copyright 7.\" notice, this list of conditions and the following disclaimer. 8.\" 2. Redistributions in binary form must reproduce the above copyright 9.\" notice, this list of conditions and the following disclaimer in the 10.\" documentation and/or other materials provided with the distribution. 11.\" 12.\" This software is provided by Joseph Koshy ``as is'' and 13.\" any express or implied warranties, including, but not limited to, the 14.\" implied warranties of merchantability and fitness for a particular purpose 15.\" are disclaimed. in no event shall Joseph Koshy be liable 16.\" for any direct, indirect, incidental, special, exemplary, or consequential 17.\" damages (including, but not limited to, procurement of substitute goods 18.\" or services; loss of use, data, or profits; or business interruption) 19.\" however caused and on any theory of liability, whether in contract, strict 20.\" liability, or tort (including negligence or otherwise) arising in any way 21.\" out of the use of this software, even if advised of the possibility of 22.\" such damage. 23.\" 24.\" $Id: gelf_update_ehdr.3 189 2008-07-20 10:38:08Z jkoshy $ 25.\" 26.Dd August 27, 2006 27.Os 28.Dt GELF_UPDATE_EHDR 3 29.Sh NAME 30.Nm gelf_update_ehdr , 31.Nm gelf_update_phdr , 32.Nm gelf_update_shdr 33.Nd update underlying ELF data structures 34.Sh LIBRARY 35.Lb libelf 36.Sh SYNOPSIS 37.In gelf.h 38.Ft int 39.Fn gelf_update_ehdr "Elf *elf" "GElf_Ehdr *ehdr" 40.Ft int 41.Fn gelf_update_phdr "Elf *elf" "int ndx" "GElf_Phdr *phdr" 42.Ft int 43.Fn gelf_update_shdr "Elf_Scn *scn" "GElf_Shdr *shdr" 44.Sh DESCRIPTION 45These functions are used to update ELF data structures on the underlying 46ELF descriptor. 47Class-dependent data structures in the underlying ELF descriptor 48are updated using the data in the class-independent GElf descriptors 49and the underlying ELF data structures are marked 50.Dq dirty . 51The conversion process signals an error if the values being copied 52to the target ELF data structure would exceed representation 53limits. 54GElf descriptors are described in 55.Xr gelf 3 . 56.Pp 57Function 58.Fn gelf_update_ehdr 59updates the ELF Executable Header with the values in the 60class-independent executable header 61.Ar ehdr . 62.Pp 63Function 64.Fn gelf_update_phdr 65updates the ELF Program Header structure at index 66.Ar ndx 67with the values in the class-independent program header 68.Ar phdr . 69.Pp 70Function 71.Fn gelf_update_shdr 72updates the ELF Section Header structure associated with section 73descriptor 74.Ar scn 75with the values in argument 76.Ar shdr . 77.Sh RETURN VALUES 78These functions return a non-zero integer on success, or zero in case 79of an error. 80.Sh ERRORS 81These functions may fail with the following errors: 82.Bl -tag -width "[ELF_E_RESOURCE]" 83.It Bq Er ELF_E_ARGUMENT 84Arguments 85.Ar elf , 86.Ar ehdr , 87.Ar phdr , 88.Ar scn , 89or 90.Ar shdr 91were NULL. 92.It Bq Er ELF_E_ARGUMENT 93Argument 94.Ar elf 95was not a descriptor for an ELF object. 96.It Bq Er ELF_E_ARGUMENT 97Argument 98.Ar elf 99had an unsupported ELF class. 100.It Bq Er ELF_E_ARGUMENT 101Argument 102.Ar ndx 103exceeded the number of entries in the program header table. 104.It Bq Er ELF_E_ARGUMENT 105Section descriptor 106.Ar scn 107was not associated with an ELF descriptor. 108.It Bq Er ELF_E_MODE 109ELF descriptor 110.Ar elf 111was not opened for writing or updating. 112.It Bq Er ELF_E_RESOURCE 113An out of memory condition was detected. 114.El 115.Sh SEE ALSO 116.Xr elf 3 , 117.Xr elf_flagelf 3 , 118.Xr elf_flagphdr 3 , 119.Xr elf_flagshdr 3 , 120.Xr gelf 3 , 121.Xr gelf_getehdr 3 , 122.Xr gelf_getphdr 3 , 123.Xr gelf_getshdr 3 124