openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/glibc/2.29-r0/git/sysdeps/unix/sysv/linux/fexecve.c
int fexecve(int fd, char* const argv[], char* const envp[])
{
    if (fd < 0 || argv == NULL || envp == NULL)
    {
        __set_errno(EINVAL);
        return -1;
    }

#ifdef __NR_execveat
    /* Avoid implicit array coercion in syscall macros.  */
    INLINE_SYSCALL(execveat, 5, fd, "", &argv[0], &envp[0], AT_EMPTY_PATH);
#ifndef __ASSUME_EXECVEAT
    if (errno != ENOSYS)
        return -1;
#endif
#endif

#ifndef __ASSUME_EXECVEAT
    /* We use the /proc filesystem to get the information.  If it is not
       mounted we fail.  */
    char buf[sizeof "/proc/self/fd/" + sizeof(int) * 3];
    __snprintf(buf, sizeof(buf), "/proc/self/fd/%d", fd);

    /* We do not need the return value.  */
    __execve(buf, argv, envp);

    int save = errno;

    /* We come here only if the 'execve' call fails.  Determine whether
       /proc is mounted.  If not we return ENOSYS.  */
    struct stat st;
    if (stat("/proc/self/fd", &st) != 0 && errno == ENOENT)
        save = ENOSYS;

    __set_errno(save);
#endif

    return -1;
}
/* Execute the file FD refers to, overlaying the running program image.
   ARGV and ENVP are passed to the new program, as for `execve'.  */
Execute the file FD refers to, overlaying the running program image.
ARGV and ENVP are passed to the new program, as for `execve'.
Execute the file FD refers to overlaying the running program image . ARGV and ENVP are passed to the new program as for ` execve ' .
int fexecve(int fd, char* const argv[], char* const envp[])
{
    if (fd < 0 || argv == NULL || envp == NULL)
    {
        __set_errno(EINVAL);
        return -1;
    }
#ifdef __NR_execveat
    INLINE_SYSCALL(execveat, 5, fd, "", &argv[0], &envp[0], AT_EMPTY_PATH);
#ifndef __ASSUME_EXECVEAT
    if (errno != ENOSYS)
        return -1;
#endif
#endif
#ifndef __ASSUME_EXECVEAT
    char buf[sizeof "/proc/self/fd/" + sizeof(int) * 3];
    __snprintf(buf, sizeof(buf), "/proc/self/fd/%d", fd);
    __execve(buf, argv, envp);
    int save = errno;
    struct stat st;
    if (stat("/proc/self/fd", &st) != 0 && errno == ENOENT)
        save = ENOSYS;
    __set_errno(save);
#endif
    return -1;
}
int fexecve ( int fd , char * const argv [ ] , char * const envp [ ] ) { if ( fd < 0 || argv == NULL || envp == NULL ) { __set_errno ( EINVAL ) ; return -1 ; } #ifdef __NR_execveat INLINE_SYSCALL ( execveat , 5 , fd , " " , & argv [ 0 ] , & envp [ 0 ] , AT_EMPTY_PATH ) ; #ifndef __ASSUME_EXECVEAT if ( errno != ENOSYS ) return -1 ; #endif #endif #ifndef __ASSUME_EXECVEAT char buf [ sizeof " " + sizeof ( int ) * 3 ] ; __snprintf ( buf , sizeof ( buf ) , " " , fd ) ; __execve ( buf , argv , envp ) ; int save = errno ; struct stat st ; if ( stat ( " " , & st ) != 0 && errno == ENOENT ) save = ENOSYS ; __set_errno ( save ) ; #endif return -1 ; }
Execute the file FD refers to, overlaying the running program image.
Execute the file FD refers to overlaying the running program image .
/* Avoid implicit array coercion in syscall macros.  */ /* We use the /proc filesystem to get the information.  If it is not
       mounted we fail.  */ /* We do not need the return value.  */ /* We come here only if the 'execve' call fails.  Determine whether
       /proc is mounted.  If not we return ENOSYS.  */