VMS Help  —  CRTL  execl
    Passes the name of an image to be activated in a child process.
    This function is nonreentrant.

    Format

      #include  <unistd.h>

      int execl  (const char *file_spec, const char *arg0, . . . ,
                 (char *)0); (ISO POSIX-1)

      int execl  (char *file_spec, . . . ); (Compatibility)

1  –  Arguments

 file_spec

    The full file specification of a new image to be activated in the
    child process.

 arg0, ...

    A sequence of pointers to null-terminated character strings.

    If the POSIX-1 format is used, at least one argument must be
    present and must point to a string that is the same as the new
    process filename (or its last component). (This pointer can also
    be the NULL pointer, but then execle would accomplish nothing.)
    The last pointer must be the NULL pointer. This is also the
    convention if the compatibility format is used.

2  –  Description

    To understand how the exec functions operate, consider how
    the OpenVMS system calls any VSI C program, as shown in the
    following syntax:

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

    The identifier argc is the argument count; argv is an array
    of argument strings. The first member of the array (argv[0])
    contains the name of the image. The arguments are placed in
    subsequent elements of the array. The last element of the array
    is always the NULL pointer.

    An exec function calls a child process in the same way that
    the run-time system calls any other VSI C program. The exec
    functions pass the name of the image to be activated in the
    child; this value is placed in argv[0]. However, the functions
    differ in the way they pass arguments and environment information
    to the child:

    o  Arguments can be passed in separate character strings (execl,
       execle, and execlp) or in an array of character strings
       (execv, execve, and execvp).

    o  The environment can be explicitly passed in an array (execle
       and execve) or taken from the parent's environment (execl,
       execv, execlp, and execvp).

    If vfork was called before invoking an exec function, then when
    the exec function completes, control is returned to the parent
    process at the point of the vfork call. If vfork was not called,
    the exec function waits until the child has completed execution
    and then exits the parent process. See vfork.

3  –  Return Value

    -1                 Indicates failure.
Close Help