Date: Mon, 23 Jan 2012 20:12:32 +0100 From: Pieter de Goeje <pieter@degoeje.nl> To: Info <info@o-notation.org> Cc: freebsd-questions@freebsd.org Subject: Re: kqueue and filenames Message-ID: <4F1DB120.3030103@degoeje.nl> In-Reply-To: <4F1D3BE5.9030607@o-notation.org> References: <4F1D3BE5.9030607@o-notation.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 23-1-2012 11:52, Info wrote: > I'm using kqueue for detecting file-events; for additional information > I add a struct to udata, when registering an event with kevent. > When I delete an event, will be udata deleted too, or do I have to > manage the memory for the structs with an own implementation? It is up to you to free udata. > kevent is triggered when a file is renamed. How do I get the new name? > Is there an extra function? In the moment, I see only the possibility > by searching the filesystem(folder) for a new name. A good question to which I unfortunately do not have the answer to. I think in principle it is impossible to get the file name by file descriptor alone (it could have multiple names). In practice I would just treat NOTE_RENAME as a sequence of unlink/link. I believe tools like lsof use the system name cache to map fds to names, but that is not very reliable. If you need more help with kqueue you might try the hackers@ mailing list, more technical people read that list. Regards, Pieter de Goeje
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F1DB120.3030103>