Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jul 2020 09:22:37 +0200
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Yuri <yuri@rawbw.com>
Cc:        Freebsd hackers list <freebsd-hackers@freebsd.org>
Subject:   Re: Is it possible to determine the open file path based on the file descriptor?
Message-ID:  <CAGudoHEPSAfWgncobk=txcnwiWCjSSWT=rmKmkt3xtHwh%2BsKpA@mail.gmail.com>
In-Reply-To: <21b0280d-c290-f27f-98a9-0c2242380718@rawbw.com>
References:  <21b0280d-c290-f27f-98a9-0c2242380718@rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 7/8/20, Yuri <yuri@rawbw.com> wrote:
> Hi Hackers,
>
>
> One of the ports (sysutils/watchman) attempts to find the path of the
> file based on the file descriptor assuming that this descriptor
> represents an open file.
>

I had a look at the program at hand. It seems to predominantly use
F_GETPATH for de facto realpath, it looks like this:

  auto handle = openFileHandle(path, options);
  return handle.getOpenedPath();

That said, for this program on FreeBSD, the right thing to do is to
convert it to actual realpath(3). In head this will be performant just
fine as it is implemented as a syscall. I can MFC it for stable/12.

-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGudoHEPSAfWgncobk=txcnwiWCjSSWT=rmKmkt3xtHwh%2BsKpA>