TEXT   237

execve.txt

Guest on 1st August 2021 05:59:23 PM

  1. NAME
  2.        execve - execute program
  3.  
  4.  
  5.  
  6. SYNOPSIS
  7.        #include <unistd.h>
  8.  
  9.        int  execve  (const  char  *filename, const char *argv [],
  10.        const char *envp[]);
  11.  
  12.  
  13.  
  14. DESCRIPTION
  15.        execve() executes the  program  pointed  to  by  filename.
  16.        filename  must  be  either a binary executable, or a shell
  17.        script starting with a line of the  form  "#!  interpreter
  18.        [arg]".
  19.  
  20.        execve()  does  not return on success, and the text, data,
  21.        bss, and stack of the calling process are  overwritten  by
  22.        that  of the program loaded.  The program invoked inherits
  23.        the calling process's PID, and any open  file  descriptors
  24.        that are not set to close on exec.  Signals pending on the
  25.        parent process are cleared.
  26.  
  27.        If the current program is being ptraced, a SIGTRAP is sent
  28.        to it after a successful execve().
  29.  
  30.  
  31.  
  32. RETURN VALUE
  33.        On  success,  execve()  does  not  return,  on error -1 is
  34.        returned, and errno is set appropriately.
  35.  
  36.  
  37.  
  38. ERRORS
  39.        EACCES The file is not a regular file.
  40.  
  41.        EACCES Execute permission is denied for the file.
  42.  
  43.        EPERM  The file system is mounted noexec.
  44.  
  45.        EPERM  The file system is mounted nosuid and the file  has
  46.               an SUID or SGID bit set.
  47.  
  48.        E2BIG  The argument list is too big.
  49.  
  50.        ENOEXEC
  51.               The magic number in the file is incorrect.
  52.  
  53.        EFAULT filename  points  outside  your  accessible address
  54.               space.
  55.  
  56.        ENAMETOOLONG
  57.               filename is too long.
  58.  
  59.        ENOENT The file does not exist.
  60.  
  61.        ENOMEM Insufficient kernel memory was available.
  62.  
  63.        ENOTDIR
  64.               A component of the path prefix is not a  directory.
  65.  
  66.        EACCES Search  permission  is denied on a component of the
  67.               path prefix.
  68.  
  69.        ELOOP  filename contains a circular reference (i.e., via a
  70.               symbolic link)
  71.  
  72.  
  73.  
  74. CONFORMING TO
  75.        SVID, AT&T, POSIX, X/OPEN, BSD 4.3
  76.  
  77.  
  78.  
  79. NOTES
  80.        SUID  and  SGID  processes  can  not be ptrace()'d SUID or
  81.        SGID.
  82.  
  83.        A maximum line length of 127 characters is allowed for the
  84.        first  line  in a #! executable shell script.  This may be
  85.        circumvented by changing the max size  of  buf,  in  which
  86.        case  you  will  become  bound  by the 1024 byte size of a
  87.        buffer, which is not easily worked around.
  88.  
  89.  
  90.  
  91. SEE ALSO
  92.        execl(3), fork(2)

Raw Paste


Login or Register to edit or fork this paste. It's free.