25845f
commit 0961f7e1e300ef633b0c1ad95d0999fb5c169f4e
25845f
Author: Jeff Layton <jlayton@poochiereds.net>
25845f
Date:   Wed Jul 23 14:21:05 2014 -0400
25845f
25845f
    fcntl-linux.h: add new definitions and manual updates for open file description locks
25845f
    
25845f
    Open file description locks have been merged into the Linux kernel for
25845f
    v3.15.  Add the appropriate command-value definitions and an update to
25845f
    the manual that describes their usage.
25845f
25845f
Note by DJ: the implementation doesn't work correctly for 32-bit file
25845f
offsets.  Upstream changed the ABI to compensate but RHEL can't, so we
25845f
enable these only for when file offsets are 64 bits.
25845f
25845f
diff -rup a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
25845f
--- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h	2018-04-13 18:38:24.000000000 -0400
25845f
+++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h	2018-04-13 20:05:21.743234360 -0400
25845f
@@ -117,6 +117,25 @@
25845f
 # define F_SETLKW64	14	/* Set record locking info (blocking).	*/
25845f
 #endif
25845f
 
25845f
+#ifdef __USE_FILE_OFFSET64
25845f
+/* open file description locks.
25845f
+
25845f
+   Usually record locks held by a process are released on *any* close and are
25845f
+   not inherited across a fork.
25845f
+
25845f
+   These cmd values will set locks that conflict with process-associated record
25845f
+   locks, but are "owned" by the opened file description, not the process.
25845f
+   This means that they are inherited across fork or clone with CLONE_FILES
25845f
+   like BSD (flock) locks, and they are only released automatically when the
25845f
+   last reference to the the file description against which they were acquired
25845f
+   is put. */
25845f
+#ifdef __USE_GNU
25845f
+# define F_OFD_GETLK	36
25845f
+# define F_OFD_SETLK	37
25845f
+# define F_OFD_SETLKW	38
25845f
+#endif
25845f
+#endif
25845f
+
25845f
 #ifdef __USE_LARGEFILE64
25845f
 # define O_LARGEFILE __O_LARGEFILE
25845f
 #endif