Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 2015 22:23:32 +0100
From:      Ivan Radovanovic <radovanovic@gmail.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: Detecting new file name after receiving kevent's NOTE_RENAME
Message-ID:  <56426054.2070007@gmail.com>
In-Reply-To: <20151110081421.GL2257@kib.kiev.ua>
References:  <5641A2A5.7070909@gmail.com> <20151110081421.GL2257@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56426054.2070007>