help about files lock.

help about files lock.

Post by Glen Wil » Tue, 26 May 1998 04:00:00

Unless you have specifically enabled mandatory file locking in your
kernel fcntl() uses advisory locks.  This means that every program
that may be interested in respecting a lock must use fcntl() or a
derivative function to check for, lock and release.


3Com - Carrier Systems R&D  

"UNIX _IS_ user friendly, its just picky about who its friends are."

* Any statements or opinions expressed by me are mine exclusively *
* and have nothing whatsoever to do with my employer...           *


1. Help with file locking and flock()?

I'm writing a program that will store some information in a file.
Obviously, I need to lock the file somehow so that concurrent accesses
won't corrupt the storage, and the information in the file must be
accurate and update with each execution of the program. So I wrote some
code to use flock(), but I can't see to find flock()'s declaration in
any of the headers. The man page says that <sys/file.h> should be
#include'd, but gcc still gives me a warning that I'm making an implicit
declaration of flock(). What's the deal? I did a grep on all the header
files in /usr/include and its subdirectories, and none of them contain a
declaration for flock().

I'm using a DEC Alpha with OSF/1 3.2 and gcc 2.7.0 with -Wall and
-pedantic switches.


2. What is an SUID? When can I use it?

3. Help in file locking !

4. Looking for crash/desaster recovery software

5. help: nfs3 / file locking

6. ncpfs with NDS

7. More mail file locking questions (lockf, NFS, /var/spool/mail/*.lock)

8. DNS problem

9. Locked files - who has it locked?

10. "Can't read lock file /tmp/.X0-lock"

11. modem locked but I can't find the lock file

12. Apache: Cannot open lock file: /usr/logs/httpd.lock.10064

13. how to remove a lock from a locked file?