1 '\" te
   2 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
   3 .\" Copyright 1989 AT&T.
   4 .\" Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
   5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   6 .\" http://www.opengroup.org/bookstore/.
   7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   8 .\"  This notice shall appear on any product containing this material.
   9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
  10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  12 .TH EXEC 2 "Jun 16, 2008"
  13 .SH NAME
  14 exec, execl, execle, execlp, execv, execve, execvp \- execute a file
  15 .SH SYNOPSIS
  16 .LP
  17 .nf
  18 #include <unistd.h>
  19 
  20 \fBint\fR \fBexecl\fR(\fBconst char *\fR\fIpath\fR, \fBconst char *\fR\fIarg0\fR, \fB\&...
  21      /* const char *\fR\fIargn\fR, \fB(char *)0 */);\fR
  22 .fi
  23 
  24 .LP
  25 .nf
  26 \fBint\fR \fBexecv\fR(\fBconst char *\fR\fIpath\fR, \fBchar *const\fR \fIargv[]\fR);
  27 .fi
  28 
  29 .LP
  30 .nf
  31 \fBint\fR \fBexecle\fR(\fBconst char *\fR\fIpath\fR, \fBconst char *\fR\fIarg0\fR, \fB\&...
  32      /* const char *\fR\fIargn\fR, \fB(char *)0\fR,\fBchar *const\fR \fIenvp\fR[]*/);
  33 .fi
  34 
  35 .LP
  36 .nf
  37 \fBint\fR \fBexecve\fR(\fBconst char *\fR\fIpath\fR, \fBchar *const\fR \fIargv[]\fR,
  38      \fBchar *const\fR \fIenvp[]\fR);
  39 .fi
  40 
  41 .LP
  42 .nf
  43 \fBint\fR \fBexeclp\fR(\fBconst char *\fR\fIfile\fR, \fBconst char *\fR\fIarg0\fR, \fB\&...
  44      /* const char *\fR\fIargn\fR, \fB(char *)0 */);\fR
  45 .fi
  46 
  47 .LP
  48 .nf
  49 \fBint\fR \fBexecvp\fR(\fBconst char *\fR\fIfile\fR, \fBchar *const\fR \fIargv[]\fR);
  50 .fi
  51 
  52 .SH DESCRIPTION
  53 .sp
  54 .LP
  55 Each of the functions in the \fBexec\fR family replaces the current process
  56 image with a new process image. The new image is constructed from a regular,
  57 executable file called the \fBnew process image file\fR. This file is either an
  58 executable object file or a file of data for an interpreter. There is no return
  59 from a successful call to one of these functions because the calling process
  60 image is overlaid by the new process image.
  61 .sp
  62 .LP
  63 An interpreter file begins with a line of the form
  64 .sp
  65 .in +2
  66 .nf
  67 #! pathname [\fIarg\fR]
  68 .fi
  69 .in -2
  70 
  71 .sp
  72 .LP
  73 where \fIpathname\fR is the path of the interpreter, and \fIarg\fR is an
  74 optional argument. When an interpreter file is executed, the system invokes the
  75 specified interpreter. The pathname specified in the interpreter file is passed
  76 as \fIarg0\fR to the interpreter. If \fIarg\fR was specified in the interpreter
  77 file, it is passed as \fIarg1\fR to the interpreter. The remaining arguments to
  78 the interpreter are \fIarg0\fR through \fIargn\fR of the originally exec'd
  79 file. The interpreter named by \fIpathname\fR must not be an interpreter file.
  80 .sp
  81 .LP
  82 When a C-language program is executed as a result of this call, it is entered
  83 as a C-language function call as follows:
  84 .sp
  85 .in +2
  86 .nf
  87 int main (int argc, char *argv[]);
  88 .fi
  89 .in -2
  90 
  91 .sp
  92 .LP
  93 where \fIargc\fR is the argument count and \fIargv\fR is an array of character
  94 pointers to the arguments themselves. In addition, the following variable:
  95 .sp
  96 .in +2
  97 .nf
  98 extern char **environ;
  99 .fi
 100 .in -2
 101 
 102 .sp
 103 .LP
 104 is initialized as a pointer to an array of character pointers to the
 105 environment strings. The \fIargv\fR and \fIenviron\fR arrays are each
 106 terminated by a null pointer. The null pointer terminating the \fIargv\fR array
 107 is not counted in \fIargc\fR.
 108 .sp
 109 .LP
 110 The value of \fIargc\fR is non-negative, and if greater than 0, \fIargv\fR[0]
 111 points to a string containing the name of the file. If \fIargc\fR is 0,
 112 \fIargv\fR[0] is a null pointer, in which case there are no arguments.
 113 Applications should verify that \fIargc\fR is greater than 0 or that
 114 \fIargv\fR[0] is not a null pointer before dereferencing \fIargv\fR[0].
 115 .sp
 116 .LP
 117 The arguments specified by a program with one of the \fBexec\fR functions are
 118 passed on to the new process image in the \fBmain()\fR arguments.
 119 .sp
 120 .LP
 121 The \fIpath\fR argument points to a path name that identifies the new process
 122 image file.
 123 .sp
 124 .LP
 125 The \fIfile\fR argument is used to construct a pathname that identifies the new
 126 process image file. If the \fIfile\fR argument contains a slash character, it
 127 is used as the pathname for this file. Otherwise, the path prefix for this file
 128 is obtained by a search of the directories passed in the \fBPATH\fR environment
 129 variable (see \fBenviron\fR(5)). The environment is supplied typically by the
 130 shell. If the process image file is not a valid executable object file,
 131 \fBexeclp()\fR and \fBexecvp()\fR use the contents of that file as standard
 132 input to the shell. In this case, the shell becomes the new process image. The
 133 standard to which the caller conforms determines which shell is used. See
 134 \fBstandards\fR(5).
 135 .sp
 136 .LP
 137 The arguments represented by \fIarg0\fR\&.\|.\|. are pointers to
 138 null-terminated character strings. These strings constitute the argument list
 139 available to the new process image. The list is terminated by a null pointer.
 140 The \fIarg0\fR argument should point to a filename that is associated with the
 141 process being started by one of the \fBexec\fR functions.
 142 .sp
 143 .LP
 144 The \fIargv\fR argument is an array of character pointers to null-terminated
 145 strings. The last member of this array must be a null pointer. These strings
 146 constitute the argument list available to the new process image. The value in
 147 \fIargv\fR[0] should point to a filename that is associated with the process
 148 being started by one of the \fBexec\fR functions.
 149 .sp
 150 .LP
 151 The \fIenvp\fR argument is an array of character pointers to null-terminated
 152 strings. These strings constitute the environment for the new process image.
 153 The \fIenvp\fR array is terminated by a null pointer. For \fBexecl()\fR,
 154 \fBexecv()\fR, \fBexecvp()\fR, and \fBexeclp()\fR, the C-language run-time
 155 start-off routine places a pointer to the environment of the calling process in
 156 the global object \fBextern char **environ\fR, and it is used to pass the
 157 environment of the calling process to the new process image.
 158 .sp
 159 .LP
 160 The number of bytes available for the new process's combined argument and
 161 environment lists is \fBARG_MAX\fR. It is implementation-dependent whether null
 162 terminators, pointers, and/or any alignment bytes are included in this total.
 163 .sp
 164 .LP
 165 File descriptors open in the calling process image remain open in the new
 166 process image, except for those whose close-on-exec flag \fBFD_CLOEXEC\fR is
 167 set; see \fBfcntl\fR(2). For those file descriptors that remain open, all
 168 attributes of the open file description, including file locks, remain
 169 unchanged.
 170 .sp
 171 .LP
 172 The preferred hardware address translation size (see \fBmemcntl\fR(2)) for the
 173 stack and heap of the new process image are set to the default system page
 174 size.
 175 .sp
 176 .LP
 177 Directory streams open in the calling process image are closed in the new
 178 process image.
 179 .sp
 180 .LP
 181 The state of conversion descriptors and message catalogue descriptors in the
 182 new process image is undefined. For the new process, the equivalent of:
 183 .sp
 184 .in +2
 185 .nf
 186 setlocale(LC_ALL, "C")
 187 .fi
 188 .in -2
 189 
 190 .sp
 191 .LP
 192 is executed at startup.
 193 .sp
 194 .LP
 195 Signals set to the default action (\fBSIG_DFL\fR) in the calling process image
 196 are set to the default action in the new process image (see \fBsignal\fR(3C)).
 197 Signals set to be ignored (\fBSIG_IGN\fR) by the calling process image are set
 198 to be ignored by the new process image. Signals set to be caught by the calling
 199 process image are set to the default action in the new process image (see
 200 \fBsignal.h\fR(3HEAD)). After a successful call to any of the \fBexec\fR
 201 functions, alternate signal stacks are not preserved and the \fBSA_ONSTACK\fR
 202 flag is cleared for all signals.
 203 .sp
 204 .LP
 205 After a successful call to any of the \fBexec\fR functions, any functions
 206 previously registered by \fBatexit\fR(3C) are no longer registered.
 207 .sp
 208 .LP
 209 The saved resource limits in the new process image are set to be a copy of the
 210 process's corresponding hard and soft resource limits.
 211 .sp
 212 .LP
 213 If the \fBST_NOSUID\fR bit is set for the file system containing the new
 214 process image file, then the effective user \fBID\fR and effective group
 215 \fBID\fR are unchanged in the new process image. If the set-user-\fBID\fR mode
 216 bit of the new process image file is set (see \fBchmod\fR(2)), the effective
 217 user \fBID\fR of the new process image is set to the owner \fBID\fR of the new
 218 process image file. Similarly, if the set-group-\fBID\fR mode bit of the new
 219 process image file is set, the effective group \fBID\fR of the new process
 220 image is set to the group \fBID\fR of the new process image file. The real user
 221 \fBID\fR and real group \fBID\fR of the new process image remain the same as
 222 those of the calling process image. The effective user ID and effective group
 223 ID of the new process image are saved (as the saved set-user-ID and the saved
 224 set-group-ID for use by \fBsetuid\fR(2).
 225 .sp
 226 .LP
 227 The privilege sets are changed according to the following rules:
 228 .RS +4
 229 .TP
 230 1.
 231 The inheritable set, I, is intersected with the limit set, L.  This
 232 mechanism enforces the limit set for processes.
 233 .RE
 234 .RS +4
 235 .TP
 236 2.
 237 The effective set, E, and the permitted set, P, are made equal to the new
 238 inheritable set.
 239 .RE
 240 .sp
 241 .LP
 242 The system attempts to set the privilege-aware state to non-PA both before
 243 performing any modifications to the process IDs and privilege sets as well as
 244 after completing the transition to new UIDs and privilege sets, following the
 245 rules outlined in \fBprivileges\fR(5).
 246 .sp
 247 .LP
 248 If the {\fBPRIV_PROC_OWNER\fR} privilege is asserted in the effective set, the
 249 set-user-ID and set-group-ID bits will be honored when the process is being
 250 controlled by \fBptrace\fR(3C). Additional restriction can apply when the
 251 traced process has an effective UID of 0. See \fBprivileges\fR(5).
 252 .sp
 253 .LP
 254 Any shared memory segments attached to the calling process image will not be
 255 attached to the new process image (see \fBshmop\fR(2)). Any mappings
 256 established through \fBmmap()\fR are not preserved across an \fBexec\fR. Memory
 257 mappings created in the process are unmapped before the address space is
 258 rebuilt for the new process image. See \fBmmap\fR(2).
 259 .sp
 260 .LP
 261 Memory locks established by the calling process via calls to \fBmlockall\fR(3C)
 262 or \fBmlock\fR(3C) are removed. If locked pages in the address space of the
 263 calling process are also mapped into the address spaces the locks established
 264 by the other processes will be unaffected by the call by this process to the
 265 \fBexec\fR function. If the \fBexec\fR function fails, the effect on memory
 266 locks is unspecified.
 267 .sp
 268 .LP
 269 If \fB_XOPEN_REALTIME\fR is defined and has a value other than \(mi1, any named
 270 semaphores open in the calling process are closed as if by appropriate calls to
 271 \fBsem_close\fR(3C)
 272 .sp
 273 .LP
 274 Profiling is disabled for the new process; see \fBprofil\fR(2).
 275 .sp
 276 .LP
 277 Timers created by the calling process with \fBtimer_create\fR(3C) are deleted
 278 before replacing the current process image with the new process image.
 279 .sp
 280 .LP
 281 For the \fBSCHED_FIFO\fR and \fBSCHED_RR\fR scheduling policies, the policy and
 282 priority settings are not changed by a call to an \fBexec\fR function.
 283 .sp
 284 .LP
 285 All open message queue descriptors in the calling process are closed, as
 286 described in \fBmq_close\fR(3C).
 287 .sp
 288 .LP
 289 Any outstanding asynchronous I/O operations may be cancelled. Those
 290 asynchronous I/O operations that are not canceled will complete as if the
 291 \fBexec\fR function had not yet occurred, but any associated signal
 292 notifications are suppressed. It is unspecified whether the \fBexec\fR function
 293 itself blocks awaiting such I/O completion. In no event, however, will the new
 294 process image created by the \fBexec\fR function be affected by the presence of
 295 outstanding asynchronous I/O operations at the time the \fBexec\fR function is
 296 called.
 297 .sp
 298 .LP
 299 All active contract templates are cleared (see \fBcontract\fR(4)).
 300 .sp
 301 .LP
 302 The new process also inherits the following attributes from the calling
 303 process:
 304 .RS +4
 305 .TP
 306 .ie t \(bu
 307 .el o
 308 controlling terminal
 309 .RE
 310 .RS +4
 311 .TP
 312 .ie t \(bu
 313 .el o
 314 current working directory
 315 .RE
 316 .RS +4
 317 .TP
 318 .ie t \(bu
 319 .el o
 320 file-locks (see \fBfcntl\fR(2) and \fBlockf\fR(3C))
 321 .RE
 322 .RS +4
 323 .TP
 324 .ie t \(bu
 325 .el o
 326 file mode creation mask (see \fBumask\fR(2))
 327 .RE
 328 .RS +4
 329 .TP
 330 .ie t \(bu
 331 .el o
 332 file size limit (see \fBulimit\fR(2))
 333 .RE
 334 .RS +4
 335 .TP
 336 .ie t \(bu
 337 .el o
 338 limit privilege set
 339 .RE
 340 .RS +4
 341 .TP
 342 .ie t \(bu
 343 .el o
 344 nice value (see \fBnice\fR(2))
 345 .RE
 346 .RS +4
 347 .TP
 348 .ie t \(bu
 349 .el o
 350 parent process \fBID\fR
 351 .RE
 352 .RS +4
 353 .TP
 354 .ie t \(bu
 355 .el o
 356 pending signals (see \fBsigpending\fR(2))
 357 .RE
 358 .RS +4
 359 .TP
 360 .ie t \(bu
 361 .el o
 362 privilege debugging flag (see \fBprivileges\fR(5) and \fBgetpflags\fR(2))
 363 .RE
 364 .RS +4
 365 .TP
 366 .ie t \(bu
 367 .el o
 368 process \fBID\fR
 369 .RE
 370 .RS +4
 371 .TP
 372 .ie t \(bu
 373 .el o
 374 process contract (see \fBcontract\fR(4) and \fBprocess\fR(4))
 375 .RE
 376 .RS +4
 377 .TP
 378 .ie t \(bu
 379 .el o
 380 process group \fBID\fR
 381 .RE
 382 .RS +4
 383 .TP
 384 .ie t \(bu
 385 .el o
 386 process signal mask (see \fBsigprocmask\fR(2))
 387 .RE
 388 .RS +4
 389 .TP
 390 .ie t \(bu
 391 .el o
 392 processor bindings (see \fBprocessor_bind\fR(2))
 393 .RE
 394 .RS +4
 395 .TP
 396 .ie t \(bu
 397 .el o
 398 processor set bindings (see \fBpset_bind\fR(2))
 399 .RE
 400 .RS +4
 401 .TP
 402 .ie t \(bu
 403 .el o
 404 project \fBID\fR
 405 .RE
 406 .RS +4
 407 .TP
 408 .ie t \(bu
 409 .el o
 410 real group \fBID\fR
 411 .RE
 412 .RS +4
 413 .TP
 414 .ie t \(bu
 415 .el o
 416 real user \fBID\fR
 417 .RE
 418 .RS +4
 419 .TP
 420 .ie t \(bu
 421 .el o
 422 resource limits (see \fBgetrlimit\fR(2))
 423 .RE
 424 .RS +4
 425 .TP
 426 .ie t \(bu
 427 .el o
 428 root directory
 429 .RE
 430 .RS +4
 431 .TP
 432 .ie t \(bu
 433 .el o
 434 scheduler class and priority (see \fBpriocntl\fR(2))
 435 .RE
 436 .RS +4
 437 .TP
 438 .ie t \(bu
 439 .el o
 440 \fBsemadj\fR values (see \fBsemop\fR(2))
 441 .RE
 442 .RS +4
 443 .TP
 444 .ie t \(bu
 445 .el o
 446 session membership (see \fBexit\fR(2) and \fBsignal\fR(3C))
 447 .RE
 448 .RS +4
 449 .TP
 450 .ie t \(bu
 451 .el o
 452 supplementary group \fBIDs\fR
 453 .RE
 454 .RS +4
 455 .TP
 456 .ie t \(bu
 457 .el o
 458 task \fBID\fR
 459 .RE
 460 .RS +4
 461 .TP
 462 .ie t \(bu
 463 .el o
 464 time left until an alarm clock signal (see \fBalarm\fR(2))
 465 .RE
 466 .RS +4
 467 .TP
 468 .ie t \(bu
 469 .el o
 470 \fBtms_utime\fR, \fBtms_stime\fR, \fBtms_cutime\fR, and \fBtms_cstime\fR (see
 471 \fBtimes\fR(2))
 472 .RE
 473 .RS +4
 474 .TP
 475 .ie t \(bu
 476 .el o
 477 trace flag (see \fBptrace\fR(3C) request 0)
 478 .RE
 479 .sp
 480 .LP
 481 A call to any \fBexec\fR function from a process with more than one thread
 482 results in all threads being terminated and the new executable image being
 483 loaded and executed. No destructor functions will be called.
 484 .sp
 485 .LP
 486 Upon successful completion, each of the functions in the \fBexec\fR family
 487 marks for update the \fBst_atime\fR field of the file.  If an \fBexec\fR
 488 function failed but was able to locate the \fBprocess image file\fR, whether
 489 the \fBst_atime\fR field is marked for update is unspecified. Should the
 490 function succeed, the process image file is considered to have been opened with
 491 \fBopen\fR(2). The corresponding \fBclose\fR(2) is considered to occur at a
 492 time after this open, but before process termination or successful completion
 493 of a subsequent call to one of the \fBexec\fR functions. The \fIargv\fR[\|] and
 494 \fIenvp\fR[\|] arrays of pointers and the strings to which those arrays point
 495 will not be modified by a call to one of the \fBexec\fR functions, except as a
 496 consequence of replacing the process image.
 497 .sp
 498 .LP
 499 The saved resource limits in the new process image are set to be a copy of the
 500 process's corresponding hard and soft limits.
 501 .SH RETURN VALUES
 502 .sp
 503 .LP
 504 If a function in the \fBexec\fR family returns to the calling process image, an
 505 error has occurred; the return value is \fB\(mi1\fR and \fBerrno\fR is set to
 506 indicate the error.
 507 .SH ERRORS
 508 .sp
 509 .LP
 510 The \fBexec\fR functions will fail if:
 511 .sp
 512 .ne 2
 513 .na
 514 \fB\fBE2BIG\fR\fR
 515 .ad
 516 .RS 16n
 517 The number of bytes in the new process's argument list is greater than the
 518 system-imposed limit of {\fBARG_MAX\fR} bytes. The argument list limit is sum
 519 of the size of the argument list plus the size of the environment's exported
 520 shell variables.
 521 .RE
 522 
 523 .sp
 524 .ne 2
 525 .na
 526 \fB\fBEACCES\fR\fR
 527 .ad
 528 .RS 16n
 529 Search permission is denied for a directory listed in the new process file's
 530 path prefix.
 531 .sp
 532 The new process file is not an ordinary file.
 533 .sp
 534 The new process file mode denies execute permission.
 535 .sp
 536 The {\fBFILE_DAC_SEARCH\fR} privilege overrides the restriction on directory
 537 searches.
 538 .sp
 539 The {\fBFILE_DAC_EXECUTE\fR} privilege overrides the lack of execute
 540 permission.
 541 .RE
 542 
 543 .sp
 544 .ne 2
 545 .na
 546 \fB\fBEAGAIN\fR\fR
 547 .ad
 548 .RS 16n
 549 Total amount of system memory available when reading using raw I/O is
 550 temporarily insufficient.
 551 .RE
 552 
 553 .sp
 554 .ne 2
 555 .na
 556 \fB\fBEFAULT\fR\fR
 557 .ad
 558 .RS 16n
 559 An argument points to an illegal address.
 560 .RE
 561 
 562 .sp
 563 .ne 2
 564 .na
 565 \fB\fBEINVAL\fR\fR
 566 .ad
 567 .RS 16n
 568 The new process image file has the appropriate permission and has a recognized
 569 executable binary format, but the system does not support execution of a file
 570 with this format.
 571 .RE
 572 
 573 .sp
 574 .ne 2
 575 .na
 576 \fB\fBEINTR\fR\fR
 577 .ad
 578 .RS 16n
 579 A signal was caught during the execution of one of the functions in the
 580 \fIexec\fR family.
 581 .RE
 582 
 583 .sp
 584 .ne 2
 585 .na
 586 \fB\fBELOOP\fR\fR
 587 .ad
 588 .RS 16n
 589 Too many symbolic links were encountered in translating \fIpath\fR or
 590 \fIfile\fR.
 591 .RE
 592 
 593 .sp
 594 .ne 2
 595 .na
 596 \fB\fBENAMETOOLONG\fR\fR
 597 .ad
 598 .RS 16n
 599 The length of the \fIfile\fR or \fIpath\fR argument exceeds {\fBPATH_MAX\fR},
 600 or the length of a \fIfile\fR or \fIpath\fR component exceeds {\fBNAME_MAX\fR}
 601 while {\fB_POSIX_NO_TRUNC\fR} is in effect.
 602 .RE
 603 
 604 .sp
 605 .ne 2
 606 .na
 607 \fB\fBENOENT\fR\fR
 608 .ad
 609 .RS 16n
 610 One or more components of the new process path name of the file do not exist or
 611 is a null pathname.
 612 .RE
 613 
 614 .sp
 615 .ne 2
 616 .na
 617 \fB\fBENOLINK\fR\fR
 618 .ad
 619 .RS 16n
 620 The \fIpath\fR argument points to a remote machine and the link to that machine
 621 is no longer active.
 622 .RE
 623 
 624 .sp
 625 .ne 2
 626 .na
 627 \fB\fBENOTDIR\fR\fR
 628 .ad
 629 .RS 16n
 630 A component of the new process path of the file prefix is not a directory.
 631 .RE
 632 
 633 .sp
 634 .LP
 635 The \fBexec\fR functions, except for \fBexeclp()\fR and \fBexecvp()\fR, will
 636 fail if:
 637 .sp
 638 .ne 2
 639 .na
 640 \fB\fBENOEXEC\fR\fR
 641 .ad
 642 .RS 11n
 643 The new process image file has the appropriate access permission but is not in
 644 the proper format.
 645 .RE
 646 
 647 .sp
 648 .LP
 649 The \fBexec\fR functions may fail if:
 650 .sp
 651 .ne 2
 652 .na
 653 \fB\fBENAMETOOLONG\fR\fR
 654 .ad
 655 .RS 16n
 656 Pathname resolution of a symbolic link produced an intermediate result whose
 657 length exceeds {\fBPATH_MAX\fR}.
 658 .RE
 659 
 660 .sp
 661 .ne 2
 662 .na
 663 \fB\fBENOMEM\fR\fR
 664 .ad
 665 .RS 16n
 666 The new process image requires more memory than is allowed by the hardware or
 667 system-imposed by memory management constraints. See \fBbrk\fR(2).
 668 .RE
 669 
 670 .sp
 671 .ne 2
 672 .na
 673 \fB\fBETXTBSY\fR\fR
 674 .ad
 675 .RS 16n
 676 The new process image file is a pure procedure (shared text) file that is
 677 currently open for writing by some process.
 678 .RE
 679 
 680 .SH USAGE
 681 .sp
 682 .LP
 683 As the state of conversion descriptors and message catalogue descriptors in the
 684 new process image is undefined, portable applications should not rely on their
 685 use and should close them prior to calling one of the \fBexec\fR functions.
 686 .sp
 687 .LP
 688 Applications that require other than the default POSIX locale should call
 689 \fBsetlocale\fR(3C) with the appropriate parameters to establish the locale of
 690 thenew process.
 691 .sp
 692 .LP
 693 The \fIenviron\fR array should not be accessed directly by the application.
 694 .SH ATTRIBUTES
 695 .sp
 696 .LP
 697 See \fBattributes\fR(5) for descriptions of the following attributes:
 698 .sp
 699 
 700 .sp
 701 .TS
 702 box;
 703 c | c
 704 l | l .
 705 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 706 _
 707 Interface Stability     Committed
 708 _
 709 MT-Level        See below.
 710 _
 711 Standard        See \fBstandards\fR(5).
 712 .TE
 713 
 714 .sp
 715 .LP
 716 The \fBexecle()\fR and \fBexecve()\fR fucntions are Async-Signal-Safe.
 717 .SH SEE ALSO
 718 .sp
 719 .LP
 720 \fBksh\fR(1), \fBps\fR(1), \fBsh\fR(1), \fBalarm\fR(2), \fBbrk\fR(2),
 721 \fBchmod\fR(2), \fBexit\fR(2), \fBfcntl\fR(2), \fBfork\fR(2),
 722 \fBgetpflags\fR(2), \fBgetrlimit\fR(2), \fBmemcntl\fR(2), \fBmmap\fR(2),
 723 \fBnice\fR(2), \fBpriocntl\fR(2), \fBprofil\fR(2), \fBsemop\fR(2),
 724 \fBshmop\fR(2), \fBsigpending\fR(2), \fBsigprocmask\fR(2), \fBtimes\fR(2),
 725 \fBumask\fR(2), \fBlockf\fR(3C), \fBptrace\fR(3C), \fBsetlocale\fR(3C),
 726 \fBsignal\fR(3C), \fBsystem\fR(3C), \fBtimer_create\fR(3C), \fBa.out\fR(4),
 727 \fBcontract\fR(4), \fBprocess\fR(4), \fBattributes\fR(5), \fBenviron\fR(5),
 728 \fBprivileges\fR(5), \fBstandards\fR(5)
 729 .SH WARNINGS
 730 .sp
 731 .LP
 732 If a program is \fBsetuid\fR to a user \fBID\fR other than the superuser, and
 733 the program is executed when the real user \fBID\fR is super-user, then the
 734 program has some of the powers of a super-user as well.