Mandatory file locks?

From: Eiler, James A. <James.Eiler_at_alcoa.com>
Date: Thu, 29 Mar 2001 09:18:34 -0500

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
Received on Thu Mar 29 2001 - 14:19:26 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:42 NZDT