3 exec, execl, _clock, _privates, _nprivates \- execute a file
11 int exec(char *name, char* argv[])
14 int execl(char *name, ...)
29 overlay the calling process with the named file, then
30 transfer to the entry point of the image of the file.
33 points to the name of the file
34 to be executed; it must not be a directory, and the permissions
35 must allow the current user to execute it
38 It should also be a valid binary image, as defined in the
40 for the current machine architecture,
45 shell script must begin with
47 followed by the name of the program to interpret the file
48 and any initial arguments to that program, for example
55 When a C program is executed,
56 it is called as follows:
59 void main(int argc, char *argv[])
63 is a copy of the array of argument pointers passed to
65 that array must end in a null pointer, and
67 is the number of elements before the null pointer.
68 By convention, the first argument should be the name of
69 the program to be executed.
75 will be an array of the parameters that follow
77 in the call. The last argument to
79 must be a null pointer.
83 the arguments passed to the program
85 in the example above) will be the name of the file being
86 executed, any arguments on the
88 line, the name of the file again,
89 and finally the second and subsequent arguments given to the original
92 The result honors the two conventions of a program accepting as argument
93 a file to be interpreted and
98 Most attributes of the calling process are carried
99 into the result; in particular,
100 files remain open across
102 (except those opened with
105 into the open mode; see
107 and the working directory and environment
113 process has no notification handler
117 When the new program begins, the global cell
119 is set to the address of a cell that keeps approximate time
120 expended by the process at user level.
121 The time is measured in milliseconds but is updated at
122 a system-dependent lower rate.
123 This clock is typically used by the profiler but is available
128 points to an array of
130 elements of per-process private data.
131 This storage is private for each process, even if the processes share data segments.
133 The above conventions apply to C programs; the raw system
134 interface to the new image is as follows:
135 the word pointed to by the stack pointer is
137 the words beyond that are the zeroth and subsequent elements
140 followed by a terminating null pointer; and
141 the return register (e.g.
143 on the 68020) contains the address of the clock.
145 .B /sys/src/libc/9syscall
147 .B /sys/src/libc/port/execl.c
153 If these functions fail, they return and set
155 There can be no return from a successful
159 the calling image is lost.