I'm using kqueue events to trigger certain programs. The programs run when a file is dropped into a certain directory. To avoid race conditions, I want to know if the newly created or modified files are still open by a process, so I can do what I need to do when no-one else is possibly working on the file. Is there a way, other than repeating the tricks in lsof, to find out if a file is still open from within a c program?

If not would a systemcall like sys_isopen(path, O_WRONLY), where the call returns the or-ed value of the openmodes and-ed with the actual parameter, not be usefull?

--
Stephan

Reply via email to