st_get_known_versions(3) [osf1 man page]
st_get_known_versions(3) Library Functions Manual st_get_known_versions(3) NAME
st_get_known_versions, st_get_format_versions, st_mem_get_format_versions, st_get_version_byname, st_mem_get_version_byname, st_fd_get_ver- sion_byname - Access version information in an object file LIBRARY
Symbol Table and Object File Access Library (libst.a) SYNOPSIS
#include <st.h> st_status_t st_get_known_versions ( unsigned short *objver, unsigned short *symver); st_status_t st_get_format_versions ( char *objname, unsigned short *objver, unsigned short *symver); st_status_t st_mem_get_format_versions ( void *addr, unsigned short *objver, unsigned short *symver); st_status_t st_get_version_byname ( char *objname, char *toolname, unsigned long *toolver, char **verstring); st_status_t st_mem_get_version_byname ( void *addr, unsigned long size, char *toolname, unsigned long *toolver, char **verstring); st_status_t st_fd_get_version_byname ( int fd, off_t pos, char *toolname, unsigned long *toolver, char **verstring); PARAMETERS
Name of file to be opened Object file version stamp Symbol table version stamp Address of file in memory Identifier of tool version entry Numeric tool version from toolname's entry Printable tool version from toolname's entry DESCRIPTION
These functions access version information in an object file. The st_get_known_versions routine returns the version stamp values (from the file /usr/include/stamp.h) that libst.a was built with. The st_get_format_versions and st_mem_get_format_versions retrieve the object file and symbol table version stamps from a given object file. Use st_mem_get_format_versions if the contents of the object have been memory- mapped or read into memory and st_get_format_versions otherwise. The st_get_version_byname, st_mem_get_version_byname, and st_fd_get_version_byname routines search the .comment section for a tool-specific version entry for the tool identified by the toolname parameter. Tool-specific versions are typically recorded only for system utilities. Use st_fd_get_version_byname for a file that has already been opened, st_mem_get_version_byname for a file that has been read into memory, and st_get_version_byname otherwise. The caller is responsible for freeing the verstring parameter after a successful call; space for this character string is dynamically allocated by these libst functions. RETURN VALUES
All routines return zero to indicate success and non-zero to indicate failure. RELATED INFORMATION
libst_intro(3), st_obj_open(3) delim off st_get_known_versions(3)
Check Out this Related Man Page
st_obj_open(3) Library Functions Manual st_obj_open(3) NAME
st_ar_member_next, st_file_is_archive, st_is_obj_archive, st_obj_close, st_obj_open, st_object_type - Routines to check whether an object is an archive and to process object files within an archive. 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 *file, unsigned int flags ); st_status_t st_obj_close ( st_obj_t *obj ); st_status_t st_object_type ( const char *file, st_object_type_t *otype ); st_status_t st_is_obj_archive ( st_obj_t *obj, st_bool_t *is_archive); st_status_t st_file_is_archive ( char *file, st_bool_t *is_archive); st_status_t st_ar_member_next ( st_obj_t *obj); PARAMETERS
Specifies an address to which st_obj_open returns an object handle if it successfully opens the file specified in the file parameter. For st_obj_close, specifies an object handle, as returned by the st_obj_open function. Specifies the file name of the object to be opened or closed, or for which an object type is requested. Specifies how the object is to be opened. The open flags defined in /usr/include/st.h include the following: Opens the file for read-only access. This is the default. Disables name demangling for C++ names. By default, C++ name demangling is enabled when a file is opened. Overrides version checking for object and symbol table formats. 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: Unknown object type Archive library OMAGIC file NMAGIC file ZMAGIC file A boolean variable set to true if the file is an archive. 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. It does not create an object handle, nor does it open the object. If the named file is an archive file, st_obj_open initializes archive information in the obj structure and returns successfully. Archive member objects are processed sequentially. After an archive has been successfully opened, call the st_ar_member_next routine. It reads in an archive member each time it is called, and it returns ST_E_ARCHIVE_END when there are no more members. If the archive contains no members, st_ar_member_next returns ST_E_ARCHIVE_EMPTY. (See the code fragment in the Example section for proper usage of st_ar_mem- ber_next.) The routines st_is_obj_archive and st_file_is_archive can be used to detect whether a file or object handle is an archive. Use st_file_is_archive before calling st_obj_open or st_obj_is_archive after calling st_obj_open. The st_obj_open function tests the object and symbol table format versions of the named object file. If either format version includes a major version number that is not supported by this implementation of the libst interfaces, st_obj_open will return ST_E_MAJ_OBJ_VER (for object format mismatches) or ST_E_MAJ_SYM_VER (for symbol table format mismatches.) If the ST_FORCE flag is included in the st_obj_open flags parameter, it will not perform the format version testing. 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. EXAMPLE
The following code fragment illustrates how to use libst routines to open object files or archive libraries: #include <st.h> char *objname; st_bool_t archive; st_status_t status; st_obj_t *obj; if (argc != 2) return; objname = argv[1]; if (status = st_obj_open(&obj, objname, ST_RDONLY)) return status; st_is_obj_archive(obj, &archive); if (archive) while ((status = st_ar_member_next(obj)) == 0) { /* process member object */ } else /* process object */ st_obj_close(obj); FILES
Header file that contains all definitions and function prototypes for libst.a functions Header file that controls name-demangling opera- tions 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_calls(3), st_obj_file_start(3), st_objlist_append(3), st_proc_addr(3), st_sym_value(3) delim off st_obj_open(3)