it's advisory lock
when using advisory lock
it is up to programmer to ensure that
whenever access a file or part of that file, acquire its lock first
maybe you need mandantory lock
see the following table
Type of Blocking Nonblocking
existing lock descriptor, descriptor,
on region tries to tries to
held by other
process read write read write
read lock OK blocks OK EAGAIN
write lock blocks blocks EAGAIN EAGAIN
see /usr/src/linux/Documentation/mandatory.txt and relevant chapters in APUE
the steps you need to take are as follows:
chmod g+s file
chmod g-x file
then remount the filesystem which "file" resides with a "mand" option, e.g.
mount -o remount,mand /dev/hda2 /
there you go!