open.2: Explain ways in which a 'directory file descriptor' can be obtained

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2020-05-12 08:45:06 +02:00
parent aec13430b1
commit 96c44b8f50
1 changed files with 16 additions and 0 deletions

View File

@ -1665,6 +1665,22 @@ directory", via file descriptor(s) maintained by the application.
on the use of
.IR /proc/self/fd/ dirfd,
but less efficiently.)
.PP
The
.I dirfd
argument for these APIs can be obtained by using
.BR open ()
or
.BR openat ()
to open a directory (with either the
.BR O_RDONLY
or the
.BR O_PATH
flag).
Alternatively, such a file descriptor can be obtained by applying
.BR dirfd (3)
to a directory stream created using
.BR opendir (3).
.\"
.\"
.SS O_DIRECT