dirfd(3) Library Functions Manual dirfd(3) dirfd - C (libc, -lc) #include #include int dirfd(DIR *dirp); glibc (. feature_test_macros(7)): dirfd(): /* 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 , Kirill Rekhov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.15 17 2025 . dirfd(3)