Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ldr_xload(3)

ldr_xunload(3)  —  Subroutines

NAME

ldr_xunload − Unloads a module previously loaded in another process

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <sys/types.h>
#include <loader.h>
int ldr_xunload(
ldr_process_tprocess,
ldr_module_t mod_id);

PARAMETERS

processSpecifies the process from whose address space the module is to be unloaded. 

mod_idIdentifies the module to be unloaded.  The module ID is returned when the module is first loaded. 

DESCRIPTION

The ldr_xunload() function unloads the specified module from the virtual address space of the specified 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. 

To obtain the unique identifier for the current process, use the following call:

ldr_process_t ldr_my_process();

To obtain the unique identifier for the kernel, use the following call:

ldr_process_t ldr_kernel_process();

NOTES

This function currently works only for the current process and the kernel process. 

Once a module has been unloaded, its module ID is no longer valid. 

RETURN VALUES

If the unload operation is a success, the function returns a value of 0 (zero).  If the unload fails, the function returns a negative value and errno is set to indicate the error. 

ERRORS

If the ldr_xunload() function fails, errno may be set to one of the following values:

[EINVAL]The specified module ID is not valid. 

[EINVAL]The specified module cannot be unloaded (that is, it was loaded with the flag LDR_NOUNLOAD). 

[ESRCH]The process identifier is invalid. 

RELATED INFORMATION

Functions: ldr_xload(3),

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026