Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought



EXECVE(3spp)        RISC/os Reference Manual         EXECVE(3spp)



NAME
     execve, rexecve - execute a file

SYNOPSIS
     int execve(name, argv, envp)
     char *name, *argv[], *envp[];

DESCRIPTION
     Execve transforms the calling process into a new process.
     The new process is constructed from an ordinary file called
     the new process file.  This file must be an executable
     object file.  An executable object file consists of an iden-
     tifying header, followed by pages of data representing the
     initial program (text) and initialized data pages.  Addi-
     tional pages can be specified by the header to be initial-
     ized with zero data.  See a.out(5).

     There can be no return from a successful execve because the
     calling core image can have been lost.  When a program
     invoked via execve exits, control is returned to the moni-
     tor.

     The argument argv is a null-terminated array of character
     pointers to null-terminated character strings.  These
     strings constitute the argument list to be made available to
     the new process.  By convention, at least one argument must
     be present in this array, and the first element of this
     array should be the name of the executed program (i.e., the
     last component of name).

     The argument envp is also a null-terminated array of charac-
     ter pointers to null-terminated strings.  These strings pass
     information to the new process, which is not directly an
     argument to the command (see environ(7)).

     When the executed program begins, it is called as follows:

          main(argc, argv, envp)
          int argc;
          char **argv, **envp;

     where argc is the number of elements in argv (the ``arg
     count'') and argv is the array of character pointers to the
     arguments themselves.

     envp is a pointer to an array of strings that constitute the
     environment of the process.  A pointer to this array is also
     stored in the global variable ``environ''.  Each string con-
     sists of a name, an "=", and a null-terminated value.  The
     array of pointers is terminated by a null pointer.  The
     shell sh(1) passes an environment entry for each global
     shell variable defined when the program is called.  See



                         Printed 1/6/92                    Page 1





EXECVE(3spp)        RISC/os Reference Manual         EXECVE(3spp)



     environ(7) for some conventionally used names.

RETURN VALUE
     If execve returns to the calling process an error has
     occurred; the return value will be -1 and the global vari-
     able errno will contain an error code.  Rexecve will return
     -1 if the new process image could not be loaded and the glo-
     bal variable errno will contain an error code; otherwise,
     rexecve will return the exit code of the called program.














































 Page 2                  Printed 1/6/92



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026