From 78e51a8c6678b6e3dff3d619aa786669f531f4bc Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 14 Jan 2005 03:45:44 +0000 Subject: checkpoint --- man/man3/exec.html | 146 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 man/man3/exec.html (limited to 'man/man3/exec.html') diff --git a/man/man3/exec.html b/man/man3/exec.html new file mode 100644 index 00000000..e5397352 --- /dev/null +++ b/man/man3/exec.html @@ -0,0 +1,146 @@ + +exec(3) - Plan 9 from User Space + + + + +
+
+
EXEC(3)EXEC(3) +
+
+

NAME
+ +
+ + exec, execl – execute a file
+ +
+

SYNOPSIS
+ +
+ + #include <u.h>
+ #include <libc.h> +
+
+ int exec(char *name, char* argv[])
+ +
+
+ int execl(char *name, ...)
+
+
+

DESCRIPTION
+ +
+ + Exec and execl overlay the calling process with the named file, + then transfer to the entry point of the image of the file. +
+ + Name points to the name of the file to be executed; it must not + be a directory, and the permissions must allow the current user + to execute it (see stat(3)). It should also be a valid binary + image, as defined by the local operating system, or a shell script + (see rc(1)). The first line of a shell script must begin with + #! followed + by the name of the program to interpret the file and any initial + arguments to that program, for example
+ +
+ + #!/bin/rc
+ ls | mc
+ +
+
+ +
+ When a C program is executed, it is called as follows:
+ +
+ + void main(int argc, char *argv[])
+ +
+
+ +
+ Argv is a copy of the array of argument pointers passed to exec; + that array must end in a null pointer, and argc is the number + of elements before the null pointer. By convention, the first + argument should be the name of the program to be executed. Execl + is like exec except that argv will be an array of the parameters + that follow name in the call. The last argument to execl must + be a null pointer. +
+ + For a file beginning #!, the arguments passed to the program (/bin/rc + in the example above) will be the name of the file being executed, + any arguments on the #! line, the name of the file again, and + finally the second and subsequent arguments given to the original + exec call. The result honors the two conventions + of a program accepting as argument a file to be interpreted and + argv[0] naming the file being executed. +
+ + Most attributes of the calling process are carried into the result; + in particular, files remain open across exec (except those opened + with OCEXEC OR’d into the open mode; see open(3)); and the working + directory and environment (see getenv(3)) remain the same. However, + a newly exec’ed process has no notification + handlers (see notify(3)).
+ +
+

SOURCE
+ +
+ + /usr/local/plan9/src/lib9/exec.c
+ /usr/local/plan9/src/lib9/execl.c
+
+
+

SEE ALSO
+ +
+ + prof(1), intro(3), stat(3)
+ +
+

DIAGNOSTICS
+ +
+ + If these functions fail, they return and set errstr. There can + be no return from a successful exec or execl; the calling image + is lost.
+ +
+

BUGS
+ +
+ + On Unix, unlike on Plan 9, exec and execl use the user’s current + path to locate prog. This is a clumsy way to deal with Unix’s + lack of a union directory for /bin. +
+ + To avoid name conflicts with the underlying system, exec and execl + are preprocessor macros defined as p9exec and p9execl; see intro(3).
+ +
+ +

+
+
+ + +
+
+
+Space Glenda +
+
+ + -- cgit v1.2.3