ref: e81c54ba2ecc673a4d5f8aed0e9b52841fe07b0d
dir: /man/2/sys-fd2path/
.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.