Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!nrl-cmf!ukma!xanth!ames!amdcad!sun!pitstop!sundc!seismo!uunet!mcvax!kth!enea!maxim!prc From: prc@maxim.ERBE.SE (Robert Claeson) Newsgroups: comp.unix.questions Subject: System V file/record locking? Message-ID: <477@maxim.ERBE.SE> Date: 1 Feb 89 18:23:00 GMT Organization: ERBE DATA AB Lines: 26 I was reading through the UNIX System V Programmer's Reference the other night (excellent reading if you can't sleep -- it never fails :-). While reading about file and record locking, the following questions appeared, and I couldn't find any good answers for them in my manuals. If there's someone who knows, please e-mail me. 1. What's the difference between the lockf(3) function and the locking calls to the fcntl(2) system call? Since lockf is a function in the standard library, one would expect it to be implemented using fcntl. If this is not so, does the NFS locking protocol work on fcntl-style locks as well (it works on lockf locks)? 2. lockf always uses "exclusive" locks. Does this mean that it sets a write lock on the file segment? 3. What is the "l_whence" field used for in the flock struct (used as argument to the locking functions of fcntl)? The same thing as in the lseek system call? 4. The documentation mentions a "F_CHKFL" function of fcntl in the man page for fcntl(5). What does this function do and how do I use it? -- Robert Claeson, ERBE DATA AB, P.O. Box 77, S-175 22 Jarfalla, Sweden "No problems." -- Alf Tel: +46 758-202 50 EUnet: rclaeson@ERBE.SE uucp: uunet!erbe.se!rclaeson Fax: +46 758-197 20 Internet: rclaeson@ERBE.SE BITNET: rclaeson@ERBE.SE