ELF Library Functions elf_cntl(3ELF)
NAME
elf_cntl - control an elf file descriptor
SYNOPSIS
cc [ flag ... ] file ... -lelf [ library ... ]
#include
int elf_cntl(Elf *elf, Elf_Cmd cmd);
DESCRIPTION
elf_cntl() instructs the library to modify its behavior with
respect to an ELF descriptor, elf. As elf_begin(3ELF)
describes, an ELF descriptor can have multiple activations, and multiple ELF descriptors may share a single filedescriptor. Generally, elf_cntl() commands apply to all
activations of elf. Moreover, if the ELF descriptor is asso-
ciated with an archive file, descriptors for members within the archive will also be affected as described below. Unless stated otherwise, operations on archive members do not affect the descriptor for the containing archive. The cmd argument tells what actions to take and may have the following values:ELF_C_FDDONE This value tells the library not to use the
file descriptor associated with elf. A pro-
gram should use this command when it has requested all the information it cares to use and wishes to avoid the overhead of reading the rest of the file. The memory for all completed operations remains valid, but later file operations, such as the initialelf_getdata() for a section, will fail if
the data are not in memory already.ELF_C_FDREAD This command is similar to ELF_C_FDDONE,
except it forces the library to read the rest of the file. A program should use thiscommand when it must close the file descrip-
tor but has not yet read everything it needsfrom the file. After elf_cntl() completes
the ELF_C_FDREAD command, future operations,
such as elf_getdata(), will use the memory
version of the file without needing to use the file descriptor.SunOS 5.11 Last change: 11 Jul 2001 1
ELF Library Functions elf_cntl(3ELF)
If elf_cntl() succeeds, it returns 0. Otherwise elf was NULL
or an error occurred, and the function returns -1.
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Interface Stability | Committed ||_____________________________|_____________________________|
| MT-Level | MT-Safe |
|_____________________________|_____________________________|
SEE ALSO
elf(3ELF), elf_begin(3ELF), elf_getdata(3ELF),
elf_rawfile(3ELF), libelf(3LIB), attributes(5)
NOTES If the program wishes to use the ``raw'' operations (seeelf_rawdata(), which elf_getdata(3ELF) describes, and
elf_rawfile(3ELF)) after disabling the file descriptor with
ELF_C_FDDONE or ELF_C_FDREAD, it must execute the raw opera-
tions explicitly beforehand. Otherwise, the raw file opera-
tions will fail. Calling elf_rawfile() makes the entire
image available, thus supporting subsequent elf_rawdata()
calls.SunOS 5.11 Last change: 11 Jul 2001 2