SUMMARY: Mandatory file locks?

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

Thanks to quick responses from:

sysadmin_at_astro.su.se
Allan E Johannesen
William_Bochnik

Tru64 does support mandatory locking - in the man pages lockf(3)/fcntl(2)
T64 calls it "enforced locking".

But the best solution is to have the ftp sender transmit the file using a
temporary file name, then, when it's done, have it do a rename of the file.

THANKS!

Jim

-----Original Message-----
From: Eiler, James A. [mailto:James.Eiler_at_alcoa.com]
Sent: Thursday, March 29, 2001 9:19 AM
To: tru64-unix-managers_at_ornl. gov (E-mail)
Subject: Mandatory file locks?


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:51:31 NZST

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