summaryrefslogtreecommitdiff
path: root/static/inferno/man2/sys-fd2path.2
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-26 16:38:00 -0400
committerJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-26 16:38:00 -0400
commit97d5c458cfa039d857301e1ca7d5af3beb37131d (patch)
treeb460cd850d0537eb71806ba30358840377b27688 /static/inferno/man2/sys-fd2path.2
parentb89dc2331a50c63f8b33272a5c4c61ab98abdaa3 (diff)
build: Better Build System
Diffstat (limited to 'static/inferno/man2/sys-fd2path.2')
-rw-r--r--static/inferno/man2/sys-fd2path.246
1 files changed, 46 insertions, 0 deletions
diff --git a/static/inferno/man2/sys-fd2path.2 b/static/inferno/man2/sys-fd2path.2
new file mode 100644
index 00000000..4890e0fb
--- /dev/null
+++ b/static/inferno/man2/sys-fd2path.2
@@ -0,0 +1,46 @@
+.TH FD2PATH 2
+.SH NAME
+fd2path \- return file name associated with file descriptor
+.SH SYNOPSIS
+.EX
+include "sys.m";
+sys := load Sys Sys->PATH;
+
+fd2path(fd: ref FD): string;
+.EE
+.SH DESCRIPTION
+As described in
+.IR intro (2),
+the kernel stores a rooted path name with every open file or directory;
+typically, it is the name used in the original access of the file.
+.B Fd2path
+returns the path name associated with open file descriptor
+.IR fd .
+(It returns nil if an error occurs.)
+.PP
+Changes to the underlying name space do not update the path name
+stored with the file descriptor.
+Therefore,
+the path returned by
+.B fd2path
+may no longer refer to the same file (or indeed any file)
+after some component directory or file in the path has been removed, renamed
+or rebound.
+.PP
+As an example,
+.IR workdir (2)
+is implemented by opening
+.B .
+and executing
+.B fd2path
+on the resulting file descriptor.
+.SH SEE ALSO
+.IR bind (1),
+.IR ns (1),
+.IR sys-bind (2),
+.IR sys-intro (2),
+.IR workdir (2),
+.IR prog (3)
+.SH DIAGNOSTICS
+.B Fd2path
+returns nil on error and sets the system error string.