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_GETIDENT
Section: Libelf Programmer's Manual (3) Updated: 202-0-30 Index
Return to Main Contents
NAME
elf_getident - return the ELF identification bytes
SYNOPSIS
#include <libelf.h>
char * elf_getident(Elf *elf, size_t *nbytes);
DESCRIPTION
The
elf_getident()
function returns a pointer to the 1-byte ELF identification array
from the ELF header of the given descriptor
elf.
This identification data begins with the magic number `177ELF`
and includes the class, data encoding, ELF version, OS ABI, and ABI
version fields. It corresponds to the first
EI_NIDENT
bytes of the ELF header and can be accessed via the
e_ident
field of either
Elf32_Ehdr
or
Elf64_Ehdr .
If
elf
is a valid descriptor for an ELF object, the function returns a pointer to
the internal buffer containing the header's identification bytes. The buffer
is owned by the library and must not be modified or freed by the caller.
If
nbytes
is not NULL, the function sets
to
EI_NIDENT
(16), the length in bytes of the returned identifier.
PARAMETERS
- elf
-
Pointer to an
Elf
descriptor referring to a valid ELF object. If the descriptor does not
represent an ELF object file (is NULL or
elf_kind()
is not
ELF_K_ELF
), NULL is returned.
- nbytes
-
Optional pointer to a
size_t
variable. If no-NULL, it will be set to the length of the returned buffer
(always EI_NIDENT on success, 0 on failure).
RETURN VALUE
Returns a pointer to the internal 1-byte
e_ident
buffer on success and NULL on failure. Does not set elf_errno.
This buffer is indexed using the
EI_CLASS,
EI_DATA,
EI_VERSION,
EI_OSABI,
and
EI_ABIVERSION
macros found in elf.h. Also see
elf(5).
SEE ALSO
libelf(3),
elf(5)
ATTRIBUTES
| Interface | Attribute | Value
|
|
elf_getident()
| 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
-
|