Article View: comp.unix.shell
Article #147Re: file locking in shell scripts
From: Tom Christiansen
Date: Fri, 24 Jul 1992 21:01
Date: Fri, 24 Jul 1992 21:01
24 lines
1677 bytes
1677 bytes
From the keyboard of friedman@gnu.ai.mit.edu (Noah Friedman):
:You can easily create a lock file in a C program using
:
: open (lockfile_path, O_CREAT|O_EXCL|..., mode);
:
:This is an atomic operation, so you shouldn't have to worry about any race
:conditions (locally, anyway.. I don't know if anything is guaranteed over
:NFS, including other locking methods!)
Only atomic under UNIX, not under NFS.
You must use the fcntl() method there, and good luck with your
friend lockd.
: Tom or Larry: can perl do this correctly?
It's really more up to the lockdaemon than to perl. Sigh.
--tom
--
Tom Christiansen tchrist@convex.com convex!tchrist
All language designers are arrogant. Goes with the territory... :-)
--Larry Wall in <1991Jul13.010945.19157@netlabs.com
Technical Details
Message-ID:
<1992Jul24.210130.9634@news.eng.convex.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!convex!tchristReferences:
<1992Jul23.124327.20843@cv.ruu.nl> <FRIEDMAN.92Jul24055302@nutrimat.gnu.ai.mit.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!convex!tchrist
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: file locking in shell scripts
Message-ID: <1992Jul24.210130.9634@news.eng.convex.com>
Originator: tchrist@pixel.convex.com
Sender: usenet@news.eng.convex.com (news access account)
Nntp-Posting-Host: pixel.convex.com
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: CONVEX Realtime Development, Colorado Springs, CO
References: <1992Jul23.124327.20843@cv.ruu.nl> <FRIEDMAN.92Jul24055302@nutrimat.gnu.ai.mit.edu>
Date: Fri, 24 Jul 1992 21:01:30 GMT
X-Disclaimer: This message was written by a user at CONVEX Computer
Corp. The opinions expressed are those of the user and
not necessarily those of CONVEX.
Lines: 24