🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1225

Determining if an existant file is open

#1225
From: Jon Nadelberg
Date: Fri, 16 Nov 1990 02:31
35 lines
2007 bytes
We have a program that while running maintains a checkpoint file.  This
file is named based on the users id, and is stored in a specific directory
on the system.  

Our problem occurs when someone tries to start up another process under
the same user id while the first one is running. 

The first concern is that the second process, upon seeing the existence
of the checkpoint file created by the first process think that it needs
to "warmstart" from the first file.  It should not do this.  Second,
once the new process does this, it then re-initializes the checkpoint
file thus corrupting it.  

Our thinking is this: if we can determine whether or not the checkpoint
file is currently open by the first process, we can then make the decision
as to whether or not to continue with a warmstart process, or in the
case of the file still being open, not starting up a checkpoint file
for subsequent processes.
 
Is there a way to check if a file is currently open and being used by
another process?  Is there a way to "lock" a file so that other processes
can not access it?  
 
We are kind of stuck with the implementation staying the way it is.  The only
thing we can do is Band-Aid it, so a redesign of the way it works is
not a practical suggestion at this point.
 
Any help would be appreciated.  
Thank you.

--
------------------------------------------------------------------------
-   Jon Nadelberg                                                      -
-   aeusejvn@csunb.csun.edu                                            -
------------------------------------------------------------------------
Technical Details
Message-ID: <1990Nov16.023110.1305@csun.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!csun!news

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!csun!news
From: aeusejvn@csunb.csun.edu (Jon Nadelberg)
Newsgroups: comp.unix.programmer
Subject: Determining if an existant file is open
Message-ID: <1990Nov16.023110.1305@csun.edu>
Date: 16 Nov 90 02:31:10 GMT
Sender: news@csun.edu (News Administrator)
Organization: csun
Lines: 35