]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
open.2: Explain ways in which a 'directory file descriptor' can be obtained
authorMichael Kerrisk <mtk.manpages@gmail.com>
Tue, 12 May 2020 06:45:06 +0000 (08:45 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Tue, 12 May 2020 06:45:06 +0000 (08:45 +0200)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man2/open.2

index 2297fd32511e8be17467af97276f14301b79ddb0..030dae67f6d6562bc6cc6d72c6454aed5c89fad7 100644 (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