fd2path – return file name associated with file descriptor
int fd2path(int fd, char *buf, int nbuf)
As described in
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.
returns the path name associated with open file descriptor
bytes of the name are stored in
if the name is too long, it will be silently truncated at a UTF-8
The name is always null-terminated.
The return value of
will be zero unless an error occurs.
Changes to the underlying name space do not update the path name
stored with the file descriptor.
the path returned by
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
As an example,
is implemented by opening
on the resulting file descriptor.