execveat(2) System Calls Manual execveat(2) execveat - , LIBRARY Standard C library (libc, -lc) #include /* AT_* */ #include int execveat(int dirfd, const char *pathname, char *const _Nullable argv[], char *const _Nullable envp[], int flags); execveat() , dirfd pathname. execve(2), , . pathname , , dirfd ( , execve(2)). pathname dirfd AT_FDCWD, pathname ( execve(2)). pathname , dirfd . pathname -- AT_EMPTY_PATH, dirfd (. ., dirfd , ). flags , : AT_EMPTY_PATH pathname , , dirfd ( open(2) O_PATH). AT_SYMLINK_NOFOLLOW dirfd pathname -- ( NULL), ELOOP. On success, execveat() does not return. On error, -1 is returned, and errno is set to indicate the error. execveat() , execve(). , execveat() : pathname is relative but dirfd is neither AT_FDCWD nor a valid file descriptor. EINVAL flags. ELOOP flags AT_SYMLINK_NOFOLLOW dirfd, pathname -- ( NULL). ENOENT dirfd pathname ( , <<#!>>), dirfd O_CLOEXEC, . . ENOTDIR pathname dirfd , , . Linux. Linux 3.19, glibc 2.34. , openat(2), execveat() fexecve(3) , /proc. , argv[0], , /dev/fd/N /dev/fd/N/P, N -- , dirfd. , AT_EMPTY_PATH. , dirfd pathname; P -- , pathname. , fexecve(3), execveat() close-on-exec dirfd ( ). ENOENT, , , close-on-exec , : execveat(fd, "", argv, envp, AT_EMPTY_PATH); close-on-exec , . , , execveat(). . execve(2), openat(2), fexecve(3) Azamat Hackimov , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . execveat(2)