1.\" $NetBSD: gelf_update_ehdr.3,v 1.6 2024/03/03 17:37:34 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_update_ehdr.3 3958 2022-03-12 14:31:32Z jkoshy 27.\" 28.Dd August 27, 2006 29.Dt GELF_UPDATE_EHDR 3 30.Os 31.Sh NAME 32.Nm gelf_update_ehdr , 33.Nm gelf_update_phdr , 34.Nm gelf_update_shdr 35.Nd update underlying ELF data structures 36.Sh LIBRARY 37.Lb libelf 38.Sh SYNOPSIS 39.In gelf.h 40.Ft int 41.Fn gelf_update_ehdr "Elf *elf" "GElf_Ehdr *ehdr" 42.Ft int 43.Fn gelf_update_phdr "Elf *elf" "int ndx" "GElf_Phdr *phdr" 44.Ft int 45.Fn gelf_update_shdr "Elf_Scn *scn" "GElf_Shdr *shdr" 46.Sh DESCRIPTION 47These functions are used to update ELF data structures on the underlying 48ELF descriptor. 49Class-dependent data structures in the underlying ELF descriptor 50are updated using the data in the class-independent GElf descriptors 51and the underlying ELF data structures are marked 52.Dq dirty . 53The conversion process signals an error if the values being copied 54to the target ELF data structure would exceed representation 55limits. 56GElf descriptors are described in 57.Xr gelf 3 . 58.Pp 59Function 60.Fn gelf_update_ehdr 61updates the ELF Executable Header with the values in the 62class-independent executable header 63.Fa ehdr . 64.Pp 65Function 66.Fn gelf_update_phdr 67updates the ELF Program Header structure at index 68.Fa ndx 69with the values in the class-independent program header 70.Fa phdr . 71.Pp 72Function 73.Fn gelf_update_shdr 74updates the ELF Section Header structure associated with section 75descriptor 76.Fa scn 77with the values in argument 78.Fa shdr . 79.Sh RETURN VALUES 80These functions return a non-zero integer on success, or zero in case 81of an error. 82.Sh ERRORS 83These functions may fail with the following errors: 84.Bl -tag -width "[ELF_E_RESOURCE]" 85.It Bq Er ELF_E_ARGUMENT 86Arguments 87.Fa elf , 88.Fa ehdr , 89.Fa phdr , 90.Fa scn , 91or 92.Fa shdr 93were 94.Dv NULL . 95.It Bq Er ELF_E_ARGUMENT 96Argument 97.Fa elf 98was not a descriptor for an ELF object. 99.It Bq Er ELF_E_ARGUMENT 100Argument 101.Fa elf 102had an unsupported ELF class. 103.It Bq Er ELF_E_ARGUMENT 104Argument 105.Fa ndx 106exceeded the number of entries in the program header table. 107.It Bq Er ELF_E_ARGUMENT 108Section descriptor 109.Fa scn 110was not associated with an ELF descriptor. 111.It Bq Er ELF_E_MODE 112ELF descriptor 113.Fa elf 114was not opened for writing or updating. 115.It Bq Er ELF_E_RESOURCE 116An out of memory condition was detected. 117.El 118.Sh SEE ALSO 119.Xr elf 3 , 120.Xr elf_flagelf 3 , 121.Xr elf_flagphdr 3 , 122.Xr elf_flagshdr 3 , 123.Xr gelf 3 , 124.Xr gelf_getehdr 3 , 125.Xr gelf_getphdr 3 , 126.Xr gelf_getshdr 3 127