Is it possible to determine the open file path based on the file descriptor?

Konstantin Belousov kostikbel at gmail.com
Wed Jul 8 17:53:17 UTC 2020


On Wed, Jul 08, 2020 at 07:22:10PM +0200, Mateusz Guzik wrote:
> llvm is an example reason why I'm reluctant to add this. llvm
> currently will perform realpath, which was converted to a syscall and
> with other upcoming changed will be quite cheap, but most importantly
> reliable. F_GETPATH can easily fail which makes me really wary of this
> without always adding names to the namecache.

I think an immediately useful addition would be a sysctl or fcntl that
return struct kinfo_file for single file descriptor.


More information about the freebsd-hackers mailing list