From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <98587553025627.tru64-unix-managers.marc@archive.invalid> From: "Eiler, James A." Date: Thu, 29 Mar 2001 14:18:34 +0000 To: tru64-unix-managers Subject: Mandatory file locks? X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=98587553025627 Hi, I'm trying to find a way to lock a file between "non-cooperating" processes. I've looked at lockf( ), flock( ) and fcntl( ), which do "advisory locking". Any of them will work between cooperating processes - ones which try to lock the file before playing with it. But what about a process which I don't have control over, for example, ftp. One of the problems I'm trying to resolve is knowing when an ftp is complete. I've got some rather large files being ftp'd between machines which are several thousand miles apart. Due to network congestion, etc., it can sometimes take a minute or so for the file to be fully transferred. Meanwhile, on the receiving machine, I've got a process that checks every 15 seconds to see if a new ftp'd file has arrived. If so, it reads and processes the data in the file. Problem is that sometimes the whole file isn't there and my process aborts. I've done some checking on the net and seen references to mandatory file locks - which prevent reads and writes to a file. I was wondering if T64 supports mandatory locks? An example from T64 which suggests that mandatory locks do exist is when I try to make a C program that I've already got executing. The link gives me an error when it tries to overwrite the binary image: "Test file is busy". Seems like some kind of mandatory lock? Thanks! Jim