about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-05-30 16:40:38 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-05-31 15:32:05 -0300
commit3593050c27dcf691f670fd3fa9d347c99351ed2f (patch)
treecbf3b67d11237c5ea52ccd47e18f9040c00b88f3
parente2974d26ce228f2d70827659ae6616cbead1b1c4 (diff)
downloadglibc-3593050c27dcf691f670fd3fa9d347c99351ed2f.tar.gz
glibc-3593050c27dcf691f670fd3fa9d347c99351ed2f.tar.xz
glibc-3593050c27dcf691f670fd3fa9d347c99351ed2f.zip
io: Fix F_GETLK, F_SETLK, and F_SETLKW for powerpc64
Different than other 64 bit architectures, powerpc64 defines the
LFS POSIX lock constants  with values similar to 32 ABI, which
are meant to be used with fcntl64 syscall.  Since powerpc64 kABI
does not have fcntl, the constants are adjusted with the
FCNTL_ADJUST_CMD macro.

The 4d0fe291aed3a476a changed the logic of generic constants
LFS value are equal to the default values; which is now wrong
for powerpc64.

Fix the value by explicit define the previous glibc constants
(powerpc64 does not need to use the 32 kABI value, but it simplifies
the FCNTL_ADJUST_CMD which should be kept as compatibility).

Checked on powerpc64-linux-gnu and powerpc-linux-gnu.

(cherry picked from commit 5f828ff824e3b7cd133ef905b8ae25ab8a8f3d66)
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
index 0905cd833c..f7615a447e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
@@ -33,6 +33,12 @@
 # define __O_LARGEFILE	0200000
 #endif
 
+#if __WORDSIZE == 64
+# define F_GETLK	5
+# define F_SETLK	6
+# define F_SETLKW	7
+#endif
+
 struct flock
   {
     short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/