EXEC (II) 3/15/72 EXEC (II) NAME exec -- execute a file SYNOPSIS sys exec; name; args / exec = 11. ... name: <...\0> ... args: arg1; arg2; ...; 0 arg1: <...\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. Conven- tionally, the first argument is the name of the file. Each pointer addresses a string terminated by a null byte. 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 argu- ments 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 ac- cess 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. SEE ALSO fork(II) DIAGNOSTICS If the file cannot be read or if it is not exe- cutable, a return from exec constitutes the diag- nostic. The error bit (c-bit) is set. 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.