V1/man/man2/exec.2

Compare this file to the similar file:
Show the results in this format:

       11/3/71                                                   SYS 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.
                    Conventionally, 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 arguments are
                    passed as follows. The stack pointer points to 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 incore: just
                    below 60000(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,
                    intr).

                    Each user has a real user ID and an effective (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.
        11/3/71                                                SYS EXEC (II)


FILES

SEE ALSO          fork

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.

BUGS
OWNER             ken, dmr