home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / shell / 3129 < prev    next >
Encoding:
Text File  |  1992-07-25  |  1.6 KB  |  42 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!convex!tchrist
  3. From: Tom Christiansen <tchrist@convex.COM>
  4. Subject: Re: file locking in shell scripts
  5. Message-ID: <1992Jul24.210130.9634@news.eng.convex.com>
  6. Originator: tchrist@pixel.convex.com
  7. Sender: usenet@news.eng.convex.com (news access account)
  8. Nntp-Posting-Host: pixel.convex.com
  9. Reply-To: tchrist@convex.COM (Tom Christiansen)
  10. Organization: CONVEX Realtime Development, Colorado Springs, CO
  11. References: <1992Jul23.124327.20843@cv.ruu.nl> <FRIEDMAN.92Jul24055302@nutrimat.gnu.ai.mit.edu>
  12. Date: Fri, 24 Jul 1992 21:01:30 GMT
  13. X-Disclaimer: This message was written by a user at CONVEX Computer
  14.               Corp. The opinions expressed are those of the user and
  15.               not necessarily those of CONVEX.
  16. Lines: 24
  17.  
  18. From the keyboard of friedman@gnu.ai.mit.edu (Noah Friedman):
  19. :You can easily create a lock file in a C program using
  20. :
  21. :            open (lockfile_path, O_CREAT|O_EXCL|..., mode);
  22. :
  23. :This is an atomic operation, so you shouldn't have to worry about any race
  24. :conditions (locally, anyway.. I don't know if anything is guaranteed over
  25. :NFS, including other locking methods!)
  26.  
  27. Only atomic under UNIX, not under NFS.
  28.  
  29. You must use the fcntl() method there, and good luck with your 
  30. friend lockd.
  31.  
  32. :   Tom or Larry: can perl do this correctly?
  33.  
  34. It's really more up to the lockdaemon than to perl.  Sigh.
  35.  
  36. --tom
  37. -- 
  38.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  39.  
  40.     All language designers are arrogant.  Goes with the territory... :-)
  41.         --Larry Wall in <1991Jul13.010945.19157@netlabs.com
  42.