 |
Index for Section 3 |
|
 |
Alphabetical listing for S |
|
st_obj_open(3)
NAME
st_obj_open, st_obj_close, st_object_type - Open or close an object or
query its type
LIBRARY
Symbol Table and Object File Access Library (libst.a)
SYNOPSIS
#include <st.h>
st_status_t st_obj_open (
st_obj_t **obj,
const char *name,
unsigned int flags );
st_status_t st_obj_close (
st_obj_t *obj );
st_status_t st_object_type (
const char *name,
st_object_type_t *otype );
PARAMETERS
obj Specifies an address to which st_obj_open returns an object
handle if it successfully opens the file specified in the name
parameter. For st_obj_close, specifies an object handle, as
returned by the st_obj_open function.
name Specifies the file name of the object to be opened or closed, or
for which an object type is requested.
flags Specifies how the object is to be opened. The open flags defined
in /usr/include/st.h include the following:
ST_RDONLY Opens the file for read-only access. This is the
default.
ST_MANGLE_NAMES
Disables name demangling for C++ names. By default,
C++ name demangling is enabled when a file is opened.
otype Specifies an address to which st_object_type returns a value
identifying the object type. The following object types are
defined in usr/include/st.h:
ST_OTYPE_UNKNOWN
Unknown object type
ST_ARCHIVE
Archive library
ST_OMAGIC OMAGIC file
ST_NMAGIC NMAGIC file
ST_ZMAGIC ZMAGIC file
DESCRIPTION
The st_obj_open function opens the named object file for read access. It
maps the file in memory using mmap, if possible. If mmap fails, it
dynamically allocates memory in which to read the file. The flags
parameter indicates how the file is to be opened. If it succeeds in
opening the file, it returns an opaque handle for the object to the obj
parameter. You can use this object handle as an input argument in
subsequent calls to other object file access routines.
The st_obj_close function releases memory dynamically allocated for
processing the object and unmaps memory to which the file was mapped when
it was opened.
The st_object_type function returns the object type of the specified
filename object to the otype parameter. st_object_type does not create an
object handle, nor does it open the object.
RETURN VALUES
All functions indicate success by returning a value of 0 (zero). A
positive 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 or -1 when an error occurs. Address
parameters are set to 0, and file and procedure handles are set to -1. An
exception to this is if a NULL pointer for the object or other return
parameter is input. In these 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.
FILES
/usr/include/st.h
Header file that contains all definitions and function prototypes
for libst.a functions
/usr/include/cmplrs/demangle_string.h
Header file that controls name-demangling operations for C++
objects
RELATED INFORMATION
Commands: atom(1)
Functions: mmap(2), libst_intro(3), st_addr_to_file(3), st_file_lang(3),
st_obj_file_start(3), st_objlist_append(3), st_proc_addr(3),
st_sym_value(3)