[Mono-bugs] [Bug 71292][Nor] Changed - File locking files

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 20 Jan 2005 12:47:31 -0500 (EST)

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by dick@ximian.com.


--- shadow/71292	2005-01-18 06:59:21.000000000 -0500
+++ shadow/71292.tmp.19172	2005-01-20 12:47:31.000000000 -0500
@@ -64,6 +64,24 @@
 ------- Additional Comments From dick@ximian.com  2005-01-18 06:59 -------
 *** Bug 71371 has been marked as a duplicate of this bug. ***
+------- Additional Comments From dick@ximian.com  2005-01-20 12:47 -------
+So, it turns out advisory locks are per-process not per-file
+descriptor.  And there is no way for a process to query to see if it
+itself has placed a lock - F_GETLK tests if it's possible to set a new
+lock, and of course if it's the same process then it returns "yes it
+is".  And, get this extra brokenness (from the man page):
+"As well as being removed by an explicit F_UNLCK, record locks are
+automatically released when the process termi­nates or if it closes
+any file descriptor referring to a file on which locks are held.  This
+is bad: it means that a process can lose the locks on a file like
+/etc/passwd or /etc/mtab when for some reason a library function 
+decides to open, read and close it."
+I really don't want to have to maintain lock regions by hand, but it
+looks like I'm going to have to :(