

Normally, the library assumes the file descriptor remains usable for the life of the ELFĭescriptor. When processing a file, the library decides when to read or write the file, depending on the program's requests.
#Elf memory master archive
A program may mix random and sequential archive processing. Or the file was not an archive (no archive member can have a zero offset). See elf_getarsym(3ELF)įor more information about archive member offsets. Gives the byte offset from the beginning of the archive to the archive header of the desired member. elfįor the archive itself, not a member within the archive. Provides random archive processing, preparing elf In either case, the return value may be passed as an argument to elf_begin() , or an error occurred, and the return value is ELF_C_NULL Otherwise, the open file was not an archive, elf Prepares the containing archive to access the following member when the program calls elf_begin()Īn archive for the next member, elf_next() Provides sequential access to the next archive member. Image that is mapped in with elf_memory() Is a pointer to an image of the Elf file mapped into memory, sz Image has read operations enabled ( ELF_C_READ The library does not terminate the descriptor until the activation count reaches 0 Removes one activation and returns the remaining activation count. If the program wishes to write data associated with the ELFĭescriptor to the file, it must use elf_update() A null pointer is allowed as an argument, to simplify error handling. Program terminates a descriptor, the data remain allocated. , and to deallocate data associated with the descriptor.

Otherwise, the return value is a non-null ELF Is an archive with no more members to process, or an error occurs, elf_begin() To determine the file type (only object files have an ELF Programs reading object files thus may call elf_kind(3ELF) ``works'' on all files (including files with zero bytes), providing it can allocate memory for its internal structures and read any necessary information from the file.


If the program wishes to ignore previous file contents, presumably to create a new file, it should set cmd Is non-null, it must have been created with the ELF_C_RDWR Gives a read-only view of the file, while ELF_C_RDWR
#Elf memory master update
This command duplicates the actions of ELF_C_READĪllows the program to update the file image (see elf_update(3ELF) See the examples below for more information. , without allocating a new descriptor and without changing the descriptor's read/write permissions. Should be the same file descriptor used for the parent archive.ĭescriptor that is not an archive, elf_begin() The program should have used elf_next()įor the initial member, which elf_begin() Is a non-null descriptor associated with an archive file, elf_begin()ĭescriptor associated with an individual member. If the file being read is an archive, elf_begin()Īlso prepares the resulting descriptor to examine the initial archive member on the next call to elf_begin() Three cases can occur.ĭescriptor and prepares to process the entire file. , this command examines archive members or entire files. When a program wishes to examine the contents of an existing file, it should set cmd Returns a null pointer, without opening a new descriptor. May have the following values: ELF_C_NULL ) is unconstrained, and the resulting file offset is undefined. Is an open file descriptor that elf_begin()ĭescriptor previously returned from elf_begin() , the program may read an existing file, update an existing file, or create a new file. Size_t elf_rand(Elf * elf, size_t offset) Īnd Linking Format (ELF) object files, either individually or as members of archives. #include Elf *elf_begin(int fildes, Elf_Cmd cmd, Elf * ref) Įlf *elf_memory(char * image, size_t sz) Elf_begin, elf_end, elf_memory, elf_next, elf_rand- process ELF object files SYNOPSISĬc file.
