From 43ea35457d386a8a52feeb7b5f952ef51c3d5584 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Mon, 19 Nov 2007 01:34:30 +0000 Subject: [PATCH] Add warning that mandatory locking is unreliable. --- man2/fcntl.2 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/man2/fcntl.2 b/man2/fcntl.2 index e6d3b1a3e..39011092f 100644 --- a/man2/fcntl.2 +++ b/man2/fcntl.2 @@ -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),