Detecting new file name after receiving kevent's NOTE_RENAME

Ivan Radovanovic radovanovic at gmail.com
Tue Nov 10 07:54:18 UTC 2015


What is the best practice for discovering new file name after receiving 
kevent(2) NOTE_RENAME on its descriptor?

At the moment I am storing fileno from dirent(5) structure together with 
descriptor and name, and when I receive NOTE_RENAME I re-read directory 
and use it (fileno) to discover new name, but this obviously requires 
re-reading entire directory on each NOTE_RENAME.

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)?

Kind regards,
Ivan


More information about the freebsd-hackers mailing list