exec http://www.opengroup.org/onlinepubs/007908799/xsh/exec.html
The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group
NAME
environ, execl, execv, execle, execve, execlp, execvp - execute a file
SYNOPSIS
#include <unistd.h>
extern char **environ;
int execl(const char *path, const char *arg0, ... /*, (char *)0 */);
int execv(const char *path, char *const argv[]);
int execle(const char *path,
const char *arg0, ... /*, (char *)0, char *const envp[]*/);
int execve(const char *path, char *const char *const
argv[], envp[]);
int execlp(const char *file, const char *arg0, ... /*, (char *)0 */);
int execvp(const char *file, char *const argv[]);
DESCRIPTION
The exec functions replace the current process image with a new process image. The new
image is constructed from a regular, executable file called the new process image file. There
is no return from a successful exec, because the calling process image is overlaid by the new
process image.
When a C-language program is executed as a result of this call, it is entered as a C-language
function call as follows:
int main (int argc, char *argv[]);
where argc is the argument count and argv is an array of character pointers to the arguments
themselves. In addition, the following variable:
extern char **environ;
is initialised as a pointer to an array of character pointers to the environment strings. The argv
and environ arrays are each terminated by a null pointer. The null pointer terminating the
argv array is not counted in argc.
Conforming multi-threaded applications will not use the environ variable to access or modify
any environment variable while any other thread is concurrently modifying any environment
variable. A call to any function dependent on any environment variable is considered a use of
the environ variable to access that environment variable.
The arguments specified by a program with one of the exec functions are passed on to the
new process image in the corresponding main() arguments.
The argument path points to a pathname that identifies the new process image file.
The argument file is used to construct a pathname that identifies the new process image file.
1 di 6 12/05/2010 14:40
exec http://www.opengroup.org/onlinepubs/007908799/xsh/exec.html
If the file argument contains a slash character, the file argument is used as the pathname for
this file. Otherwise, the path prefix for this file is obtained by a search of the directories
passed as the environment variable (see specification, ). If this
XBD Environment Variables
environment variable is not present, the results of the search are implementation-dependent.
execlp() and execvp() use the
If the process image file is not a valid executable object,
contents of that file as standard input to a command interpreter conforming to system(). In
this case, the command interpreter becomes the new process image.
The arguments represented by arg0, ... are pointers to null-terminated character strings. These
strings constitute the argument list available to the new process image. The list is terminated
by a null pointer. The argument arg0 should point to a filename that is associated with the
process being started by one of the exec functions.
The argument argv is an array of character pointers to null-terminated strings. The last
member of this array must be a null pointer. These strings constitute the
-
Sistemi operativi - Syscall fork
-
Sistemi operativi - Syscall fprintf
-
Sistemi operativi - Syscall memcpy
-
Sistemi operativi - Syscall msgsnd