.pa 1
.he 'EXEC (II)'3/15/72'EXEC (II)'
.ti 0
NAME		exec  --  execute a file
.sp
.ti 0
SYNOPSIS	sys exec; name; args  / exec = 11.
.br
.li
...
.ti -6
name: <...\\0>
.br
.li
...
.ti -6
args: arg1; arg2; ...; 0
.ti -6
arg1: <...\\0>
.br
.li
...
.sp
.ti 0
DESCRIPTION	exec____
overlays the calling process with the named file, then
transfers to the
beginning of the core image of the file.
The first argument to exec____ is a pointer to the name of the file
to be executed.
The second is the address of a list of pointers to
arguments to be passed to the file.
Conventionally, the first argument is the name of the
file.
Each pointer addresses a string terminated by a null byte.
.sp
There can be no return from the file; the calling core image
is lost.

The program break is set from the executed file; see the format
of a.out.

Once the called file starts execution, the arguments are available
as follows.
The stack pointer points to a word containing the number of arguments.  Just above
this number is a list of pointers to the argument strings.

  sp->	nargs
	arg1
	...
	argn

 arg1:	<arg1\\0>
	...
 argn:	<argn\\0>

The arguments are placed as high as possible in core:
just below 57000(8).

Files remain open across
exec____ calls.  However, the illegal instruction, emt___, quit, and interrupt trap
specifications are reset to the standard values.
(See ilgins______, cemt____, quit____, intr____.)

Each user has a real____ user ID and an effective_________ user ID
(The real ID identifies the person using the system;
the effective ID determines his access privileges.)
exec____ changes the effective user ID to
the owner of the executed file if the file has the "set-user-ID"
mode.  The real user ID is not affected.
.sp
.ti 0
SEE ALSO	fork(II)
.sp
.ti 0
DIAGNOSTICS	If
the file cannot be read or if it is not executable, a return
from exec____ constitutes the diagnostic.
The error bit (c-bit) is set.
.sp
.ti 0
BUGS		Very high core and
very low core are used by exec____
to construct the argument list
for the new core image.
If the original copies of the
arguments reside in these places,
problems can result.
