file and record locking questions (general)
Keenan Royle
royle at tope.cs.indiana.edu
Sat Mar 30 03:47:20 AEST 1991
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 at bronze.ucs.indiana.edu> streib at 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 at silver.ucs.indiana.edu)
>
>
--
Keenan Royle
royle at cs.indiana.edu postmaster at cs.indiana.edu
royle at iubacs.bitnet
More information about the Comp.unix.questions
mailing list