public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] io: Fix F_GETLK64, F_SETLK64, and F_SETLKW64 for powerpc64
@ 2023-05-30 19:54 Adhemerval Zanella
  2023-05-30 21:20 ` Andreas Schwab
  0 siblings, 1 reply; 2+ messages in thread
From: Adhemerval Zanella @ 2023-05-30 19:54 UTC (permalink / raw)
  To: libc-alpha

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.
---
 sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
index 0905cd833c..46ebda7057 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
@@ -33,6 +33,16 @@
 # define __O_LARGEFILE	0200000
 #endif
 
+#if defined(__PPC64__) || defined(__powerpc64__)
+# define F_GETLK	5
+# define F_SETLK	6
+# define F_SETLKW	7
+
+# define F_GETLK64	12
+# define F_SETLK64	13
+# define F_SETLKW64	14
+#endif
+
 struct flock
   {
     short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] io: Fix F_GETLK64, F_SETLK64, and F_SETLKW64 for powerpc64
  2023-05-30 19:54 [PATCH] io: Fix F_GETLK64, F_SETLK64, and F_SETLKW64 for powerpc64 Adhemerval Zanella
@ 2023-05-30 21:20 ` Andreas Schwab
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2023-05-30 21:20 UTC (permalink / raw)
  To: Adhemerval Zanella via Libc-alpha; +Cc: Adhemerval Zanella

On Mai 30 2023, Adhemerval Zanella via Libc-alpha wrote:

> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
> index 0905cd833c..46ebda7057 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
> @@ -33,6 +33,16 @@
>  # define __O_LARGEFILE	0200000
>  #endif
>  
> +#if defined(__PPC64__) || defined(__powerpc64__)

I think this should use __WORDSIZE == 64.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-30 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 19:54 [PATCH] io: Fix F_GETLK64, F_SETLK64, and F_SETLKW64 for powerpc64 Adhemerval Zanella
2023-05-30 21:20 ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).