Xref: utzoo comp.unix.questions:29902 comp.unix.ultrix:6708 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!news.cs.indiana.edu!royle@tope.cs.indiana.edu From: royle@tope.cs.indiana.edu (Keenan Royle) Newsgroups: comp.unix.questions,comp.unix.ultrix,cs.unix.questions Subject: Re: file and record locking questions (general) Keywords: record,locking,ultrix Message-ID: <1991Mar29.124756.18856@news.cs.indiana.edu> Date: 29 Mar 91 17:47:20 GMT References: <1991Mar29.040736.18783@bronze.ucs.indiana.edu> Distribution: na Organization: Computer Science Department, Indiana University Lines: 45 To the best of my knowledge: yes it is portable. (not just Ultrix) flock locks a file. lockf and fcntl can lock records in files (or the whole file). lockf is just a nice front-end to fcntl. All locks are advisory. Ultrix is BSD based. Portablity to system 5 may be trickier. I can't remember the name of the sys5 routine (if it is different) But I have used it. In article <1991Mar29.040736.18783@bronze.ucs.indiana.edu> streib@silver.ucs.indiana.edu (Allan Streib) writes: >Just a couple of general questions on file and record locking under >UNIX: > >(These questions are all based on my study of Ultrix 4.2 man pages) > >- flock (2) and lockf (3) can be used to control concurrent access to >files, allowing cooperating processes to perform consistent operations >on files. I understand that these system calls are advisory, and do >not (apparently) lock the file to non-cooperating processes. > >- I can apparently use fcntl (2) with commands FGETLK, FSETLK, and >FSETLKW to facilitate concurrent file acccess. > >These commands are not mentioned in Rochkind's _Advanced UNIX >Programming_ text. Are these Ultrix enhancements, or are these >portable? > >Thanks for any insight. > >-Allan (streib@silver.ucs.indiana.edu) > > -- Keenan Royle royle@cs.indiana.edu postmaster@cs.indiana.edu royle@iubacs.bitnet