 |
Index for Section 2 |
|
 |
Alphabetical listing for E |
|
 |
Bottom of page |
|
exec_with_loader(2)
NAME
exec_with_loader - Execute a file with a loader
SYNOPSIS
int exec_with_loader(
int flags,
const char *loader,
const char *file,
char * const argv[],
char * const envp[] );
PARAMETERS
flags Specifies flags to be passed to the loader.
loader Points to a pathname that identifies a regular, executable, process
image file that contains the loader. This image file must be a
nonshared image.
file Points to a pathname that identifies a regular, executable process
image file. This image file must be a call-shared image.
argv Specifies an array of character pointers to null-terminated
strings.
envp Specifies an array of character pointers to null-terminated
strings, constituting the environment for the new process.
DESCRIPTION
The exec_with_loader() function replaces the current process image with a
new process image, in a manner similar to what the exec functions do. Both
the loader parameter and the file parameter point to pathnames that
identify regular, executable files called process image files. Unlike the
exec functions, which construct the new process image from the file
identified by the file parameter, exec_with_loader() constructs the new
process image from the file identified by the loader parameter.
Note
Throughout this reference page, the regular, executable, process image
file specified by the loader parameter is referred to as the "program
loader," and the regular, executable, process image file specified by
the file parameter is referred to as the "file."
The loader image cannot be linked at the default user addresses. You must
find another place to link it. One acceptable place to link the loader
image is at the address space defined for the loader in the
/usr/shlib/so_locations file.
After the exec_with_loader() function successfully loads the program
loader, it transfers control to the program loader and effectively passes
the file parameter. Under normal usage, the program loader will then load
(that is, merge) the file into the newly constructed process image, along
with any object files upon which the program (that is, the file) depends.
The typical use of exec_with_loader() is to load programs that contain
unresolved external references, for example, programs that require the use
of a shared library.
The exec_with_loader() function implements and preserves all of the
semantics of the exec functions, with respect to the file. These include
the handling of the argv and envp parameters, command interpreters, close-
on-exec processing, signals, set user ID and set group ID processing, the
process attributes and error returns.
The loader parameter may be null, in which case the exec_with_loader()
function loads the default program loader (/sbin/loader). The
exec_with_loader() function also loads the default program loader under
either of the following sets of conditions, even if the loader parameter
points to a valid program loader:
· If the set user ID mode bit of the file is set (see the chmod()
function) and the owner ID of the file is not equal to the effective
user ID of the process
· If the set group ID mode bit of the file is set and the group ID of
the file is not equal to the effective group ID of the process.
The setting of the user ID or set group ID mode bits on the program loader
have no effect whatsoever.
RETURN VALUES
If the exec_with_loader() function returns to the calling process image, an
error has occurred; the return value is -1, and errno is set to indicate
the error.
ERRORS
If the exec_with_loader() function fails, errno may be set to one of the
following values:
[EACCES]
Search permission is denied for a directory listed in either file's
path prefix, or either file denies execution permission, or either
file is not a regular file and the implementation does not support
execution of files of its type. Note that the exec_with_loader()
function references two files, one specified by the loader
parameter and one specified by the file parameter.
[ENAMETOOLONG]
The length of the loader or file parameters exceeds PATH_MAX, or a
pathname component is longer than NAME_MAX and _POSIX_NO_TRUNC is
in effect for that file.
[ENOENT]
One or more components of either file's pathname does not exist, or
the loader or file parameter points to an empty string. Note that
the exec_with_loader() function references two files, one specified
by the loader parameter and one specified by the file parameter.
[ENOTDIR]
A component of either file's path prefix is not a directory. Note
that the exec_with_loader() function references two files, one
specified by the loader parameter and one specified by the file
parameter.
[ENOEXEC]
The file specified by the loader parameter has the appropriate
access permission but is not in the proper format.
[EFAULT]
The loader or file parameter is an invalid address.
[ELOOP] Too many symbolic links were encountered in pathname resolution.
[ENOMEM]
Insufficient memory is available.
SEE ALSO
Functions: exec(2)
 |
Index for Section 2 |
|
 |
Alphabetical listing for E |
|
 |
Top of page |
|