jcs's openbsd hax
openbsd
1.\" Copyright (c) 2006,2008 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.\" $Id: elf_getphnum.3,v 1.2 2025/06/10 17:19:45 schwarze Exp $
25.\"
26.Dd August 5, 2009
27.Dt ELF_GETPHNUM 3
28.Os
29.Sh NAME
30.Nm elf_getphnum
31.Nd return the number of program headers in an ELF file
32.Sh SYNOPSIS
33.Lb libelf
34.In libelf.h
35.Ft int
36.Fn elf_getphnum "Elf *elf" "size_t *phnum"
37.Sh DESCRIPTION
38This function is deprecated.
39Please use function
40.Xr elf_getphdrnum 3
41instead.
42.Pp
43Function
44.Fn elf_getphnum
45retrieves the number of ELF program headers associated with descriptor
46.Ar elf
47and stores it into the location pointed to by argument
48.Ar phnum .
49.Pp
50This routine allows applications to uniformly process both normal ELF
51objects and ELF objects that use extended numbering.
52.Sh RETURN VALUES
53Function
54.Fn elf_getphnum
55returns a non-zero value if successful, or zero in case of an
56error.
57.Sh ERRORS
58Function
59.Fn elf_getphnum
60can fail with the following errors:
61.Bl -tag -width "[ELF_E_RESOURCE]"
62.It Bq Er ELF_E_ARGUMENT
63A NULL value was passed in for argument
64.Ar elf .
65.It Bq Er ELF_E_ARGUMENT
66Argument
67.Ar elf
68was not for an ELF file.
69.It Bq Er ELF_E_ARGUMENT
70Argument
71.Ar elf
72lacks an ELF Executable Header.
73.It Bq Er ELF_E_HEADER
74The ELF Executable Header associated with argument
75.Ar elf
76was corrupt.
77.It Bq Er ELF_E_SECTION
78The section header at index
79.Dv SHN_UNDEF
80was corrupt.
81.El
82.Sh SEE ALSO
83.Xr elf 3 ,
84.Xr elf32_getehdr 3 ,
85.Xr elf64_getehdr 3 ,
86.Xr elf_getident 3 ,
87.Xr elf_getphdrnum 3 ,
88.Xr elf_getshdrnum 3 ,
89.Xr elf_getshdrstrndx 3 ,
90.Xr gelf 3 ,
91.Xr gelf_getehdr 3