30 lines · 1019 B · Text
RawDownload
= fd2path: return file name associated with file descriptor     include "sys.m";    sys := load Sys Sys->PATH;     fd2path(fd: ref FD): string; As  described  in  intro(2),  the kernel stores a rooted pathname with every open file or directory; typically, it is  thename  used  in  the  original  access  of  the file.  Fd2pathreturns the path name associated with  open  file  descriptorfd.  (It returns nil if an error occurs.) Changes  to  the underlying name space do not update the pathname stored with the file descriptor.   Therefore,  the  pathreturned  by fd2path may no longer refer to the same file (orindeed any file) after some component directory  or  file  inthe path has been removed, renamed or rebound. As  an  example,  workdir(2) is implemented by opening .  andexecuting fd2path on the resulting file descriptor. == see ALSObind(1),  ns(1),   sys-bind(2),   sys-intro(2),   workdir(2),prog(3) == diagnosticsFd2path  returns  nil  on  error  and  sets  the system errorstring.