*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> libelf/elf_rand (3)              
Title
Content
Arch
Section
 

Contents


ELF_RAND(3E)							  ELF_RAND(3E)


NAME    [Toc]    [Back]

     elf_rand -	random archive member access

SYNOPSIS    [Toc]    [Back]

     cc	[flag ...] file	...  -lelf [library ...]

     #include <libelf.h>

     size_t elf_rand(Elf *elf, size_t offset);

DESCRIPTION    [Toc]    [Back]

     elf_rand, elf_next, and elf_begin manipulate simple object	files and
     archives.	elf is an ELF descriptor previously returned from elf_begin.

     elf_rand provides random archive processing, preparing elf	to access an
     arbitrary archive member.	elf must be a descriptor for the archive
     itself, not a member within the archive.  offset gives the	byte offset
     from the beginning	of the archive to the archive header of	the desired
     member.  See elf_getarsym(3E) for more information	about archive member
     offsets.  When elf_rand works, it returns offset.	Otherwise it returns
     0,	because	an error occurred, elf was null, or the	file was not an
     archive (no archive member	can have a zero	offset).  A program may	mix
     random and	sequential archive processing.

EXAMPLE    [Toc]    [Back]

     An	archive	starts with a ``magic string'' that has	SARMAG bytes; the
     initial archive member follows immediately.  An application could thus
     provide the following function to rewind an archive (the function returns
     -1	for errors and 0 otherwise).

	  #include <ar.h>
	  #include <libelf.h>

	  int
	  rewindelf(Elf	*elf)
	  {
		  if (elf_rand(elf, (size_t)SARMAG) == SARMAG)
			  return 0;
		  return -1;
	  }

SEE ALSO    [Toc]    [Back]

      
      
     elf(3E), elf_begin(3E), elf_getarsym(3E), elf_next(3E), ar(4).


									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
elf_next IRIX sequential archive member access
ldahread Tru64 read the archive header of a member of an archive file
ldahread IRIX read the archive header of a member of an archive file
elf_getarhdr IRIX retrieve archive member header
unstr FreeBSD create a random access file for storing strings
strfile FreeBSD create a random access file for storing strings
st_obj_open Tru64 routines to check whether an object is an archive and to process object files within an archive
st_is_obj_archive Tru64 routines to check whether an object is an archive and to process object files within an archive
st_file_is_archive Tru64 routines to check whether an object is an archive and to process object files within an archive
st_obj_close Tru64 routines to check whether an object is an archive and to process object files within an archive
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service