Add warning that mandatory locking is unreliable.

This commit is contained in:
Michael Kerrisk 2007-11-19 01:34:30 +00:00
parent a406395c86
commit 43ea35457d
1 changed files with 8 additions and 7 deletions

View File

@ -1016,18 +1016,19 @@ Despite this error return, the file descriptor owner is set,
and signals will be sent to the owner.
The implementation of mandatory locking in all known versions of Linux
is subject to races which render it unreliable: a
is subject to races which render it unreliable:
.\" http://marc.info/?l=linux-kernel&m=119013491707153&w=2
a
.BR write (2)
call that overlaps with a lock may modify data after the mandatory lock is
acquired,
acquired;
a
.BR read (2)
call that overlaps with a lock may detect changes to data that were made
only after a write lock was acquired. Similar races exist between lock
and
.BR mmap (2)
. It is therefore inadvisable to rely on mandatory locking.
only after a write lock was acquired.
Similar races exist between mandatory locks and
.BR mmap (2).
It is therefore inadvisable to rely on mandatory locking.
.SH "SEE ALSO"
.BR dup2 (2),
.BR flock (2),