1 .\" Copyright (c) 2006-2008 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 allocate an ELF program header table
39 .Fn elf32_newphdr "Elf *elf" "size_t count"
41 .Fn elf64_newphdr "Elf *elf" "size_t count"
44 .Fn gelf_newphdr "Elf *elf" "size_t count"
46 These functions allocate an ELF Program Header table
47 for an ELF descriptor.
51 descriptors are described further in
63 descriptors respectively,
64 discarding any existing program header table
65 already present in the ELF descriptor
67 A value of zero for argument
69 may be used to delete an existing program header table
70 from an ELF descriptor.
74 will return a table of
80 elements depending on the ELF class of ELF descriptor
85 flag on the program header table.
86 All members of the returned array of Phdr structures
87 will be initialized to zero.
89 After a successful call to these functions, the pointer returned
94 on the same descriptor
96 will no longer be valid.
98 The functions a valid pointer if successful, or NULL in case an error
101 These functions may fail with the following errors:
102 .Bl -tag -width "[ELF_E_RESOURCE]"
103 .It Bq Er ELF_E_ARGUMENT
107 .It Bq Er ELF_E_ARGUMENT
110 was not a descriptor for an ELF object.
111 .It Bq Er ELF_E_CLASS
114 was of an unrecognized class.
115 .It Bq Er ELF_E_RESOURCE
116 An out of memory condition was detected.
117 .It Bq Er ELF_E_SEQUENCE
118 An executable header was not allocated for ELF descriptor
120 before using these APIs.
124 .Xr elf32_getphdr 3 ,
125 .Xr elf32_newehdr 3 ,
126 .Xr elf64_getphdr 3 ,
127 .Xr elf64_newehdr 3 ,