home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: 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
-
- 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
-