The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fae33d1d12a51ca2bbdc7f5f189f7a4362fb48f7
commit fae33d1d12a51ca2bbdc7f5f189f7a4362fb48f7 Author: Konstantin Belousov <k...@freebsd.org> AuthorDate: 2025-05-25 16:32:34 +0000 Commit: Konstantin Belousov <k...@freebsd.org> CommitDate: 2025-05-25 20:32:26 +0000 open.2: add a note about conversion of a file descriptor into O_PATH Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D50511 --- lib/libsys/open.2 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/libsys/open.2 b/lib/libsys/open.2 index d8540637b690..6200723ed85c 100644 --- a/lib/libsys/open.2 +++ b/lib/libsys/open.2 @@ -464,6 +464,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.