[comp.unix.internals] How to tell if a file is open by another process?

andyc@bucky.intel.com (Andy Crump) (11/30/90)

>>>>> On 19 Nov 90 23:09:04 GMT, bunyip@world.std.com (Jason W May) said:


Jason> I am trying to figure out how to determine if an existing file is
Jason> already open by another process (over which I have no control).
Jason> In this case, the other process is the ftp daemon: I am watching
Jason> a particular directory for files to appear, and I want to be able
Jason> to tell if an incoming file has been completely transferred.
Jason> Is there a way to do this, besides watching to see if the file size
Jason> changes?

In System V Release 4.0, there is a utility called fuser.  It takes a
file/directory as a parameter and returns a list of process ids (and
optionally the login id) of the processes that have that
file/directory open.

There is also a public domain program called ofiles that does
something similar.  Check the usenet archives.  Maybe someone knows
just where ofiles can be found.
--

    -- Andy Crump

    ...!tektronix!reed!littlei!andyc | andyc@littlei.intel.com
    ...!uunet!littlei!andyc          | andyc@littlei.uu.net

Disclaimer: Any opinions expressed here are my own and 
            not representive of Intel Corportation.