Annotation of cci/usr/src/man/man2/execve.2, revision 1.1

1.1     ! root        1: .TH EXECVE 2 
        !             2: .SH NAME
        !             3: execl, execv, execle, execve, execlp, execvp \- execute a file
        !             4: .SH SYNOPSIS
        !             5: .B "int execl (path, arg0, arg1, ..., argn, 0)"
        !             6: .br
        !             7: .B char \(**path, \(**arg0, \(**arg1, ..., \(**argn;
        !             8: .PP
        !             9: .B int execv (path, argv)
        !            10: .br
        !            11: .B char \(**path, \(**argv[ ];
        !            12: .PP
        !            13: .B "int execle (path, arg0, arg1, ..., argn, 0, envp)"
        !            14: .br
        !            15: .B "char \(**path, \(**arg0, \(**arg1, ..., \(**argn, \(**envp[ ];"
        !            16: .PP
        !            17: .B int execve (path, argv, envp)
        !            18: .br
        !            19: .B char \(**path, \(**argv[ ], \(**envp[ ];
        !            20: .PP
        !            21: .B "int execlp (file, arg0, arg1, ..., argn, 0)"
        !            22: .br
        !            23: .B char \(**file, \(**arg0, \(**arg1, ..., \(**argn;
        !            24: .PP
        !            25: .B int execvp (file, argv)
        !            26: .br
        !            27: .B char \(**file, \(**argv[ ];
        !            28: .SH DESCRIPTION
        !            29: .I Exec\^
        !            30: in all its forms transforms the calling process into a new process.
        !            31: The new process is constructed from an ordinary, executable file called the
        !            32: .IR "new process file" .
        !            33: This file consists of a header (see
        !            34: .IR a.out (4)),
        !            35: a text segment, and a data segment.
        !            36: The data segment contains an initialized portion and an uninitialized
        !            37: portion (bss).
        !            38: There can be no return from a successful 
        !            39: .I exec\^
        !            40: because the calling process is overlaid by the new process.
        !            41: .PP
        !            42: When a C program is executed, it is called as follows:
        !            43: .PP
        !            44: .RS
        !            45: .nf
        !            46: .B "main (argc, argv, envp)"
        !            47: .B "int argc;"
        !            48: .B "char \(**\(**argv, \(**\(**envp;
        !            49: .fi
        !            50: .RE
        !            51: .PP
        !            52: where
        !            53: .I argc
        !            54: is the argument count and
        !            55: .I argv
        !            56: is an array of character pointers to the arguments themselves.
        !            57: As indicated,
        !            58: .I argc
        !            59: is conventionally at least one and the first member of the array
        !            60: points to a string containing the name of the file.
        !            61: .PP
        !            62: .I Path\^
        !            63: points to a path name that identifies the new process file.
        !            64: .PP
        !            65: .I File\^
        !            66: points to the new process file.
        !            67: The path prefix for this file is obtained by a search of the directories
        !            68: passed as the
        !            69: .I environment\^
        !            70: line "\s-1PATH\s+1 ="
        !            71: (see
        !            72: .IR environ (5)).
        !            73: The environment
        !            74: is supplied by the shell (see
        !            75: .IR sh (1)).
        !            76: .PP
        !            77: .IR Arg0 ", " arg1 ", " ... ,
        !            78: .I argn\^
        !            79: are pointers to null-terminated character strings.
        !            80: These strings constitute the argument list available to the new process.
        !            81: By convention, at least
        !            82: .I arg0\^
        !            83: must be present and point to a string that is the same as
        !            84: .I path\^
        !            85: (or its last component).
        !            86: .PP
        !            87: .I Argv\^
        !            88: is an array of character pointers to null-terminated strings.
        !            89: These strings constitute the argument list available to the new process.
        !            90: By convention,
        !            91: .I argv\^
        !            92: must have at least one member, and it must point to a string that is the same as
        !            93: .IR path\^
        !            94: (or its last component).
        !            95: .I Argv\^
        !            96: is terminated by a null pointer.
        !            97: .PP
        !            98: .I Envp\^
        !            99: is an array of character pointers to null-terminated strings.
        !           100: These strings constitute the environment
        !           101: for the new process.
        !           102: .I Envp\^
        !           103: is terminated by a null pointer.
        !           104: For
        !           105: .I execl\^
        !           106: and
        !           107: .IR execv ,
        !           108: the C run-time start-off routine places a pointer to the
        !           109: environment of the calling process in the global cell:
        !           110: .br
        !           111: .B "   extern char \(**\(**environ;"
        !           112: .br
        !           113: and it is used to pass the environment of the calling process to the new process.
        !           114: .PP
        !           115: File descriptors open in the calling process remain open in the new process,
        !           116: except for those whose
        !           117: \%close-on-exec 
        !           118: flag is set; see 
        !           119: .IR fcntl (2).
        !           120: For those file descriptors that remain open, the file pointer is unchanged.
        !           121: .PP
        !           122: Signals set to terminate the calling process will be set to terminate the
        !           123: new process.
        !           124: Signals set to be ignored by the calling process will be set to be
        !           125: ignored by the new process.
        !           126: Signals set to be caught by the calling process will be set to terminate
        !           127: new process; see 
        !           128: .IR signal (2).
        !           129: .PP
        !           130: If the set-user-\s-1ID\s+1
        !           131: mode bit of the new process file is set
        !           132: (see 
        !           133: .IR chmod (2)),
        !           134: .I exec\^
        !           135: sets the effective user
        !           136: .SM ID
        !           137: of the new process to the owner
        !           138: .SM ID
        !           139: of the new process file.
        !           140: Similarly, if the set-group-\s-1ID\s+1 mode bit of the
        !           141: new process file is set, the effective group
        !           142: .SM ID
        !           143: of the new process
        !           144: is set to the group
        !           145: .SM ID
        !           146: of the new process file.
        !           147: The real user
        !           148: .SM ID
        !           149: and real group 
        !           150: .SM ID
        !           151: of the new process remain the same as those of the calling process.
        !           152: .PP
        !           153: The shared memory segments attached to the calling process will not be
        !           154: attached to the new process (see
        !           155: .IR shmop (2)).
        !           156: .PP
        !           157: Profiling is disabled for the new process; see
        !           158: .IR profil (2).
        !           159: .PP 
        !           160: The new process also inherits the following attributes from the calling process:
        !           161: .PP
        !           162: .PD 0
        !           163: .RS 0.5i
        !           164: .PP
        !           165: nice value (see 
        !           166: .IR nice (2))
        !           167: .PP
        !           168: process
        !           169: .SM ID
        !           170: .PP
        !           171: parent process
        !           172: .SM ID
        !           173: .PP
        !           174: process group
        !           175: .SM ID
        !           176: .PP
        !           177: semadj values (see
        !           178: .IR semop (2))
        !           179: .PP
        !           180: tty group
        !           181: .SM ID
        !           182: (see 
        !           183: .IR exit (2)
        !           184: and
        !           185: .IR signal (2))
        !           186: .PP
        !           187: trace flag (see
        !           188: .IR ptrace "(2) request 0)"
        !           189: .PP
        !           190: time left until an alarm clock signal (see 
        !           191: .IR alarm (2))
        !           192: .PP
        !           193: current working directory
        !           194: .PP
        !           195: root directory
        !           196: .PP
        !           197: file mode creation mask (see
        !           198: .IR umask (2))
        !           199: .PP
        !           200: file size limit (see 
        !           201: .IR ulimit (2))
        !           202: .PP
        !           203: .IR utime ,
        !           204: .IR stime ,
        !           205: .IR cutime ,
        !           206: and
        !           207: .I cstime\^
        !           208: (see 
        !           209: .IR times (2))
        !           210: .RE
        !           211: .PD
        !           212: .PP
        !           213: .I Exec\^
        !           214: will fail and return to the calling process if one or more of the
        !           215: following are true:
        !           216: .TP 15
        !           217: .SM
        !           218: \%[ENOENT]
        !           219: One or more components of the new process path name of the file do not exist.
        !           220: .TP
        !           221: .SM
        !           222: \%[ENOTDIR]
        !           223: A component of the new process path of the file prefix is not a directory.
        !           224: .TP
        !           225: .SM
        !           226: \%[EACCES]
        !           227: Search permission is denied for a directory listed in the new process file's
        !           228: path prefix.
        !           229: .TP
        !           230: .SM
        !           231: \%[EACCES]
        !           232: The new process file is not an ordinary file.
        !           233: .TP
        !           234: .SM
        !           235: \%[EACCES]
        !           236: The new process file mode denies execution permission.
        !           237: .TP
        !           238: .SM
        !           239: \%[ENOEXEC]
        !           240: The exec is not an
        !           241: .I execlp\^
        !           242: or
        !           243: .IR execvp\^ ,
        !           244: and the new process file has the appropriate access permission
        !           245: but an invalid magic number in its header.
        !           246: .TP
        !           247: .SM
        !           248: \%[ETXTBSY]
        !           249: The new process file is a pure procedure (shared text) file that is
        !           250: currently open for writing by some process.
        !           251: .TP
        !           252: .SM
        !           253: \%[ENOMEM]
        !           254: The new process requires more memory than is allowed by the system-imposed
        !           255: maximum
        !           256: .SM MAXMEM.
        !           257: .TP
        !           258: .SM
        !           259: \%[E2BIG]
        !           260: The number of bytes in the new process's argument list is greater than the
        !           261: system-imposed limit of 5120 bytes.
        !           262: .TP
        !           263: .SM
        !           264: \%[EFAULT]
        !           265: The new process file is not as long as indicated by the size values in its
        !           266: header.
        !           267: .TP
        !           268: .SM
        !           269: \%[EFAULT]
        !           270: .IR Path ,
        !           271: .IR argv ,
        !           272: or
        !           273: .I envp\^
        !           274: point to an illegal address.
        !           275: .SH RETURN VALUE
        !           276: If 
        !           277: .I exec\^
        !           278: returns to the calling process an error has occurred; the return value
        !           279: will be \-1 and 
        !           280: .I errno\^
        !           281: will be set to indicate the error.
        !           282: .SH NOTES
        !           283: This manual page replaces the corresponding 4.2BSD manual page.
        !           284: .SH "SEE ALSO"
        !           285: alarm(2), exit(2), fork(2), nice(2), ptrace(2), semop(2), signal(2), times(2), ulimit(2), umask(2), a.out(4), environ(5).
        !           286: .br
        !           287: sh(1) in the
        !           288: \f2\s-1UNIX\s+1 System User Reference Manual\fR.
        !           289: .\"    @(#)exec.2      6.2 of 9/6/83

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.