Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ldr_xload(3) — OSF/1 3.0 αXP

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ldr_xunload(3)

ldr_xentry(3)

ldr_xlookup_package(3)

ldr_xload(3)  —  Subroutines

NAME

ldr_xload -  Loads a module in another process and returns the module ID

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <sys/types.h>
#include <loader.h>
int ldr_xload(
ldr_process_tprocess,
char ∗file_pathname,
ldr_load_flags_t load_flags,
ldr_module_t ∗mod_id_ptr);

PARAMETERS

processSpecifies the process into whose address space the object module is to be loaded. 

file_pathname
Specifies the pathname of the object module.

load_flagsSpecifies options on the load.  Valid values are:

LDR_WIREWire the module in physical memory so that it will not be paged out. 

LDR_NOFLAGS
No flags are specified.

LDR_NOUNREFS
Allow no unresolved references after resolving shared library references.

LDR_PREXIST
The module must have been already loaded.

LDR_NOPREXIST
Return an error if the module is already loaded.

mod_id_ptrPoints to a variable in which the module ID of the loaded module is returned. 

DESCRIPTION

The ldr_xload() function loads the specified object module into the virtual address space of the specified process.  It can be used to load both relocatable and absolute modules. 

If the object module is already loaded, the function does not load it again, but it does return its ID.  Using the LDR_NOPREXIST load flag forces an error if the module is already loaded. 

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

The loader assigns a unique identifier to each module when

it is loaded.  Module IDs provide a convenient way of referencing loaded modules in other loader-related functions. 

The loader can link unresolved references in dynamically loaded kernel modules, relocate the code as necessary, and call an initialization entry point.  The loader, however, cannot automatically load further modules to resolve unresolved references.  Each kernel module must link completely against symbols exported by the kernel or by previously loaded modules.  Circular dependencies are not allowed for dynamically loaded kernel modules. 

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

RETURN VALUES

Upon successful completion, the module is loaded and 0 (zero) is returned.  Otherwise, a negative value is returned and errno is set to indicate the error. 

ERRORS

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

[ENOEXEC]The file_pathname parameter specifies a file with an unrecognizable object file format. 

[EINVAL]The load_flags parameter specified an invalid option or an invalid ldr_module_t has been specified. 

[EEXIST]The LDR_NOPREXIST load flag was specified and the module was already loaded. 

[ESRCH]The process identifier is invalid. 

[ENOPKG]One or more unresolved package names were found. 

[ENOSYM]One or more unresolved symbol names were found. 

[EDUPPKG]The loaded module exported a package which duplicated the package name of a module already loaded in the same process. 

RELATED INFORMATION

Functions: ldr_xunload(3), ldr_xentry(3), ldr_xlookup_package(3)

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