Print this page
5798 fexecve() needed per POSIX 2008

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man2/exec.2.man.txt
          +++ new/usr/src/man/man2/exec.2.man.txt
   1    1  EXEC(2)                          System Calls                          EXEC(2)
   2    2  
   3      -
   4      -
   5    3  NAME
   6      -       exec, execl, execle, execlp, execv, execve, execvp - execute a file
        4 +     exec, execl, execle, execlp, execv, execve, execvp, fexecve  execute a
        5 +     file
   7    6  
   8    7  SYNOPSIS
   9      -       #include <unistd.h>
        8 +     #include <unistd.h>
  10    9  
  11      -       int execl(const char *path, const char *arg0, ...
  12      -            /* const char *argn, (char *)0 */);
       10 +     int
       11 +     execl(const char *path, const char *arg0, ... /* const char *argn, (char *)0 */);
  13   12  
       13 +     int
       14 +     execv(const char *path, char *const argv[]);
  14   15  
  15      -       int execv(const char *path, char *const argv[]);
       16 +     int
       17 +     execle(const char *path, const char *arg0,
       18 +         ... /* const char *argn, (char *)0, char *const envp[] */);
  16   19  
       20 +     int
       21 +     execve(const char *path, char *const argv[], char *const envp[]);
  17   22  
  18      -       int execle(const char *path, const char *arg0, ...
  19      -            /* const char *argn, (char *)0,char *const envp[]*/);
       23 +     int
       24 +     execlp(const char *file, const char *arg0, ... /* const char *argn, (char *)0 */);
  20   25  
       26 +     int
       27 +     execvp(const char *file, char *const argv[]);
  21   28  
  22      -       int execve(const char *path, char *const argv[],
  23      -            char *const envp[]);
       29 +     int
       30 +     fexecve(int fd, char *const argv[], char *const envp[]);
  24   31  
  25      -
  26      -       int execlp(const char *file, const char *arg0, ...
  27      -            /* const char *argn, (char *)0 */);
  28      -
  29      -
  30      -       int execvp(const char *file, char *const argv[]);
  31      -
  32      -
  33   32  DESCRIPTION
  34      -       Each of the functions in the exec family replaces the current process
  35      -       image with a new process image. The new image is constructed from a
  36      -       regular, executable file called the new process image file. This file
  37      -       is either an executable object file or a file of data for an
  38      -       interpreter. There is no return from a successful call to one of these
  39      -       functions because the calling process image is overlaid by the new
  40      -       process image.
       33 +     Each of the functions in the exec family replaces the current process
       34 +     image with a new process image.  The new image is constructed from a
       35 +     regular, executable file called the new process image file.  This file is
       36 +     either an executable object file or a file of data for an interpreter.
       37 +     There is no return from a successful call to one of these functions
       38 +     because the calling process image is overlaid by the new process image.
  41   39  
       40 +     An interpreter file begins with a line of the form
  42   41  
  43      -       An interpreter file begins with a line of the form
       42 +           #! pathname [arg]
  44   43  
  45      -         #! pathname [arg]
       44 +     where pathname is the path of the interpreter, and arg is an optional
       45 +     argument.  When an interpreter file is executed, the system invokes the
       46 +     specified interpreter.  The pathname specified in the interpreter file is
       47 +     passed as arg0 to the interpreter.  If arg was specified in the
       48 +     interpreter file, it is passed as arg1 to the interpreter.  The remaining
       49 +     arguments to the interpreter are arg0 through argn of the originally
       50 +     exec'd file.  The interpreter named by pathname must not be an
       51 +     interpreter file.
  46   52  
       53 +     When a C-language program is executed as a result of this call, it is
       54 +     entered as a C-language function call as follows:
  47   55  
       56 +           int main(int argc, char *argv[])
  48   57  
  49      -       where pathname is the path of the interpreter, and arg is an optional
  50      -       argument. When an interpreter file is executed, the system invokes the
  51      -       specified interpreter. The pathname specified in the interpreter file
  52      -       is passed as arg0 to the interpreter. If arg was specified in the
  53      -       interpreter file, it is passed as arg1 to the interpreter. The
  54      -       remaining arguments to the interpreter are arg0 through argn of the
  55      -       originally exec'd file. The interpreter named by pathname must not be
  56      -       an interpreter file.
       58 +     where argc is the argument count and argv is an array of character
       59 +     pointers to the arguments themselves.  In addition, the following
       60 +     variable:
  57   61  
       62 +           extern char **environ;
  58   63  
  59      -       When a C-language program is executed as a result of this call, it is
  60      -       entered as a C-language function call as follows:
       64 +     is initialized as a pointer to an array of character pointers to the
       65 +     environment strings.  The argv and environ arrays are each terminated by
       66 +     a null pointer.  The null pointer terminating the argv array is not
       67 +     counted in argc.
  61   68  
  62      -         int main (int argc, char *argv[]);
       69 +     The value of argc is non-negative, and if greater than 0, argv[0] points
       70 +     to a string containing the name of the file.  If argc is 0, argv[0] is a
       71 +     null pointer, in which case there are no arguments.  Applications should
       72 +     verify that argc is greater than 0 or that argv[0] is not a null pointer
       73 +     before dereferencing argv[0].
  63   74  
       75 +     The arguments specified by a program with one of the exec functions are
       76 +     passed on to the new process image in the Fn main arguments.
  64   77  
       78 +     The path argument points to a path name that identifies the new process
       79 +     image file.
  65   80  
  66      -       where argc is the argument count and argv is an array of character
  67      -       pointers to the arguments themselves. In addition, the following
  68      -       variable:
       81 +     The file argument is used to construct a pathname that identifies the new
       82 +     process image file.  If the file argument contains a slash character, it
       83 +     is used as the pathname for this file.  Otherwise, the path prefix for
       84 +     this file is obtained by a search of the directories passed in the PATH
       85 +     environment variable.  See environ(5).  The environment is supplied
       86 +     typically by the shell.  If the process image file is not a valid
       87 +     executable object file, execlp() and execvp() use the contents of that
       88 +     file as standard input to the shell.  In this case, the shell becomes the
       89 +     new process image.  The standard to which the caller conforms determines
       90 +     which shell is used.  See standards(5).
  69   91  
  70      -         extern char **environ;
       92 +     The fexecve() function is equivalent to execve(), except that instead of
       93 +     using a named file, the file referenced by the file descriptor fd is
       94 +     used.  Note that this file descriptor must reference a regular file and
       95 +     must have been opened for execute (with Dv O_EXEC , defined in
       96 +     <fcntl.h>.) The image is loaded from offset zero of the file, regardless
       97 +     of the offset of fd.
  71   98  
       99 +     The arguments represented by arg0... are pointers to null-terminated
      100 +     character strings.  These strings constitute the argument list available
      101 +     to the new process image.  The list is terminated by a null pointer.  The
      102 +     arg0 argument should point to a filename that is associated with the
      103 +     process being started by one of the exec functions.
  72  104  
      105 +     The argv argument is an array of character pointers to null-terminated
      106 +     strings.  The last member of this array must be a null pointer.  These
      107 +     strings constitute the argument list available to the new process image.
      108 +     The value in argv[0] should point to a filename that is associated with
      109 +     the process being started by one of the exec functions.
  73  110  
  74      -       is initialized as a pointer to an array of character pointers to the
  75      -       environment strings. The argv and environ arrays are each terminated by
  76      -       a null pointer. The null pointer terminating the argv array is not
  77      -       counted in argc.
      111 +     The envp argument is an array of character pointers to null-terminated
      112 +     strings.  These strings constitute the environment for the new process
      113 +     image.  The envp array is terminated by a null pointer.  For execl(),
      114 +     execv(), execvp(), and execlp(), the C-language run-time start-off routine
      115 +     places a pointer to the environment of the calling process in the global
      116 +     object environ, and it is used to pass the environment of the calling
      117 +     process to the new process image.
  78  118  
      119 +     The number of bytes available for the new process's combined argument and
      120 +     environment lists is ARG_MAX.  It is implementation-dependent whether null
      121 +     terminators, pointers, and/or any alignment bytes are included in this
      122 +     total.
  79  123  
  80      -       The value of argc is non-negative, and if greater than 0, argv[0] points
  81      -       to a string containing the name of the file. If argc is 0, argv[0] is a
  82      -       null pointer, in which case there are no arguments.  Applications
  83      -       should verify that argc is greater than 0 or that argv[0] is not a null
  84      -       pointer before dereferencing argv[0].
      124 +     File descriptors open in the calling process image remain open in the new
      125 +     process image, except for those whose close-on-exec flag FD_CLOEXEC is set;
      126 +     see fcntl(2).  For those file descriptors that remain open, all
      127 +     attributes of the open file description, including file locks, remain
      128 +     unchanged.
  85  129  
      130 +     The preferred hardware address translation size (see memcntl(2)) for the
      131 +     stack and heap of the new process image are set to the default system
      132 +     page size.
  86  133  
  87      -       The arguments specified by a program with one of the exec functions are
  88      -       passed on to the new process image in the main() arguments.
      134 +     Directory streams open in the calling process image are closed in the new
      135 +     process image.
  89  136  
      137 +     The state of conversion descriptors and message catalogue descriptors in
      138 +     the new process image is undefined. For the new process, the equivalent
      139 +     of:
  90  140  
  91      -       The path argument points to a path name that identifies the new process
  92      -       image file.
      141 +           setlocale(LC_ALL, "C");
  93  142  
      143 +     is executed at startup.
  94  144  
  95      -       The file argument is used to construct a pathname that identifies the
  96      -       new process image file. If the file argument contains a slash
  97      -       character, it is used as the pathname for this file. Otherwise, the
  98      -       path prefix for this file is obtained by a search of the directories
  99      -       passed in the PATH environment variable (see environ(5)). The
 100      -       environment is supplied typically by the shell. If the process image
 101      -       file is not a valid executable object file, execlp() and execvp() use
 102      -       the contents of that file as standard input to the shell. In this case,
 103      -       the shell becomes the new process image. The standard to which the
 104      -       caller conforms determines which shell is used. See standards(5).
      145 +     Signals set to the default action (BSIG_DFL) in the calling process image
      146 +     are set to the default action in the new process image (see signal(3C)).
      147 +     Signals set to be ignored (SIG_IGN) by the calling process image are set
      148 +     to be ignored by the new process image.  Signals set to be caught by the
      149 +     calling process image are set to the default action in the new process
      150 +     image (see signal.h(3HEAD)).  After a successful call to any of the exec
      151 +     functions, alternate signal stacks are not preserved and the SA_ONSTACK
      152 +     flag is cleared for all signals.
 105  153  
      154 +     After a successful call to any of the exec functions, any functions
      155 +     previously registered by atexit(3C) are no longer registered.
 106  156  
 107      -       The arguments represented by arg0... are pointers to null-terminated
 108      -       character strings. These strings constitute the argument list available
 109      -       to the new process image. The list is terminated by a null pointer.
 110      -       The arg0 argument should point to a filename that is associated with
 111      -       the process being started by one of the exec functions.
      157 +     The saved resource limits in the new process image are set to be a copy
      158 +     of the process's corresponding hard and soft resource limits.
 112  159  
      160 +     If the ST_NOSUID bit is set for the file system containing the new
      161 +     process image file, then the effective user ID and effective group ID are
      162 +     unchanged in the new process image.  If the set-user-ID mode bit of the new
      163 +     process image file is set (see chmod(2)), the effective user ID of the
      164 +     new process image is set to the owner ID of the new process image file.
      165 +     Similarly, if the set-group-ID mode bit of the new process image file is
      166 +     set, the effective group ID of the new process image is set to the group
      167 +     ID of the new process image file.  The real user ID and real group ID of
      168 +     the new process image remain the same as those of the calling process
      169 +     image.  The effective user ID and effective group ID of the new process
      170 +     image are saved (as the saved set-user-ID and the saved set-group-ID for use
      171 +     by setuid(2)).
 113  172  
 114      -       The argv argument is an array of character pointers to null-terminated
 115      -       strings. The last member of this array must be a null pointer. These
 116      -       strings constitute the argument list available to the new process
 117      -       image. The value in argv[0] should point to a filename that is
 118      -       associated with the process being started by one of the exec functions.
      173 +     The privilege sets are changed according to the following rules:
 119  174  
      175 +     1.   The inheritable set, I, is intersected with the limit set, L.  This
      176 +          mechanism enforces the limit set for processes.
 120  177  
 121      -       The envp argument is an array of character pointers to null-terminated
 122      -       strings. These strings constitute the environment for the new process
 123      -       image.  The envp array is terminated by a null pointer. For execl(),
 124      -       execv(), execvp(), and execlp(), the C-language run-time start-off routine
 125      -       places a pointer to the environment of the calling process in the
 126      -       global object extern char **environ, and it is used to pass the
 127      -       environment of the calling process to the new process image.
      178 +     2.   The effective set, E, and the permitted set, P, are made equal to
      179 +          the new inheritable set.
 128  180  
      181 +     The system attempts to set the privilege-aware state to non-PA both before
      182 +     performing any modifications to the process IDs and privilege sets as
      183 +     well as after completing the transition to new UIDs and privilege sets,
      184 +     following the rules outlined in privileges(5).
 129  185  
 130      -       The number of bytes available for the new process's combined argument
 131      -       and environment lists is ARG_MAX. It is implementation-dependent whether
 132      -       null terminators, pointers, and/or any alignment bytes are included in
 133      -       this total.
      186 +     If the {PRIV_PROC_OWNER} privilege is asserted in the effective set, the
      187 +     set-user-ID and set-group-ID bits will be honored when the process is being
      188 +     controlled by ptrace(3C).  Additional restrictions can apply when the
      189 +     traced process has an effective UID of 0.  See privileges(5).
 134  190  
      191 +     Any shared memory segments attached to the calling process image will not
      192 +     be attached to the new process image (see shmop(2)).  Any mappings
      193 +     established through mmap(2) are not preserved across an exec.  Memory
      194 +     mappings created in the process are unmapped before the address space is
      195 +     rebuilt for the new process image.  See mmap(2).
 135  196  
 136      -       File descriptors open in the calling process image remain open in the
 137      -       new process image, except for those whose close-on-exec flag FD_CLOEXEC
 138      -       is set; see fcntl(2). For those file descriptors that remain open, all
 139      -       attributes of the open file description, including file locks, remain
 140      -       unchanged.
      197 +     Memory locks established by the calling process via calls to mlockall(3C)
      198 +     or mlock(3C) are removed.  If locked pages in the address space of the
      199 +     calling process are also mapped into the address spaces the locks
      200 +     established by the other processes will be unaffected by the call by this
      201 +     process to the exec function.  If the exec function fails, the effect on
      202 +     memory locks is unspecified.
 141  203  
      204 +     If _XOPEN_REALTIME is defined and has a value other than 1, any named
      205 +     semaphores open in the calling process are closed as if by appropriate
      206 +     calls to sem_close(3C).
 142  207  
 143      -       The preferred hardware address translation size (see memcntl(2)) for
 144      -       the stack and heap of the new process image are set to the default
 145      -       system page size.
      208 +     Profiling is disabled for the new process; see profil(2).
 146  209  
      210 +     Timers created by the calling process with timer_create(3C) are deleted
      211 +     before replacing the current process image with the new process image.
 147  212  
 148      -       Directory streams open in the calling process image are closed in the
 149      -       new process image.
      213 +     For the SCHED_FIFO and SCHED_RR scheduling policies, the policy and
      214 +     priority settings are not changed by a call to an exec function.
 150  215  
      216 +     All open message queue descriptors in the calling process are closed, as
      217 +     described in mq_close(3C).
 151  218  
 152      -       The state of conversion descriptors and message catalogue descriptors
 153      -       in the new process image is undefined. For the new process, the
 154      -       equivalent of:
      219 +     Any outstanding asynchronous I/O operations may be cancelled. Those
      220 +     asynchronous I/O operations that are not canceled will complete as if the
      221 +     exec function had not yet occurred, but any associated signal
      222 +     notifications are suppressed.  It is unspecified whether the exec
      223 +     function itself blocks awaiting such I/O completion.  In no event,
      224 +     however, will the new process image created by the exec function be
      225 +     affected by the presence of outstanding asynchronous I/O operations at
      226 +     the time the exec function is called.
 155  227  
 156      -         setlocale(LC_ALL, "C")
      228 +     All active contract templates are cleared (see contract(4)).
 157  229  
      230 +     The new process also inherits the following attributes from the calling
      231 +     process:
 158  232  
      233 +              controlling terminal
 159  234  
 160      -       is executed at startup.
      235 +              current working directory
 161  236  
      237 +              file-locks (see fcntl(2) and lockf(3C))
 162  238  
 163      -       Signals set to the default action (SIG_DFL) in the calling process
 164      -       image are set to the default action in the new process image (see
 165      -       signal(3C)).  Signals set to be ignored (SIG_IGN) by the calling
 166      -       process image are set to be ignored by the new process image. Signals
 167      -       set to be caught by the calling process image are set to the default
 168      -       action in the new process image (see signal.h(3HEAD)). After a
 169      -       successful call to any of the exec functions, alternate signal stacks
 170      -       are not preserved and the SA_ONSTACK flag is cleared for all signals.
      239 +              file mode creation mask (see umask(2))
 171  240  
      241 +              file size limit (see ulimit(2))
 172  242  
 173      -       After a successful call to any of the exec functions, any functions
 174      -       previously registered by atexit(3C) are no longer registered.
      243 +              limit privilege set
 175  244  
      245 +              nice value (see nice(2))
 176  246  
 177      -       The saved resource limits in the new process image are set to be a copy
 178      -       of the process's corresponding hard and soft resource limits.
      247 +              parent process ID
 179  248  
      249 +              pending signals (see sigpending(2))
 180  250  
 181      -       If the ST_NOSUID bit is set for the file system containing the new
 182      -       process image file, then the effective user ID and effective group ID
 183      -       are unchanged in the new process image. If the set-user-ID mode bit of
 184      -       the new process image file is set (see chmod(2)), the effective user ID
 185      -       of the new process image is set to the owner ID of the new process
 186      -       image file. Similarly, if the set-group-ID mode bit of the new process
 187      -       image file is set, the effective group ID of the new process image is
 188      -       set to the group ID of the new process image file. The real user ID and
 189      -       real group ID of the new process image remain the same as those of the
 190      -       calling process image. The effective user ID and effective group ID of
 191      -       the new process image are saved (as the saved set-user-ID and the saved
 192      -       set-group-ID for use by setuid(2).
      251 +              privilege debugging flag (see privileges(5) and getpflags(2))
 193  252  
      253 +              process ID
 194  254  
 195      -       The privilege sets are changed according to the following rules:
      255 +              process contract (see contract(4) and process(4))
 196  256  
 197      -           1.     The inheritable set, I, is intersected with the limit set,
 198      -                  L.  This mechanism enforces the limit set for processes.
      257 +              process group ID
 199  258  
 200      -           2.     The effective set, E, and the permitted set, P, are made
 201      -                  equal to the new inheritable set.
      259 +              process signal mask (see sigprocmask(2))
 202  260  
      261 +              processor bindings (see processor_bind(2))
 203  262  
 204      -       The system attempts to set the privilege-aware state to non-PA both
 205      -       before performing any modifications to the process IDs and privilege
 206      -       sets as well as after completing the transition to new UIDs and
 207      -       privilege sets, following the rules outlined in privileges(5).
      263 +              processor set bindings (see pset_bind(2))
 208  264  
      265 +              project ID
 209  266  
 210      -       If the {PRIV_PROC_OWNER} privilege is asserted in the effective set,
 211      -       the set-user-ID and set-group-ID bits will be honored when the process is
 212      -       being controlled by ptrace(3C). Additional restriction can apply when
 213      -       the traced process has an effective UID of 0. See privileges(5).
      267 +              real group ID
 214  268  
      269 +              real user ID
 215  270  
 216      -       Any shared memory segments attached to the calling process image will
 217      -       not be attached to the new process image (see shmop(2)). Any mappings
 218      -       established through mmap() are not preserved across an exec. Memory
 219      -       mappings created in the process are unmapped before the address space
 220      -       is rebuilt for the new process image. See mmap(2).
      271 +              resource limits (see getrlimit(2))
 221  272  
      273 +              root directory
 222  274  
 223      -       Memory locks established by the calling process via calls to
 224      -       mlockall(3C) or mlock(3C) are removed. If locked pages in the address
 225      -       space of the calling process are also mapped into the address spaces
 226      -       the locks established by the other processes will be unaffected by the
 227      -       call by this process to the exec function. If the exec function fails,
 228      -       the effect on memory locks is unspecified.
      275 +              scheduler class and priority (see priocntl(2))
 229  276  
      277 +              semadj values (see semop(2))
 230  278  
 231      -       If _XOPEN_REALTIME is defined and has a value other than 1, any named
 232      -       semaphores open in the calling process are closed as if by appropriate
 233      -       calls to sem_close(3C)
      279 +              session membership (see exit(2) and signal(3C))
 234  280  
      281 +              supplementary group IDs
 235  282  
 236      -       Profiling is disabled for the new process; see profil(2).
      283 +              task ID
 237  284  
      285 +              time left until an alarm clock signal (see alarm(2))
 238  286  
 239      -       Timers created by the calling process with timer_create(3C) are deleted
 240      -       before replacing the current process image with the new process image.
      287 +              tms_utime, tms_stime, tms_cutime, and tms_cstime (see times(2))
 241  288  
      289 +              trace flag (see ptrace(3C) request 0)
 242  290  
 243      -       For the SCHED_FIFO and SCHED_RR scheduling policies, the policy and
 244      -       priority settings are not changed by a call to an exec function.
      291 +     A call to any exec function from a process with more than one thread
      292 +     results in all threads being terminated and the new executable image
      293 +     being loaded and executed.  No destructor functions will be called.
 245  294  
      295 +     Upon successful completion, each of the functions in the exec family
      296 +     marks for update the st_atime field of the file.  If an exec function
      297 +     failed but was able to locate the process image file, whether the
      298 +     st_atime field is marked for update is unspecified.  Should the function
      299 +     succeed, the process image file is considered to have been opened with
      300 +     open(2).  The corresponding close(2) is considered to occur at a time
      301 +     after this open, but before process termination or successful completion
      302 +     of a subsequent call to one of the exec functions.  The argv and envp
      303 +     arrays of pointers and the strings to which those arrays point will not
      304 +     be modified by a call to one of the exec functions, except as a
      305 +     consequence of replacing the process image.
 246  306  
 247      -       All open message queue descriptors in the calling process are closed,
 248      -       as described in mq_close(3C).
      307 +     The saved resource limits in the new process image are set to be a copy
      308 +     of the process's corresponding hard and soft limits.
 249  309  
 250      -
 251      -       Any outstanding asynchronous I/O operations may be cancelled. Those
 252      -       asynchronous I/O operations that are not canceled will complete as if
 253      -       the exec function had not yet occurred, but any associated signal
 254      -       notifications are suppressed. It is unspecified whether the exec
 255      -       function itself blocks awaiting such I/O completion. In no event,
 256      -       however, will the new process image created by the exec function be
 257      -       affected by the presence of outstanding asynchronous I/O operations at
 258      -       the time the exec function is called.
 259      -
 260      -
 261      -       All active contract templates are cleared (see contract(4)).
 262      -
 263      -
 264      -       The new process also inherits the following attributes from the calling
 265      -       process:
 266      -
 267      -           o      controlling terminal
 268      -
 269      -           o      current working directory
 270      -
 271      -           o      file-locks (see fcntl(2) and lockf(3C))
 272      -
 273      -           o      file mode creation mask (see umask(2))
 274      -
 275      -           o      file size limit (see ulimit(2))
 276      -
 277      -           o      limit privilege set
 278      -
 279      -           o      nice value (see nice(2))
 280      -
 281      -           o      parent process ID
 282      -
 283      -           o      pending signals (see sigpending(2))
 284      -
 285      -           o      privilege debugging flag (see privileges(5) and
 286      -                  getpflags(2))
 287      -
 288      -           o      process ID
 289      -
 290      -           o      process contract (see contract(4) and process(4))
 291      -
 292      -           o      process group ID
 293      -
 294      -           o      process signal mask (see sigprocmask(2))
 295      -
 296      -           o      processor bindings (see processor_bind(2))
 297      -
 298      -           o      processor set bindings (see pset_bind(2))
 299      -
 300      -           o      project ID
 301      -
 302      -           o      real group ID
 303      -
 304      -           o      real user ID
 305      -
 306      -           o      resource limits (see getrlimit(2))
 307      -
 308      -           o      root directory
 309      -
 310      -           o      scheduler class and priority (see priocntl(2))
 311      -
 312      -           o      semadj values (see semop(2))
 313      -
 314      -           o      session membership (see exit(2) and signal(3C))
 315      -
 316      -           o      supplementary group IDs
 317      -
 318      -           o      task ID
 319      -
 320      -           o      time left until an alarm clock signal (see alarm(2))
 321      -
 322      -           o      tms_utime, tms_stime, tms_cutime, and tms_cstime (see
 323      -                  times(2))
 324      -
 325      -           o      trace flag (see ptrace(3C) request 0)
 326      -
 327      -
 328      -       A call to any exec function from a process with more than one thread
 329      -       results in all threads being terminated and the new executable image
 330      -       being loaded and executed. No destructor functions will be called.
 331      -
 332      -
 333      -       Upon successful completion, each of the functions in the exec family
 334      -       marks for update the st_atime field of the file.  If an exec function
 335      -       failed but was able to locate the process image file, whether the
 336      -       st_atime field is marked for update is unspecified. Should the function
 337      -       succeed, the process image file is considered to have been opened with
 338      -       open(2). The corresponding close(2) is considered to occur at a time
 339      -       after this open, but before process termination or successful
 340      -       completion of a subsequent call to one of the exec functions. The
 341      -       argv[] and envp[] arrays of pointers and the strings to which those
 342      -       arrays point will not be modified by a call to one of the exec
 343      -       functions, except as a consequence of replacing the process image.
 344      -
 345      -
 346      -       The saved resource limits in the new process image are set to be a copy
 347      -       of the process's corresponding hard and soft limits.
 348      -
 349  310  RETURN VALUES
 350      -       If a function in the exec family returns to the calling process image,
 351      -       an error has occurred; the return value is1 and errno is set to
 352      -       indicate the error.
      311 +     If a function in the exec family returns to the calling process image, an
      312 +     error has occurred; the return value is1 and errno is set to indicate
      313 +     the error.
 353  314  
 354  315  ERRORS
 355      -       The exec functions will fail if:
      316 +     The exec functions will fail if:
 356  317  
 357      -       E2BIG
 358      -                       The number of bytes in the new process's argument list
 359      -                       is greater than the system-imposed limit of {ARG_MAX}
 360      -                       bytes. The argument list limit is sum of the size of
 361      -                       the argument list plus the size of the environment's
 362      -                       exported shell variables.
      318 +     [E2BIG]            The number of bytes in the new process's argument list
      319 +                        is greater than the system-imposed limit of {ARG_MAX}
      320 +                        bytes.  The argument list limit is sum of the size of
      321 +                        the argument list plus the size of the environment's
      322 +                        exported shell variables.
 363  323  
      324 +     [EACCES]           Search permission is denied for a directory listed in
      325 +                        the new process file's path prefix.
 364  326  
 365      -       EACCES
 366      -                       Search permission is denied for a directory listed in
 367      -                       the new process file's path prefix.
      327 +                        The new process file is not an ordinary file.
 368  328  
 369      -                       The new process file is not an ordinary file.
      329 +                        The new process file mode denies execute permission.
 370  330  
 371      -                       The new process file mode denies execute permission.
      331 +                        The {FILE_DAC_SEARCH} privilege overrides the
      332 +                        restriction on directory searches.
 372  333  
 373      -                       The {FILE_DAC_SEARCH} privilege overrides the
 374      -                       restriction on directory searches.
      334 +                        The {FILE_DAC_EXECUTE} privilege overrides the lack of
      335 +                        execute permission.
 375  336  
 376      -                       The {FILE_DAC_EXECUTE} privilege overrides the lack of
 377      -                       execute permission.
      337 +     [EAGAIN]           Total amount of system memory available when reading
      338 +                        using raw I/O is temporarily insufficient.
 378  339  
      340 +     [EFAULT]           An argument points to an illegal address.
 379  341  
 380      -       EAGAIN
 381      -                       Total amount of system memory available when reading
 382      -                       using raw I/O is temporarily insufficient.
      342 +     [EINVAL]           The new process image file has the appropriate
      343 +                        permission and has a recognized executable binary
      344 +                        format, but the system does not support execution of a
      345 +                        file with this format.
 383  346  
      347 +     [EINTR]            A signal was caught during the execution of one of the
      348 +                        functions in the exec family.
 384  349  
 385      -       EFAULT
 386      -                       An argument points to an illegal address.
      350 +     The exec functions except fexecve() will fail if:
 387  351  
      352 +     [ELOOP]            Too many symbolic links were encountered in
      353 +                        translating path or file.
 388  354  
 389      -       EINVAL
 390      -                       The new process image file has the appropriate
 391      -                       permission and has a recognized executable binary
 392      -                       format, but the system does not support execution of a
 393      -                       file with this format.
      355 +     [ENAMETOOLONG]     The length of the file or path argument exceeds
      356 +                        {PATH_MAX}, or the length of a file or path component
      357 +                        exceeds {NAME_MAX} while {_POSIX_NO_TRUNC} is in
      358 +                        effect.
 394  359  
      360 +     [ENOENT]           One or more components of the new process path name of
      361 +                        the file do not exist or is a null pathname.
 395  362  
 396      -       EINTR
 397      -                       A signal was caught during the execution of one of the
 398      -                       functions in the exec family.
      363 +     [ENOLINK]          The path argument points to a remote machine and the
      364 +                        link to that machine is no longer active.
 399  365  
      366 +     [ENOTDIR]          A component of the new process path of the file prefix
      367 +                        is not a directory.
 400  368  
 401      -       ELOOP
 402      -                       Too many symbolic links were encountered in translating
 403      -                       path or file.
      369 +     The exec functions, except for execlp() and execvp(), will fail if:
 404  370  
      371 +     [ENOEXEC]          The new process image file has the appropriate access
      372 +                        permission but is not in the proper format.
 405  373  
 406      -       ENAMETOOLONG
 407      -                       The length of the file or path argument exceeds
 408      -                       {PATH_MAX}, or the length of a file or path component
 409      -                       exceeds {NAME_MAX} while {_POSIX_NO_TRUNC} is in
 410      -                       effect.
      374 +     The fexecve() function will fail if:
 411  375  
      376 +     [EBADF]            The fd argument is not a valid file descriptor opened
      377 +                        for execute.
 412  378  
 413      -       ENOENT
 414      -                       One or more components of the new process path name of
 415      -                       the file do not exist or is a null pathname.
 416  379  
      380 +     The exec functions except for fexecve() may fail if:
 417  381  
 418      -       ENOLINK
 419      -                       The path argument points to a remote machine and the
 420      -                       link to that machine is no longer active.
      382 +     [ENAMETOOLONG]     Pathname resolution of a symbolic link produced an
      383 +                        intermediate result whose length exceeds {PATH_MAX}.
 421  384  
      385 +     [ENOMEM]           The new process image requires more memory than is
      386 +                        allowed by the hardware or system-imposed by memory
      387 +                        management constraints.  See brk(2).
 422  388  
 423      -       ENOTDIR
 424      -                       A component of the new process path of the file prefix
 425      -                       is not a directory.
      389 +     [ETXTBSY]          The new process image file is a pure procedure (shared
      390 +                        text) file that is currently open for writing by some
      391 +                        process.
 426  392  
 427      -
 428      -
 429      -       The exec functions, except for execlp() and execvp(), will fail if:
 430      -
 431      -       ENOEXEC
 432      -                  The new process image file has the appropriate access
 433      -                  permission but is not in the proper format.
 434      -
 435      -
 436      -
 437      -       The exec functions may fail if:
 438      -
 439      -       ENAMETOOLONG
 440      -                       Pathname resolution of a symbolic link produced an
 441      -                       intermediate result whose length exceeds {PATH_MAX}.
 442      -
 443      -
 444      -       ENOMEM
 445      -                       The new process image requires more memory than is
 446      -                       allowed by the hardware or system-imposed by memory
 447      -                       management constraints. See brk(2).
 448      -
 449      -
 450      -       ETXTBSY
 451      -                       The new process image file is a pure procedure (shared
 452      -                       text) file that is currently open for writing by some
 453      -                       process.
 454      -
 455      -
 456  393  USAGE
 457      -       As the state of conversion descriptors and message catalogue
 458      -       descriptors in the new process image is undefined, portable
 459      -       applications should not rely on their use and should close them prior
 460      -       to calling one of the exec functions.
      394 +     As the state of conversion descriptors and message catalogue descriptors
      395 +     in the new process image is undefined, portable applications should not
      396 +     rely on their use and should close them prior to calling one of the exec
      397 +     functions.
 461  398  
      399 +     Applications that require other than the default POSIX locale should call
      400 +     setlocale(3C) with the appropriate parameters to establish the locale of
      401 +     the new process.
 462  402  
 463      -       Applications that require other than the default POSIX locale should
 464      -       call setlocale(3C) with the appropriate parameters to establish the
 465      -       locale of thenew process.
      403 +     The environ array should not be accessed directly by the application.
      404 +     Instead, getenv(3C) should be used.
 466  405  
      406 +SEE ALSO
      407 +     ps(1), sh(1), alarm(2), brk(2), chmod(2), exit(2), fcntl(2), fork(2),
      408 +     getpflags(2), getrlimit(2), memcntl(2), mmap(2), nice(2), open(2),
      409 +     priocntl(2), profil(2), semop(2), shmop(2), sigpending(2),
      410 +     sigprocmask(2), times(2), umask(2), lockf(3C), ptrace(3C), setlocale(3C),
      411 +     signal(3C), system(3C), timer_create(3C), fcntl.h(3HEAD),
      412 +     signal.h(3HEAD), unistd.h(3HEAD), a.out(4), contract(4), process(4),
      413 +     environ(5), privileges(5), standards(5)
 467  414  
 468      -       The environ array should not be accessed directly by the application.
      415 +INTERFACE STABILITY
      416 +     Standard.
 469  417  
 470      -ATTRIBUTES
 471      -       See attributes(5) for descriptions of the following attributes:
      418 +MT-LEVEL
      419 +     The execle(), execve(), fexecve() functions are Async-Signal-Safe.
 472  420  
      421 +STANDARDS
      422 +     These functions are available in the following compilation environments.
      423 +     See standards(5).
 473  424  
      425 +   execl(), execle(), execlp(), execv(), execve(), execvp()
      426 +        IEEE Std 1003.1-1990 (POSIX.1)
      427 +        X/Open Portability Guide Issue3 (XPG3)
      428 +        X/Open Portability Guide Issue4 (XPG4)
      429 +        X/Open Portability Guide Issue4, Version2 (XPG4.2)
      430 +        Version2 of the Single UNIX Specification (SUSv2)
      431 +        Version3 of the Single UNIX Specification (SUSv3)
      432 +        IEEE Std 1003.1-2008 (POSIX.1)
 474  433  
      434 +   fexecve()
      435 +        IEEE Std 1003.1-2008 (POSIX.1)
 475  436  
 476      -       +--------------------+-------------------+
 477      -       |  ATTRIBUTE TYPE    |  ATTRIBUTE VALUE  |
 478      -       +--------------------+-------------------+
 479      -       |Interface Stability | Committed         |
 480      -       +--------------------+-------------------+
 481      -       |MT-Level            | See below.        |
 482      -       +--------------------+-------------------+
 483      -       |Standard            | See standards(5). |
 484      -       +--------------------+-------------------+
 485      -
 486      -
 487      -       The execle() and execve() fucntions are Async-Signal-Safe.
 488      -
 489      -SEE ALSO
 490      -       ksh(1), ps(1), sh(1), alarm(2), brk(2), chmod(2), exit(2), fcntl(2),
 491      -       fork(2), getpflags(2), getrlimit(2), memcntl(2), mmap(2), nice(2),
 492      -       priocntl(2), profil(2), semop(2), shmop(2), sigpending(2),
 493      -       sigprocmask(2), times(2), umask(2), lockf(3C), ptrace(3C),
 494      -       setlocale(3C), signal(3C), system(3C), timer_create(3C), a.out(4),
 495      -       contract(4), process(4), attributes(5), environ(5), privileges(5),
 496      -       standards(5)
 497      -
 498  437  WARNINGS
 499      -       If a program is setuid to a user ID other than the superuser, and the
 500      -       program is executed when the real user ID is super-user, then the
 501      -       program has some of the powers of a super-user as well.
      438 +     If a program is setuid to a user ID other than the superuser, and the
      439 +     program is executed when the real user ID is super-user, then the program
      440 +     has some of the powers of a super-user as well.
 502  441  
 503      -
 504      -
 505      -                                 June 16, 2008                         EXEC(2)
      442 +illumos                       September 19, 2014                       illumos
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX