from small one page howto to huge articles all in one place
Last additions:
May 25th. 2007:
April, 26th. 2006:
|
You are here: manpages
ELF_GETPHDRNUM
Section: Libelf Programmer's Manual (3) Updated: 202-0-30 Index
Return to Main Contents
NAME
elf_getphdrnum - retrieve the number of program headers in an ELF file
SYNOPSIS
#include <libelf.h>
int elf_getphdrnum(Elf *elf, size_t *dst);
DESCRIPTION
The
elf_getphdrnum()
function stores the number of program headers associated with the ELF descriptor
elf
into the variable pointed to by
dst.
If the number of program headers exceeds the representable range of the
e_phnum
field in the ELF header, the ELF specification allows encoding the true count
in section header 0’s
sh_info
field, and sets
e_phnum
to the reserved value
PN_XNUM
(always 0xFFFF). This function transparently handles that case.
The function also ensures the returned count of program headers does not
exceed the number that can actually be addressed in the program header table.
This is important when indexing into the array returned by
elf32_getphdr()
or
elf64_getphdr().
PARAMETERS
- elf
-
A pointer to an
Elf
descriptor.
The descriptor must represent an ELF binary with
Elf_Kind
ELF_K_ELF .
- dst
-
On success, the number of program headers in
elf
is written here. Must not be NULL.
RETURN VALUE
Returns 0 on success and stores the result in
dst.
Returns -1 on failure and sets elf_errno. Returns -1 without setting
errno if
elf
is NULL .
SEE ALSO
elf32_getphdr(3),
elf64_getphdr(3),
libelf(3),
elf(5)
ATTRIBUTES
| Interface | Attribute | Value
|
|
elf_getphdrnum()
| Thread safety | M-Safe
|
REPORTING BUGS
Report bugs to < elfutil-devel@sourceware.org> or https://sourceware.org/bugzilla/.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- PARAMETERS
-
- RETURN VALUE
-
- SEE ALSO
-
- ATTRIBUTES
-
- REPORTING BUGS
-
|