|
The elf_rawfile() function returns a pointer to an uninterpreted byte image of the file. This function should be used only to retrieve a
file being read. For example, a program might use elf_rawfile() to retrieve the bytes for an archive member.
A program may not close or disable (see elf_cntl(3ELF)) the file descriptor associated with elf before the initial call to elf_rawfile() , because elf_rawfile() might have to read the data from the file if it does not already have the original bytes in memory. Generally, this function is more efficient for unknown file types than for object files. The library implicitly translates object files in memory, while
it leaves unknown files unmodified. Thus, asking for the uninterpreted image of an object file may create a duplicate copy in memory.
elf_rawdata() is a related function, providing access to sections within a file. See elf_getdata(3ELF).
If ptr is non-null, the library also stores the file's size, in bytes, in the location to which ptr points. If no data are present, elf is null, or an error occurs, the return value is a null pointer, with 0 stored through ptr, if ptr is non-null.
|