How to get filename of an open file descriptor

Dag-Erling Smørgrav des at
Wed Nov 14 01:58:14 PST 2007

Yuri <yuri at> writes:
> But is there any workaround in 6.3? I need to port one package that
> needs to lookup file names by FDs to the current FreeBSD and need some
> solution now.

You can not reliably obtain a file name from a file descriptor.  The
best you can hope for is to find a file name that resolves to the vnode
that the file descriptor is associated with.  The file name you find (if
you do - there is no guarantee) may or may not be the name by which the
file was opened.

Dag-Erling Smørgrav - des at

More information about the freebsd-hackers mailing list