st_dyn_addr man page on DigitalUNIX

Man page or keyword search:  
man Server   12896 pages
apropos Keyword Search (all sections)
Output format
DigitalUNIX logo
[printable version]

st_dyn_start(3)						       st_dyn_start(3)

NAME
       st_dyn_start,  st_dyn_next,  st_dyn_count, st_dyn_find_tag, st_dyn_tag,
       st_dyn_value, st_dyn_addr - Access routines for dynamic header informa‐
       tion in shared objects

SYNOPSIS
       #include <st.h>

       st_status_t st_dyn_start(
	       st_obj_t *obj,
	       st_dynscn_t *pdyn ); st_status_t st_dyn_next(
	       st_obj_t *obj,
	       st_dynscn_t dcur,
	       st_dynscn_t *pdyn ); st_status_t st_dyn_count(
	       st_obj_t *obj,
	       unsigned int *pcount ); st_status_t st_dyn_find_tag(
	       st_obj_t *obj,
	       unsigned int tag,
	       st_dynscn_t *pdyn ); st_status_t st_dyn_tag(
	       st_obj_t *obj,
	       st_dynscn_t dyn,
	       unsigned int *ptag ); st_status_t st_dyn_value(
	       st_obj_t *obj,
	       st_dynscn_t dyn,
	       unsigned long *pvalue ); st_status_t st_dyn_addr(
	       st_obj_t *obj,
	       st_dynscn_t dyn,
	       st_addr_t *addr );

LIBRARY
       Symbol Table and Object File Access Library (libst.a)

PARAMETERS
       Specifies  an object handle, as returned by the st_obj_open() function.
       Specifies  an  address  to  which  st_dyn_start(),  st_dyn_next(),   or
       st_dyn_find_tag() return a dynamic section handle.  Specifies a dynamic
       section	handle	as  returned  by  st_dyn_start(),  st_dyn_next(),   or
       st_dyn_find_tag()   functions.	 Specifies   an	  address   to	 which
       st_dyn_count() returns the number of entries in	the  dynamic  section.
       Specifies  an  address  to which st_dyn_tag() returns a dynamic section
       tag.  Specifies a dynamic section tag. Dynamic section tags are defined
       in  /usr/include/coff_dyn.h. The Object File/Symbol Table Format Speci‐
       fication provides a complete description of all dynamic	section	 tags.
       Specifies  an address to which st_dyn_value() returns a dynamic section
       value. Dynamic section values may  be  either  link-time	 addresses  or
       absolute	 values. The dynamic section tag determines how the associated
       dynamic section value should be interpreted. The Object File/Symbol Ta‐
       ble  Format  Specification  identifies  value  interpretations  for all
       dynamic section tags.  Specifies	 an  address  to  which	 st_dyn_addr()
       returns a pointer to the data addressed by a dynamic section entry.

DESCRIPTION
       These  functions	 are used to read dynamic section entries in an object
       file. The dynamic section is an array of tag and value pairs  providing
       information  that  is used to navigate and interpret additional dynamic
       load information contained in the  object  file.	 The  dynamic  section
       entries	and other dynamic load information are described in the Object
       File/Symbol Table Format Specification. This document provides  a  com‐
       plete  list of dynamic section tags and describes how each tag's corre‐
       sponding value should be interpreted.  Used to iterate over all of  the
       dynamic	section entries. These functions return an opaque dynamic sec‐
       tion handle to the pdyn parameter. You can use this handle as an	 input
       argument in subsequent calls to other dynamic section access functions.
       (To indicate that the iteration over the dynamic sections has been com‐
       pleted,	st_dyn_next() returns NULL to the pdyn parameter.)  This func‐
       tion returns the number of entries in the  specified  object's  dynamic
       section	to  the	 pcount	 parameter.   Used to locate a dynamic section
       entry with a specific tag. This function returns an opaque dynamic sec‐
       tion  handle  to	 the  pdyn  parameter.	(To  indicate that no matching
       dynamic section entry was found, st_dyn_find_tag() returns NULL to  the
       pdyn  parameter.)   Used	 to  read  the components of a dynamic section
       entry. The st_dyn_tag() function returns the dynamic section entry  tag
       to  the ptag parameter. The st_dyn_value() function returns the dynamic
       section entry value to the pvalue parameter. The dynamic section	 entry
       value  may  be  a constant or a link-time address, or it may be unused.
       If the specified dynamic section entry's value is a link-time  address,
       this function returns a corresponding buffer pointer to the addr param‐
       eter.  Otherwise, NULL is returned to the addr  parameter.  The	buffer
       pointer	can  be used to access the file data that is referenced by the
       dynamic section entry. The format of the	 data  is  determined  by  the
       dynamic section entry tag.

RETURN VALUES
       All functions indicate success by returning a value of 0 (zero). A pos‐
       itive return value is an errno value from a  system  call.  A  negative
       return  value  is  a  library  error or informational code. The library
       codes are documented in st.h.

       Return parameters are set to 0 when an error occurs.  An	 exception  to
       this  is	 the  case  in which an invalid input parameter is passed.  In
       such cases, the return parameters will be unchanged. A non-zero	return
       status  is  the recommended method for detecting an error return from a
       libst function.

EXAMPLES
       The following program illustrates how to use  libst  routines  to  read
       dynamic	section data. This sample program shows an algorithm for read‐
       ing and displaying shared library dependency information.

       This example has been simplified for illustration purposes. Return sta‐
       tus  should  be tested after each function call. See st_strerror(3) for
       an example of return status testing.

       #include "st.h" #include "coff_dyn.h"

       main(int argc, char **argv){
	   st_status_t	  s;	     /* error status */
	   st_obj_t	  *obj;	     /* object handle */
	   st_dynscn_t	  pdyn;	     /* dynamic entry */
	   Coff_Lib	  *llib;     /* library list */
	   int		  llibno;    /* # of libraries */
	   char		  *dynstr;   /* dynamic strings */
	   unsigned long  val;
	   unsigned long  addr;
	   int		  i;

	   s = st_obj_open(&obj, argv[1], ST_RDONLY);

	   /* Find dynamic section entry for the list of
	    * shared library dependencies.
	    */
	   s = st_dyn_find_tag(obj, DT_LIBLIST, &pdyn);
	   if (!pdyn) {
	       printf("%s has no shared library dependencies\n",
		      argv[1]);
	       exit(0);
	   }

	   /* Get a pointer to the list of shared library
	    * dependencies.
	    */
	   st_dyn_addr(obj, pdyn, &addr);
	   llib = (Coff_Lib *)addr;

	   /* Get the number of entries in the list. */
	   st_dyn_find_tag(obj, DT_LIBLISTNO, &pdyn);
	   st_dyn_value(obj, pdyn, &val);
	   llibno = val;

	   /* Get a pointer to the dynamic string table. */
	   st_dyn_find_tag(obj, DT_STRTAB, &pdyn);
	   st_dyn_addr(obj, pdyn, &addr);
	   dynstr = (char *)addr;

	   /* Print out the library dependency names. */
	   for (i = 0; i < llibno; i++) {
	       printf("%s\n", &dynstr[llib[i].l_name]);
	   } }

FILES
       Header file that contains all definitions and function  prototypes  for
       libst.a	functions  Header  file	 that contains definitions for dynamic
       section tag values

SEE ALSO
       Functions: libst_intro(3), st_obj_open(3), st_str_error(3)

       Programmer's Guide: Use a web browser such as netscape(1) to access the
       Developers'  Toolkit  Supplement	 edition  of the Programmer's Guide at
       file:/usr/share/doclib/dtk/guide/index.html

							       st_dyn_start(3)
[top]

List of man pages available for DigitalUNIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net