AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox

01.01.2013 Views

·� '·-

EXEC (2) EXEC (2) NAME execl, execv, execle, execve, execlp, execvp - execute a file SYNOPSIS int execl (path, argO, argl, ••• , argo, 0) char •path, •argO, •argl, ••• , •argo; int execv (path, argv) char *path, •argv[ ]; int execle (path, argO, argl, ••• , argo, 0, envp) char •path, •argO, •argl, ••• , •argo, •envp[ ]; int execve (path, argv, envp) char •path, •argv[ ], •envp[ ]; int execlp (file, argO, argl, ••• , argo, 0) char •file, •argO, •argl, ••• , •argo; int execvp (file, argv) char •file, •argv[ ]; DESCRIPTION Exec in all its forms transforms the calling process into a new process. The new process is constructed from an ordinary, executable file called the new process file . This file consists of a header (see a. out( 4)), a text segment, and a data segment. The data segment contains an initialized portion and an uninitialized portion (bss). There can be no return from a successful exec because the calling process is overlaid by the new process. When a C program is executed, it is called as follows: main (argc, argv, envp) int argc; char ••argv, ••envp; where argc is the argument count and argv is an array of character pointers to the arguments themselves. As indicated, argc is conventionally at least one and the first member of the array points to a string containing the name of the file. Path points to a path name that identifies the new process file. File points to the new process file. The path prefix for this file is obtained by a search of the directories passed as the environment line "PATH =" (see environ(5)). The environment is supplied by the shell (see sh(l)). ArgO, arg1 , ... , argn are pointers to null-terminated character strings. These strings constitute the argument list available to the new process. By convention, at least argO must be present and point to a string that is the same as path (or its last component). Argv is an array of character pointers to null-terminated strings. These strings constitute the argument list available to the new process. By convention, argv must have at least one member, and it must point to a string that is the same as path (or its last component). Argv is terminated by a null pointer. - 1-

EXEC (2) EXEC (2)<br />

NAME execl, execv, execle, execve, execlp, execvp - execute a file<br />

SYNOPSIS<br />

int execl (path, argO, argl, ••• , argo, 0)<br />

char •path, •argO, •argl, ••• , •argo;<br />

int execv (path, argv)<br />

char *path, •argv[ ];<br />

int execle (path, argO, argl, ••• , argo, 0, envp)<br />

char •path, •argO, •argl, ••• , •argo, •envp[ ];<br />

int execve (path, argv, envp)<br />

char •path, •argv[ ], •envp[ ];<br />

int execlp (file, argO, argl, ••• , argo, 0)<br />

char •file, •argO, •argl, ••• , •argo;<br />

int execvp (file, argv)<br />

char •file, •argv[ ];<br />

DESCRIPTION<br />

Exec in all its forms transforms the calling process into a new process.<br />

The new process is constructed from an ordinary, executable<br />

file called the new process file . This file consists of a header (see<br />

a. out( 4)), a text segment, and a data segment. The data segment<br />

contains an initialized portion and an uninitialized portion (bss).<br />

There can be no return from a successful exec because the calling<br />

process is overlaid by the new process.<br />

When a C program is executed, it is called as follows:<br />

main (argc, argv, envp)<br />

int argc;<br />

char ••argv, ••envp;<br />

where argc is the argument count and argv is an array of character<br />

pointers to the arguments themselves. As indicated, argc is<br />

conventionally at least one and the first member of the array<br />

points to a string containing the name of the file.<br />

Path points to a path name that identifies the new process file.<br />

File points to the new process file. The path prefix for this file is<br />

obtained by a search of the directories passed as the environment<br />

line "PATH =" (see environ(5)). The environment is supplied by<br />

the shell (see sh(l)).<br />

ArgO, arg1 , ... , argn are pointers to null-terminated character<br />

strings. These strings constitute the argument list available to the<br />

new process. By convention, at least argO must be present and<br />

point to a string that is the same as path (or its last component).<br />

Argv is an array of character pointers to null-terminated strings.<br />

These strings constitute the argument list available to the new<br />

process. By convention, argv must have at least one member, and<br />

it must point to a string that is the same as path (or its last component).<br />

Argv is terminated by a null pointer.<br />

- 1-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!