MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


ELF Library Functions                           elfrawfile(3ELF)



NAME
     elfrawfile - retrieve uninterpreted file contents

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

     char *elfrawfile(Elf *elf, sizet *ptr);


DESCRIPTION
     The elfrawfile() function returns a pointer to an  uninter-
     preted  byte image of the file. This function should be used
     only to retrieve a file being read. For example,  a  program
     might use elfrawfile() to retrieve the bytes for an archive
     member.


     A program may not close or disable (see elfcntl(3ELF))  the
     file  descriptor associated with elf before the initial call
     to elfrawfile() , because elfrawfile() might have to  read
     the  data from the file if it does not already have the ori-
     ginal 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.


     elfrawdata() is a related  function,  providing  access  to
     sections within a file. See elfgetdata(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.

ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:












SunOS 5.11          Last change: 11 Jul 2001                    1






ELF Library Functions                           elfrawfile(3ELF)



     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     Interface Stability          Stable                      
    
     MT-Level                     MT-Safe                     
    


SEE ALSO
     elf(3ELF),       elf32getehdr(3ELF),       elfbegin(3ELF),
     elfcntl(3ELF),    elfgetdata(3ELF),    elfgetident(3ELF),
     elfkind(3ELF), libelf(3LIB), attributes(5)

NOTES
     A program that uses elfrawfile() and that  also  interprets
     the  same  file as an object file potentially has two copies
     of the bytes in memory. If such a program requests  the  raw
     image  first,  before  it  asks  for  translated information
     (through such functions as  elf32getehdr(),  elfgetdata(),
     and so on), the library ``freezes'' its original memory copy
     for the raw image. It then uses  this  frozen  copy  as  the
     source  for creating translated objects, without reading the
     file again. Consequently, the application  should  view  the
     raw  file  image  returned  by  elfrawfile() as a read-only
     buffer, unless it wants to alter its own view of data subse-
     quently  translated.  In any case, the application may alter
     the translated objects without changing bytes visible in the
     raw image.


     Multiple calls to elfrawfile() with the same ELF descriptor
     return the same value; the library does not create duplicate
     copies of the file.





















SunOS 5.11          Last change: 11 Jul 2001                    2



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™