Detecting if a file is busy

der Mouse mouse at
Mon Jul 1 12:33:07 AEST 1991

In article <3300 at>, nto0302 at (Bob Fisher) writes:

> How can one process tell if a file is open in another process?

One can't really.

> I'm writing a daemon that takes files placed into an input directory
> but the daemon needs to wait until the file is closed by the process
> that is creating it.

The creating process will have to cooperate somehow.  There is no
portable way to determine this otherwise; about all you can do is
grovel through kernel data structures, and even then you can't always
get it right (suppose another machine has it mounted via NFS and a
process there is writing it).

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at

More information about the Comp.lang.c mailing list