NAME
exec_with_loader - Executes 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.
file Points to a pathname that identifies a regular,
executable process image file.
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
Throughout this manual page, the regular, executable, pro-
cess image file identified by the loader parameter is
referred to as the program loader, and the regular, execut-
able, process image file specified by the file parameter is
referred to as the file.
The exec_with_loader() function has the same functionality
as the execve() function. However, unlike execve(),
exec_with_loader() allows you to specify a different path-
name for the default loader. This new loader will be used
to load the specified file, if a loader is required in the
process. The exec_with_loader() interface requires that you
specify a particular loader to be loaded as well as the
flags for that loader.
The loader parameter may be null, in which case the
exec_with_loader() function loads the default program
loader, found in the /sbin/loader file. The
exec_with_loader() function always loads the default program
loader, even if the loader parameter points to a valid
loader file, if the set user ID mode bit of the file is set
(see chmod(2) function) and the owner ID of the file is not
equal to the effective user ID of the process, or 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 of the process.
The setting of the set user ID or set group ID mode bits on
the 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() func-
tion 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 path-
name resolution.
[ENOMEM] Insufficient memory is available.
[ETXTBSY] The file specified by the loader parameter is
currently open for writing by some process.
RELATED INFORMATION
Functions: exec(2)
Acknowledgement and Disclaimer