[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


elf_getarhdr Subroutine

Purpose

Retrieve archive member header

Library

cc [flag...] file... -lelf [library]...
#include <libelf.h>

Syntax


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;
        long            ar_uid;
        long            ar_gid;
        unsigned long   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_rawname member holds a null-terminated string that represents the original name bytes in the file, including the terminating slash and trailing 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.

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.

Related Information

The ar file format.

The elf_begin (elf_begin Subroutine) subroutine, elf_getarsym (elf_getarsym Subroutine) subroutine, elf_rand (elf_rand Subroutine) subroutine.

Introduction to ELF Subroutines.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]