ELF_GETARHDR(3) BSD Library Functions Manual ELF_GETARHDR(3)NAME
elf_getarhdr -- retrieve ar(1) header for an archive member
LIBRARY
ELF Access Library (libelf, -lelf)
SYNOPSIS
#include <libelf.h>
Elf_Arhdr *
elf_getarhdr(Elf *elf);
DESCRIPTION
The elf_getarhdr() function returns a pointer to an archive member header for a descriptor elf. This descriptor must have been returned by a
prior call to elf_begin(3), and must be a descriptor for a member inside an ar(1) archive.
Structure Elf_Arhdr includes the following members:
char * ar_name
A pointer to a null terminated string containing the translated name of the archive member.
char * ar_rawname
A pointer to a null terminated string containing the untranslated name for the archive member, including all ar(1) formatting charac-
ters and trailing white space.
time_t ar_date
The timestamp associated with the member.
uid_t ar_uid
The uid of the creator of the member.
gid_t ar_gid
The gid of the creator of the member.
mode_t ar_mode
The file mode of the member.
size_t ar_size
The size of the member in bytes.
RETURN VALUES
This function returns a valid pointer to an Elf_Arhdr structure if successful, or NULL if an error is encountered.
ERRORS
Function elf_getarhdr() may fail with the following errors:
[ELF_E_ARGUMENT] Argument elf was NULL.
[ELF_E_ARGUMENT] Argument elf was not a descriptor for a member of an ar(1) archive.
SEE ALSO elf(3), elf_begin(3), elf_getarsym(3), elf_memory(3)BSD August 15, 2006 BSD
Check Out this Related Man Page
elf_getarhdr(3ELF) ELF Library Functions elf_getarhdr(3ELF)NAME
elf_getarhdr - retrieve archive member header
SYNOPSIS
cc [ flag ... ] file ... -lelf [ library... ]
#include <libelf.h>
Elf_Arhdr *elf_getarhdr(Elf *elf);
DESCRIPTION
elf_getarhdr() returns a pointer to an archive member header, if one is available for the ELF descriptor elf. Otherwise, no archive member
header exists, an error occurred, or elf was null; elf_getarhdr() then returns a null value. The header includes the following members.
char *ar_name;
time_t ar_date;
uid_t ar_uid;
gid_t ar_gid;
mode_t ar_mode;
off_t ar_size;
char *ar_rawname;
An archive member name, available through ar_name, is a null-terminated string, with the ar format control characters removed. The ar_raw-
name member holds a null-terminated string that represents the original name bytes in the file, including the terminating slash and trail-
ing blanks as specified in the archive format.
In addition to ``regular'' archive members, the archive format defines some special members. All special member names begin with a slash
(/), distinguishing them from regular members (whose names may not contain a slash). These special members have the names (ar_name) defined
below.
/ This is the archive symbol table. If present, it will be the first archive member. A program may access the archive symbol table
through elf_getarsym(). The information in the symbol table is useful for random archive processing (see elf_rand() on
elf_begin(3ELF)).
// This member, if present, holds a string table for long archive member names. An archive member's header contains a 16-byte area for
the name, which may be exceeded in some file systems. The library automatically retrieves long member names from the string table,
setting ar_name to the appropriate value.
Under some error conditions, a member's name might not be available. Although this causes the library to set ar_name to a null pointer, the
ar_rawname member will be set as usual.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Stable |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO ar.h(3HEAD), elf(3ELF), elf_begin(3ELF), elf_getarsym(3ELF), libelf(3LIB), attributes(5)SunOS 5.11 11 Jul 2001 elf_getarhdr(3ELF)