1 .\" $NetBSD: gelf_newphdr.3,v 1.2 2014/03/09 16:58:04 christos Exp $
3 .\" Copyright (c) 2006-2008 Joseph Koshy. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
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.
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
26 .\" Id: gelf_newphdr.3 189 2008-07-20 10:38:08Z jkoshy
35 .Nd allocate an ELF program header table
41 .Fn elf32_newphdr "Elf *elf" "size_t count"
43 .Fn elf64_newphdr "Elf *elf" "size_t count"
46 .Fn gelf_newphdr "Elf *elf" "size_t count"
48 These functions allocate an ELF Program Header table
49 for an ELF descriptor.
53 descriptors are described further in
65 descriptors respectively,
66 discarding any existing program header table
67 already present in the ELF descriptor
69 A value of zero for argument
71 may be used to delete an existing program header table
72 from an ELF descriptor.
76 will return a table of
82 elements depending on the ELF class of ELF descriptor
87 flag on the program header table.
88 All members of the returned array of Phdr structures
89 will be initialized to zero.
91 After a successful call to these functions, the pointer returned
96 on the same descriptor
98 will no longer be valid.
100 The functions a valid pointer if successful, or NULL in case an error
103 These functions may fail with the following errors:
104 .Bl -tag -width "[ELF_E_RESOURCE]"
105 .It Bq Er ELF_E_ARGUMENT
109 .It Bq Er ELF_E_ARGUMENT
112 was not a descriptor for an ELF object.
113 .It Bq Er ELF_E_CLASS
116 was of an unrecognized class.
117 .It Bq Er ELF_E_RESOURCE
118 An out of memory condition was detected.
119 .It Bq Er ELF_E_SEQUENCE
120 An executable header was not allocated for ELF descriptor
122 before using these APIs.
126 .Xr elf32_getphdr 3 ,
127 .Xr elf32_newehdr 3 ,
128 .Xr elf64_getphdr 3 ,
129 .Xr elf64_newehdr 3 ,