1.\" $NetBSD: gelf_update_ehdr.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_update_ehdr.3 189 2008-07-20 10:38:08Z jkoshy 27.\" 28.Dd August 27, 2006 29.Os 30.Dt GELF_UPDATE_EHDR 3 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.Ar ehdr . 64.Pp 65Function 66.Fn gelf_update_phdr 67updates the ELF Program Header structure at index 68.Ar ndx 69with the values in the class-independent program header 70.Ar phdr . 71.Pp 72Function 73.Fn gelf_update_shdr 74updates the ELF Section Header structure associated with section 75descriptor 76.Ar scn 77with the values in argument 78.Ar 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.Ar elf , 88.Ar ehdr , 89.Ar phdr , 90.Ar scn , 91or 92.Ar shdr 93were NULL. 94.It Bq Er ELF_E_ARGUMENT 95Argument 96.Ar elf 97was not a descriptor for an ELF object. 98.It Bq Er ELF_E_ARGUMENT 99Argument 100.Ar elf 101had an unsupported ELF class. 102.It Bq Er ELF_E_ARGUMENT 103Argument 104.Ar ndx 105exceeded the number of entries in the program header table. 106.It Bq Er ELF_E_ARGUMENT 107Section descriptor 108.Ar scn 109was not associated with an ELF descriptor. 110.It Bq Er ELF_E_MODE 111ELF descriptor 112.Ar elf 113was not opened for writing or updating. 114.It Bq Er ELF_E_RESOURCE 115An out of memory condition was detected. 116.El 117.Sh SEE ALSO 118.Xr elf 3 , 119.Xr elf_flagelf 3 , 120.Xr elf_flagphdr 3 , 121.Xr elf_flagshdr 3 , 122.Xr gelf 3 , 123.Xr gelf_getehdr 3 , 124.Xr gelf_getphdr 3 , 125.Xr gelf_getshdr 3 126