unload(3) — Subroutines
OSF
NAME
unload − Unloads a previously loaded module
LIBRARY
Loader Library libld.a
SYNOPSIS
#include <sys/types.h>
#include <loader.h>
int unload(
ldr_module_t mod_id);
PARAMETERS
mod_id
Specifies the identifier for the module to be unloaded. The module ID is returned when the module is first loaded.
DESCRIPTION
The unload() function unloads the specified module from the virtual address space of the calling process. The function unmaps the module’s regions and discards the loader data structures that describe the module.
The module is unloaded even if any references to it remain in other modules. The loader does not keep track of such dangling references or attempt to unsnap any invalidated links. These housekeeping tasks are the responsibility of the calling process. Attempts to refer to addresses in an unloaded module can result in indeterminate errors.
NOTES
Once a module has been unloaded, its module ID is no longer valid.
RETURN VALUES
Upon successful completion, the unload() function returns a value of 0 (zero). If the unload fails, the function returns a value of -1 and errno is set to indicate the error.
ERRORS
If the unload() function fails, errno may be set to one of the following values:
[EINVAL] The specified module ID cannot be unloaded or is not valid.
[EDUPPKG]
The loaded module exported a package which duplicated the package name of a module already loaded in the same process.
RELATED INFORMATION
Functions: load(2), ldr_xunload(2)