1 .\" Copyright (c) 2006 Joseph Koshy. All rights reserved.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
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.
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
33 .Nd retrieve an ELF program header table
39 .Fn elf32_getphdr "Elf *elf"
41 .Fn elf64_getphdr "Elf *elf"
44 .Fn gelf_getphdr "Elf *elf" "int index" "GElf_Phdr *dst"
46 These functions retrieve and translate ELF program header information
47 from an ELF descriptor, if this information exists.
53 return a pointer to an array of translated
57 descriptors respectively.
58 These descriptors are described in
60 The number of entries in this array is specified by the
62 field of the executable header for ELF descriptor
67 will retrieve the program header table entry at index
71 The translated program header table entry will be written to the
72 address pointed to be argument
75 Applications may inform the library of modifications to a program header table entry
79 Applications using the
81 interface need to use the
82 .Xr gelf_update_phdr 3
83 API to copy modifications to a program header entry back to the underlying
86 The functions a valid pointer if successful, or NULL in case an error
89 These functions may fail with the following errors:
90 .Bl -tag -width "[ELF_E_RESOURCE]"
91 .It Bq Er ELF_E_ARGUMENT
95 .It Bq Er ELF_E_ARGUMENT
98 was not a descriptor for an ELF object.
99 .It Bq Er ELF_E_ARGUMENT
103 .It Bq Er ELF_E_ARGUMENT
107 .It Bq Er ELF_E_CLASS
108 The class of ELF descriptor
110 did not match the expected class of the function being called.
111 .It Bq Er ELF_E_HEADER
114 did not possess an executable header.
115 .It Bq Er ELF_E_HEADER
118 had a corrupt executable header.
119 .It Bq Er ELF_E_RESOURCE
120 An out of memory condition was detected.
121 .It Bq Er ELF_VERSION
124 was of an unsupported version.
128 .Xr elf32_getehdr 3 ,
129 .Xr elf32_newphdr 3 ,
130 .Xr elf64_getehdr 3 ,
131 .Xr elf64_newphdr 3 ,
136 .Xr gelf_update_phdr 3 ,