dirfd(3) Library Functions Manual dirfd(3) dirfd - LIBRARY Standard C library (libc, -lc) #include #include int dirfd(DIR *dirp); glibc (. feature_test_macros(7)): dirfd(): /* Since glibc 2.10: */ _POSIX_C_SOURCE >= 200809L || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE dirfd() , dirp. . , , fstat(2) fchdir(2). closedir(3). On success, dirfd() returns a file descriptor (a nonnegative integer). On error, -1 is returned, and errno is set to indicate the error. POSIX.1-2008 , . EINVAL dirp . ENOTSUP . attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |dirfd() | | MT-Safe | +----------------------------+----------------------------------------------------------+--------------------------+ POSIX.1-2008. 4.3BSD-Reno (not in 4.2BSD). . open(2), openat(2), closedir(3), opendir(3), readdir(3), rewinddir(3), scandir(3), seekdir(3), telldir(3) Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . dirfd(3)