.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992 .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" Modified by Michael Haardt (u31b3hs@pool.informatik.rwth-aachen.de) .\" Modified Wed Jul 21 22:47:01 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified 21 Aug 1994 by Michael Chastain (mec@shell.portal.com): .\" Fixed typoes. .\" .TH EXECVE 2 "21 August 1994" "Linux 1.1.46" "Linux Programmer's Manual" .SH NAME execve \- execute program .SH SYNOPSIS .B #include .sp .BI "int execve (const char *" filename ", const char *" argv .BI "[], const char *" envp []); .SH DESCRIPTION \fBexecve()\fP executes the program pointed to by \fIfilename\fP. \fIfilename\fP must be either a binary executable, or a shell script starting with a line of the form "\fB#! \fIinterpreter \fR[arg]". \fBexecve()\fP does not return on success, and the text, data, bss, and stack of the calling process are overwritten by that of the program loaded. The program invoked inherits the calling process's PID, and any open file descriptors that are not set to close on exec. Signals pending on the parent process are cleared. If the current program is being ptraced, a \fBSIGTRAP\fP is sent to it after a successful \fBexecve()\fP. .SH "RETURN VALUE" On success, \fBexecve()\fP does not return, on error \-1 is returned, and .I errno is set appropriately. .SH ERRORS .TP .B EACCES The file is not a regular file. .TP .B EACCES Execute permission is denied for the file. .TP .B EPERM The file system is mounted .IR noexec . .TP .B EPERM The file system is mounted .I nosuid and the file has an SUID or SGID bit set. .TP .B E2BIG The argument list is too big. .TP .B ENOEXEC The magic number in the file is incorrect. .TP .B EFAULT .I filename points outside your accessible address space. .TP .B ENAMETOOLONG .I filename is too long. .TP .B ENOENT The file does not exist. .TP .B ENOMEM Insufficient kernel memory was available. .TP .B ENOTDIR A component of the path prefix is not a directory. .TP .B EACCES Search permission is denied on a component of the path prefix. .TP .B ELOOP .I filename contains a circular reference (i.e., via a symbolic link) .SH "CONFORMING TO" SVID, AT&T, POSIX, X/OPEN, BSD 4.3 .SH NOTES SUID and SGID processes can not be \fBptrace()\fP'd SUID or SGID. A maximum line length of 127 characters is allowed for the first line in a #! executable shell script. This may be circumvented by changing the max size of buf, in which case you will become bound by the 1024 byte size of a buffer, which is not easily worked around. .SH "SEE ALSO" .BR execl "(3), " fork (2)