Control a file descriptor
int elf_cntl(Elf * elf, Elf_Cmd cmd);
elf_cntl instructs the library to modify its behavior with respect to an ELF descriptor, elf. Just as with elf_begin, an ELF descriptor can have multiple activations, and multiple ELF descriptors may share a single file descriptor. Generally, elf_cntl commands apply to all activations of elf. Moreover, if the ELF descriptor is associated 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.
If the program wishes to use the raw operations [see the elf_rawdata and elf_rawfile subroutines] after disabling the file descriptor with ELF_C_FDDONE or ELF_C_FDREAD, it must execute the raw operations explicitly beforehand. Otherwise, the raw file operations will fail. Calling elf_rawfile makes the entire image available, thus supporting subsequent elf_rawdata calls.
|cmd||Specifies the action to take and can be set to any of the following
On successful completion, the elf_cntl subroutine returns a value of 0. Otherwise, a value of -1 is returned and the errno global value is set to indicate an error.
The elf_begin (elf_begin Subroutine) subroutine, elf_getdata (elf_getdata, elf_newdata, elf_rawdata Subroutine) subroutine, elf_rawfile (elf_rawfile Subroutine) subroutine.
Introduction to ELF Subroutines.