Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ elf_getphdr(3E) — Dell System V Release 4 Issue 2.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

elf(3E)



elf_getphdr(3E)           UNIX System V(ELF Library)            elf_getphdr(3E)


NAME
      elfgetphdr: elf32getphdr, elf32newphdr - retrieve class-dependent
      program header table

SYNOPSIS
      cc [flag ...] file ...  -lelf [library ...]

      #include <libelf.h>
      Elf32Phdr *elf32getphdr(Elf *elf);
      Elf32Phdr *elf32newphdr(Elf *elf, sizet count);

DESCRIPTION
      For a 32-bit class file, elf32getphdr returns a pointer to the program
      execution header table, if one is available for the ELF descriptor elf.

      elf32newphdr allocates a new table with count entries, regardless of
      whether one existed previously, and sets the ELFFDIRTY bit for the
      table [see elfflag(3E)].  Specifying a zero count deletes an existing
      table.  Note this behavior differs from that of elf32newehdr [see
      elf32getehdr(3E)], allowing a program to replace or delete the program
      header table, changing its size if necessary.

      If no program header table exists, the file is not a 32-bit class file,
      an error occurs, or elf is null, both functions return a null pointer.
      Additionally, elf32newphdr returns a null pointer if count is zero.

      The table is an array of Elf32Phdr structures, each of which includes
      the following members.

                   Elf32Word      ptype;
                   Elf32Off       poffset;
                   Elf32Addr      pvaddr;
                   Elf32Addr      ppaddr;
                   Elf32Word      pfilesz;
                   Elf32Word      pmemsz;
                   Elf32Word      pflags;
                   Elf32Word      palign;

      The ELF header's ephnum member tells how many entries the program header
      table has [see elfgetehdr(3E)].  A program may inspect this value to
      determine the size of an existing table; elf32newphdr automatically sets
      the member's value to count.  If the program is building a new file, it
      is responsible for creating the file's ELF header before creating the
      program header table.

SEE ALSO
      elf(3E), elfbegin(3E), elfflag(3E), elfgetehdr(3E).







10/89                                                                    Page 1





Typewritten Software • bear@typewritten.org • Edmonds, WA 98026