Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Dec 2021 09:23:31 +0100
From:      "Floyd, Paul" <paulf2718@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Is it possible to determine the open file path based on the file descriptor?
Message-ID:  <bedb6bc1-9921-2ca3-4170-09fded925a95@gmail.com>
In-Reply-To: <Ya0K7NelXkKtFtx%2B@kib.kiev.ua>
References:  <21b0280d-c290-f27f-98a9-0c2242380718@rawbw.com> <CAGudoHEjFvt4nijEUj0FwN0CTYmuxuqvSbiMefTeMvrXeuEkJg@mail.gmail.com> <CAGudoHHE7UcNsT5hB8zRwhjABBCP2-rtFcuHE=dhmPwvf=6XgA@mail.gmail.com> <5a00f93e-21a1-47ab-6e8e-15d24840c525@rawbw.com> <CAGudoHHpaKEo9ZfHEGrRgLE6RknM_KbmN1B5cx2%2B6jNsDzgY1A@mail.gmail.com> <20200708175300.GA2866@kib.kiev.ua> <656bf089-bcc9-748a-6db2-52f3707e863c@rawbw.com> <Ya0K7NelXkKtFtx%2B@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

On 2021-12-05 19:54, Konstantin Belousov wrote:
> On Sun, Dec 05, 2021 at 09:53:23AM -0800, Yuri wrote:
>> On 7/8/20 10:53, Konstantin Belousov wrote:
>>> I think an immediately useful addition would be a sysctl or fcntl that
>>> return struct kinfo_file for single file descriptor.
[snip]
>>> https://reviews.freebsd.org/D33277

That looks really nice. It's possible to do this with sysctl CTL_KERN / 
VKI_KERN_PROC / KERN_PROC_FILEDESC but that gets info for all file 
descriptors, meaning that you then have to search for the one that you want.

https://github.com/paulfloyd/freebsd_valgrind/blob/freebsd/coregrind/m_libcfile.c#L121

(I'm not the author of that bit of code).


A+

Paul





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bedb6bc1-9921-2ca3-4170-09fded925a95>