VxWorks Reference Manual : Libraries

moduleLib

NAME

moduleLib - object module management library

ROUTINES

moduleCreate( ) - create and initialize a module
moduleDelete( ) - delete module ID information (use unld( ) to reclaim space)
moduleShow( ) - show the current status for all the loaded modules
moduleSegGet( ) - get (delete and return) the first segment from a module
moduleSegFirst( ) - find the first segment in a module
moduleSegNext( ) - find the next segment in a module
moduleCreateHookAdd( ) - add a routine to be called when a module is added
moduleCreateHookDelete( ) - delete a previously added module create hook routine
moduleFindByName( ) - find a module by name
moduleFindByNameAndPath( ) - find a module by file name and path
moduleFindByGroup( ) - find a module by group number
moduleIdListGet( ) - get a list of loaded modules
moduleInfoGet( ) - get information about an object module
moduleCheck( ) - verify checksums on all modules
moduleNameGet( ) - get the name associated with a module ID
moduleFlagsGet( ) - get the flags associated with a module ID

DESCRIPTION

This library is a class manager, using the standard VxWorks class/object facilities. The library is used to keep track of which object modules have been loaded into VxWorks, to maintain information about object module segments associated with each module, and to track which symbols belong to which module. Tracking modules makes it possible to list which modules are currently loaded, and to unload them when they are no longer needed.

The module object contains the following information:

    - name
    - linked list of segments, including base addresses
      and sizes
    - symbol group number
    - format of the object module (a.out, COFF, ECOFF, etc.)
    - the symFlag passed to ld( ) when the module was
      loaded.  (For more information about symFlag and the
      loader, see the manual entry for loadLib.)

Multiple modules with the same name are allowed (the same module may be loaded without first being unloaded) but "find" functions find the most recently created module.

The symbol group number is a unique number for each module, used to identify the module's symbols in the symbol table. This number is assigned by moduleLib when a module is created.

In general, users will not access these routines directly, with the exception of moduleShow( ), which displays information about currently loaded modules. Most calls to this library will be from routines in loadLib and unldLib.

INCLUDE FILES

moduleLib.h

SEE ALSO

moduleLib, loadLib, Tornado User's Guide: Cross-Development


Libraries : Routines

moduleCreate( )

NAME

moduleCreate( ) - create and initialize a module

SYNOPSIS

MODULE_ID moduleCreate
    (
    char * name,   /* module name */
    int    format, /* object module format */
    int    flags   /* symFlag as passed to loader (see loadModuleAt()) */
    )

DESCRIPTION

This routine creates an object module descriptor.

The arguments specify the name of the object module file, the object module format, and an argument specifying which symbols to add to the symbol table. See the loadModuleAt( ) description of symFlag for possibles flags values.

Space for the new module is dynamically allocated.

RETURNS

MODULE_ID, or NULL if there is an error.

SEE ALSO

moduleLib, loadModuleAt( )


Libraries : Routines

moduleDelete( )

NAME

moduleDelete( ) - delete module ID information (use unld( ) to reclaim space)

SYNOPSIS

STATUS moduleDelete
    (
    MODULE_ID moduleId /* module to delete */
    )

DESCRIPTION

This routine deletes a module descriptor, freeing any space that was allocated for the use of the module ID.

This routine does not free space allocated for the object module itself -- this is done by unld( ).

RETURNS

OK or ERROR.

SEE ALSO

moduleLib


Libraries : Routines

moduleShow( )

NAME

moduleShow( ) - show the current status for all the loaded modules

SYNOPSIS

STATUS moduleShow
    (
    char * moduleNameOrId, /* name or ID of the module to show */
    int    options         /* display options */
    )

DESCRIPTION

This routine displays a list of the currently loaded modules and some information about where the modules are loaded.

The specific information displayed depends on the format of the object modules. In the case of a.out and ECOFF object modules, moduleShow( ) displays the start of the text, data, and BSS segments.

If moduleShow( ) is called with no arguments, a summary list of all loaded modules is displayed. It can also be called with an argument, moduleNameOrId, which can be either the name of a loaded module or a module ID. If it is called with either of these, more information about the specified module will be displayed.

RETURNS

OK or ERROR.

SEE ALSO

moduleLib, VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

moduleSegGet( )

NAME

moduleSegGet( ) - get (delete and return) the first segment from a module

SYNOPSIS

SEGMENT_ID moduleSegGet
    (
    MODULE_ID moduleId /* module to get segment from */
    )

DESCRIPTION

This routine returns information about the first segment of a module descriptor, and then deletes the segment from the module.

RETURNS

A pointer to the segment ID, or NULL if the segment list is empty.

SEE ALSO

moduleLib, moduleSegFirst( )


Libraries : Routines

moduleSegFirst( )

NAME

moduleSegFirst( ) - find the first segment in a module

SYNOPSIS

SEGMENT_ID moduleSegFirst
    (
    MODULE_ID moduleId /* module to get segment from */
    )

DESCRIPTION

This routine returns information about the first segment of a module descriptor.

RETURNS

A pointer to the segment ID, or NULL if the segment list is empty.

SEE ALSO

moduleLib, moduleSegGet( )


Libraries : Routines

moduleSegNext( )

NAME

moduleSegNext( ) - find the next segment in a module

SYNOPSIS

SEGMENT_ID moduleSegNext
    (
    SEGMENT_ID segmentId /* segment whose successor is to be found */
    )

DESCRIPTION

This routine returns the segment in the list immediately following segmentId.

RETURNS

A pointer to the segment ID, or NULL if there is no next segment.

SEE ALSO

moduleLib


Libraries : Routines

moduleCreateHookAdd( )

NAME

moduleCreateHookAdd( ) - add a routine to be called when a module is added

SYNOPSIS

STATUS moduleCreateHookAdd
    (
    FUNCPTR moduleCreateHookRtn /* routine called when module is added */
    )

DESCRIPTION

This routine adds a specified routine to a list of routines to be called when a module is created. The specified routine should be declared as follows:

    void moduleCreateHook
        (
        MODULE_ID  moduleId  /* the module ID */
        )
This routine is called after all fields of the module ID have been filled in.

NOTE

Modules do not have information about their object segments when they are created. This information is not available until after the entire load process has finished.

RETURNS

OK or ERROR.

SEE ALSO

moduleLib, moduleCreateHookDelete( )


Libraries : Routines

moduleCreateHookDelete( )

NAME

moduleCreateHookDelete( ) - delete a previously added module create hook routine

SYNOPSIS

STATUS moduleCreateHookDelete
    (
    FUNCPTR moduleCreateHookRtn /* routine called when module is added */
    )

DESCRIPTION

This routine removes a specified routine from the list of routines to be called at each moduleCreate( ) call.

RETURNS

OK, or ERROR if the routine is not in the table of module create hook routines.

SEE ALSO

moduleLib, moduleCreateHookAdd( )


Libraries : Routines

moduleFindByName( )

NAME

moduleFindByName( ) - find a module by name

SYNOPSIS

MODULE_ID moduleFindByName
    (
    char * moduleName /* name of module to find */
    )

DESCRIPTION

This routine searches for a module with a name matching moduleName.

RETURNS

MODULE_ID, or NULL if no match is found.

SEE ALSO

moduleLib


Libraries : Routines

moduleFindByNameAndPath( )

NAME

moduleFindByNameAndPath( ) - find a module by file name and path

SYNOPSIS

MODULE_ID moduleFindByNameAndPath
    (
    char * moduleName, /* file name to find */
    char * pathName    /* path name to find */
    )

DESCRIPTION

This routine searches for a module with a name matching moduleName and path matching pathName.

RETURNS

MODULE_ID, or NULL if no match is found.

SEE ALSO

moduleLib


Libraries : Routines

moduleFindByGroup( )

NAME

moduleFindByGroup( ) - find a module by group number

SYNOPSIS

MODULE_ID moduleFindByGroup
    (
    int groupNumber /* group number to find */
    )

DESCRIPTION

This routine searches for a module with a group number matching groupNumber.

RETURNS

MODULE_ID, or NULL if no match is found.

SEE ALSO

moduleLib


Libraries : Routines

moduleIdListGet( )

NAME

moduleIdListGet( ) - get a list of loaded modules

SYNOPSIS

int moduleIdListGet
    (
    MODULE_ID * idList,    /* array of module IDs to be filled in */
    int         maxModules /* max modules idList can accommodate */
    )

DESCRIPTION

This routine provides the calling task with a list of all loaded object modules. An unsorted list of module IDs for no more than maxModules modules is put into idList.

RETURNS

The number of modules put into the ID list, or ERROR.

SEE ALSO

moduleLib


Libraries : Routines

moduleInfoGet( )

NAME

moduleInfoGet( ) - get information about an object module

SYNOPSIS

STATUS moduleInfoGet
    (
    MODULE_ID     moduleId,   /* module to return information about */
    MODULE_INFO * pModuleInfo /* pointer to module info struct */
    )

DESCRIPTION

This routine fills in a MODULE_INFO structure with information about the specified module.

RETURNS

OK or ERROR.

SEE ALSO

moduleLib


Libraries : Routines

moduleCheck( )

NAME

moduleCheck( ) - verify checksums on all modules

SYNOPSIS

STATUS moduleCheck
    (
    int options /* validation options */
    )

DESCRIPTION

This routine verifies the checksums on the segments of all loaded modules. If any of the checksums are incorrect, a message is printed to the console, and the routine returns ERROR.

By default, only the text segment checksum is validated.

Bits in the options parameter may be set to control specific checks:

MODCHECK_TEXT
Validate the checksum for the TEXT segment (default).

MODCHECK_DATA
Validate the checksum for the DATA segment.

MODCHECK_BSS
Validate the checksum for the BSS segment.

MODCHECK_NOPRINT
Do not print a message (moduleCheck( ) still returns ERROR on failure.)

See the definitions in moduleLib.h

RETURNS

OK, or ERROR if the checksum is invalid.

SEE ALSO

moduleLib


Libraries : Routines

moduleNameGet( )

NAME

moduleNameGet( ) - get the name associated with a module ID

SYNOPSIS

char * moduleNameGet
    (
    MODULE_ID moduleId
    )

DESCRIPTION

This routine returns a pointer to the name associated with a module ID.

RETURNS

A pointer to the module name, or NULL if the module ID is invalid.

SEE ALSO

moduleLib


Libraries : Routines

moduleFlagsGet( )

NAME

moduleFlagsGet( ) - get the flags associated with a module ID

SYNOPSIS

int moduleFlagsGet
    (
    MODULE_ID moduleId
    )

DESCRIPTION

This routine returns the flags associated with a module ID.

RETURNS

The flags associated with the module ID, or NULL if the module ID is invalid.

SEE ALSO

moduleLib