Detecting new file name after receiving kevent's NOTE_RENAME
Ivan Radovanovic
radovanovic at gmail.com
Tue Nov 10 21:23:36 UTC 2015
On 11/10/15 09:14, Konstantin Belousov napisa:
>> >I am wondering is there some more clever way to get this new name
>> >(kernel is obviously aware of it, otherwise it couldn't notify
>> >descriptor about rename)?
>
> The most correct way is to use sysctl kern.proc.filedesc and look
> for the path of the given file descriptor. This is inefficient since
> kern.proc.filedesc returns information about all opened files for the
> process.
Unfortunately it seems that this method (at least using
kinfo_getfile(3)) doesn't work - as soon as file is renamed kf_path
returned contains only zeros. Shame, it sounded like perfect solution
for the problem...
More information about the freebsd-hackers
mailing list