]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - lib/libelf/gelf_update_ehdr.3
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / lib / libelf / gelf_update_ehdr.3
1 .\" Copyright (c) 2006 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 .\" $FreeBSD$
25 .\"
26 .Dd August 27, 2006
27 .Dt GELF_UPDATE_EHDR 3
28 .Os
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
45 These functions are used to update ELF data structures on the underlying
46 ELF descriptor.
47 Class-dependent data structures in the underlying ELF descriptor
48 are updated using the data in the class-independent GElf descriptors
49 and the underlying ELF data structures are marked
50 .Dq dirty .
51 The conversion process signals an error if the values being copied
52 to the target ELF data structure would exceed representation
53 limits.
54 GElf descriptors are described in
55 .Xr gelf 3 .
56 .Pp
57 Function
58 .Fn gelf_update_ehdr
59 updates the ELF Executable Header with the values in the
60 class-independent executable header
61 .Ar ehdr .
62 .Pp
63 Function
64 .Fn gelf_update_phdr
65 updates the ELF Program Header structure at index
66 .Ar ndx
67 with the values in the class-independent program header
68 .Ar phdr .
69 .Pp
70 Function
71 .Fn gelf_update_shdr
72 updates the ELF Section Header structure associated with section
73 descriptor
74 .Ar scn
75 with the values in argument
76 .Ar shdr .
77 .Sh RETURN VALUES
78 These functions return a non-zero integer on success, or zero in case
79 of an error.
80 .Sh ERRORS
81 These functions may fail with the following errors:
82 .Bl -tag -width "[ELF_E_RESOURCE]"
83 .It Bq Er ELF_E_ARGUMENT
84 Arguments
85 .Ar elf ,
86 .Ar ehdr ,
87 .Ar phdr ,
88 .Ar scn ,
89 or
90 .Ar shdr
91 were NULL.
92 .It Bq Er ELF_E_ARGUMENT
93 Argument
94 .Ar elf
95 was not a descriptor for an ELF object.
96 .It Bq Er ELF_E_ARGUMENT
97 Argument
98 .Ar elf
99 had an unsupported ELF class.
100 .It Bq Er ELF_E_ARGUMENT
101 Argument
102 .Ar ndx
103 exceeded the number of entries in the program header table.
104 .It Bq Er ELF_E_ARGUMENT
105 Section descriptor
106 .Ar scn
107 was not associated with an ELF descriptor.
108 .It Bq Er ELF_E_MODE
109 ELF descriptor
110 .Ar elf
111 was not opened for writing or updating.
112 .It Bq Er ELF_E_RESOURCE
113 An 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