.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
-.TH DIRFD 3 2010-09-26 "Linux" "Linux Programmer's Manual"
+.TH DIRFD 3 2013-07-05 "Linux" "Linux Programmer's Manual"
.SH NAME
dirfd \- get directory stream file descriptor
.SH SYNOPSIS
.IR dirp .
.LP
This descriptor is the one used internally by the directory stream.
-As a result, it is only useful for functions which do not depend on
+As a result, it is useful only for functions which do not depend on
or alter the file position, such as
.BR fstat (2)
and
is called.
.SH RETURN VALUE
On success, a nonnegative file descriptor is returned.
-On error, \-1 is returned.
+On error, \-1 is returned, and
+.I errno
+is set to indicate the cause of the error.
.SH ERRORS
POSIX.1-2008 specifies two errors,
neither of which is returned by the current
.B ENOTSUP
The implementation does not support the association of a file
descriptor with a directory.
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR dirfd ()
+function is thread-safe.
.SH CONFORMING TO
POSIX.1-2008.
This function was a BSD extension, present in 4.3BSD-Reno, not in 4.2BSD.
.SH NOTES
The prototype for
.BR dirfd ()
-is only available if
+is available only if
.B _BSD_SOURCE
or
.B _SVID_SOURCE
.BR scandir (3),
.BR seekdir (3),
.BR telldir (3)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.