|
|
int execl(const char *path, const char *arg0, ..., const char *argn, char * /*NULL*/);
int execv(const char *path, char *const argv[]);
int execle(const char *path,char *const arg0[],
... ,
const char *argn,
char * /*NULL*/,
char *const envp[]);
int execve (const char *path, char *const argv[] char *const envp[]);
int execlp (const char *file, const char *arg0, ..., const char *argn, char * /*NULL*/);
int execvp (const char *file, char *const argv[]);
An interpreter file begins with a line of the form
where pathname is the path of the interpreter, and arg is an optional argument. When an interpreter file is executed, the system invokes the specified interpreter. The pathname specified in the interpreter file is passed as arg0 to the interpreter. If arg was specified in the interpreter file, it is passed as arg1 to the interpreter. The remaining arguments to the interpreter are arg0 through argn of the originally exec'd file. The interpreter named by pathname must not be an interpreter file.
When a C program is executed, it is called as follows:
where argc is the argument count, argv is an array of character pointers to the arguments themselves, and envp is an array of character pointers to the environment strings. As indicated, argc is at least one, and the first member of the array points to a string containing the name of the file.
The arguments arg0, ..., argn point to null-terminated character strings. These strings constitute the argument list available to the new process image. Conventionally at least arg0 should be present. It will become the name of the process, as displayed by the ps.1 command. The arg0 argument points to a string that is the same as path (or the last component of path). The list of argument strings is terminated by a (char *)0 argument.
The argv argument is an array of character pointers to null-terminated strings. These strings constitute the argument list available to the new process image. By convention, argv must have at least one member, and it should point to a string that is the same as path (or its last component). The argv argument is terminated by a null pointer.
The envp argument is an array of character pointers to null-terminated strings. These strings constitute the environment for the new process image. The envp argument is terminated by a null pointer. For execl(), execv(), execvp(), and execlp(), the C run-time start-off routine places a pointer to the environment of the calling process in the global object
and it is used to pass the environment of the calling process to the new process.
The path argument points to a path name that identifies the new process file.
The file argument points to the new process file. If file does not contain a slash character, the path prefix for this file is obtained by a search of the directories passed in the PATH environment variable (see environ.5 The environment is supplied typically by the shell. If the new process file is not an executable object file, execlp() and execvp() use the contents of that file as standard input to the shell. In a standard-conforming application (see standards.5 the exec family of functions use /usr/bin/ksh (see ksh.1 otherwise, they use /usr/bin/sh (see sh.1
File descriptors open in the calling process remain open in the new process, except for those whose close-on-exec flag is set; (see fcntl.2 For those file descriptors that remain open, the file pointer is unchanged.
Signals that are being caught by the calling process are set to the default disposition in the new process image (see signal.3c Otherwise, the new process image inherits the signal dispositions of the calling process.
The saved resource limits in the new process image are set to be a copy of the process' corresponding hard and soft resource limits.
If the set-user-ID mode bit of the new process file is set (see chmod.2 the effective user ID of the new process is set to the owner ID of the new process file. Similarly, if the set-group-ID mode bit of the new process file is set, the effective group ID of the new process is set to the group ID of the new process file. The real user ID and real group ID of the new process remain the same as those of the calling process.
If the effective user-ID is root or super-user, the set-user-ID and set-group-ID bits will be honored when the process is being controlled by ptrace.
The shared memory segments attached to the calling process will not be attached to the new process (see shmop.2 Memory mappings in the calling process are unmapped before the new process begins execution (see mmap.2
Profiling is disabled for the new process; see profil.2
Timers created by timer_create.3r are deleted before the new process begins execution.
Any outstanding asynchronous I/O operations may be cancelled.
The new process also inherits the following attributes from the calling process:
nice value (see nice.2
scheduler class and priority (see priocntl.2
process ID
parent process ID
process group ID
supplementary group IDs
semadj values (see semop.2
session ID (see exit.2 and signal.3c
trace flag (see ptrace.2 request 0)
time left until an alarm (see alarm.2
current working directory
root directory
file mode creation mask (see umask.2
resource limits (see getrlimit.2
utime, stime, cutime, and cstime (see times.2
file-locks (see fcntl.2 and lockf.3c
controlling terminal
process signal mask (see sigprocmask.2
pending signals (see sigpending.2
Upon successful completion, each of the functions in the exec family marks for update the st_atime field of the file, unless the file is on a read-only file system. Should the function succeed, the process image file is considered to have been opened by the open.2 system called. The corresponding close() is considered to occur at a time after this open, but before process termination or successful completion of a subsequent call to one of the functions in the exec family.
+---------------+---------------------------------------------+ |ATTRIBUTE TYPE | ATTRIBUTE VALUE | +---------------+---------------------------------------------+ |MT-Level | execle() and execve() are Async-Signal-Safe | +---------------+---------------------------------------------+
|
|
Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 07/October/97