Newsgroups: comp.lang.c
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!mouse
From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
Subject: Re: Detecting if a file is busy
Message-ID: <1991Jul1.023307.14585@thunder.mcrcim.mcgill.edu>
Organization: McGill Research Centre for Intelligent Machines
References: <3300@dsacg3.dsac.dla.mil>
Date: Mon, 1 Jul 91 02:33:07 GMT
Lines: 21

In article <3300@dsacg3.dsac.dla.mil>, nto0302@dsacg3.dsac.dla.mil (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@larry.mcrcim.mcgill.edu
