English pages are provided only to compare translations to original pages,
better looking pages can be browsed
at the Linux man-pages official site.
Linux Programmer's Manual (3)
dirfd - get directory stream file descriptor
int dirfd(DIR *dirp);
Feature Test Macro Requirements for glibc (see
_BSD_SOURCE || _SVID_SOURCE
|| /* Since glibc 2.10: */
(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
returns the file descriptor associated with the directory stream
This descriptor is the one used internally by the directory stream.
As a result, it is useful only for functions which do not depend on
or alter the file position, such as
It will be automatically closed when
On success, a nonnegative file descriptor is returned.
On error, -1 is returned, and
is set to indicate the cause of the error.
POSIX.1-2008 specifies two errors,
neither of which is returned by the current
does not refer to a valid directory stream.
The implementation does not support the association of a file
descriptor with a directory.
Multithreading (see pthreads(7))
function is thread-safe.
This function was a BSD extension, present in 4.3BSD-Reno, not in 4.2BSD.
The prototype for
is available only if
This page is part of release 3.66 of the Linux
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
- RETURN VALUE
- Multithreading (see pthreads(7))
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.
Time: 21:42:59 GMT, July 12, 2014