git: 5c10e8eae0f0 - stable/14 - open.2: add a note about conversion of a file descriptor into O_PATH
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 28 May 2025 10:11:17 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=5c10e8eae0f071799744f55bc99ef3b712b698ba
commit 5c10e8eae0f071799744f55bc99ef3b712b698ba
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-05-25 16:32:34 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-05-28 10:10:59 +0000
open.2: add a note about conversion of a file descriptor into O_PATH
(cherry picked from commit fae33d1d12a51ca2bbdc7f5f189f7a4362fb48f7)
---
lib/libc/sys/open.2 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2
index 7a760df7cf2f..b3bce8e77793 100644
--- a/lib/libc/sys/open.2
+++ b/lib/libc/sys/open.2
@@ -452,6 +452,13 @@ flag for
.Xr fstatat 2
and related syscalls.
.Pp
+Conversely, a file descriptor
+.Dv fd
+referencing a filesystem file can be converted to the
+.Dv O_PATH
+type of descriptor by using the following call
+.Dl opath_fd = openat(fd, \[dq]\[dq], O_EMPTY_PATH | O_PATH);
+.Pp
If successful,
.Fn open
returns a non-negative integer, termed a file descriptor.