* [PATCH v2 2/2] Update sysvipc kernel-features.h files for Linux 5.1
2019-05-20 17:53 [PATCH v2 1/2] ipc: Refactor sysvipc internal definitions Adhemerval Zanella
@ 2019-05-20 17:53 ` Adhemerval Zanella
2019-05-20 19:10 ` Joseph Myers
2019-08-28 14:07 ` Adhemerval Zanella
2019-08-09 12:18 ` [PATCH v2 1/2] ipc: Refactor sysvipc internal definitions Adhemerval Zanella
1 sibling, 2 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2019-05-20 17:53 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Fixed condition to use wire-up syscalls for semop and semtimedop.
--
Linux 5.1 adds missing SySV IPC syscalls to the syscall table for
remanining one that still uses the ipc syscall on glibc (m68k, mips-o32,
powerpc, s390, sh, and sparc32). However the newly added direct ipc
syscall are different than the old ones:
1. They do not expect IPC_64, meaning __IPC_64 should be set to zero
when new syscalls are used. And new syscalls can not be used
for compat functions like __old_semctl (to emulated old sysvipc it
requires to use the old __NR_ipc syscall without __IPC_64).
Thus IPC_64 is redefined for newer kernels on affected ABIs.
2. semtimedop and semop does not exist on 32-bit ABIs (only
semtimedop_time64 is supplied). The provided syscall wrappers only
uses the wire-up syscall if __NR_semtimedop and __NR_semop are
also defined.
Checked on x86_64-linux-gnu and i686-linux-gnu on both a 4.15 kernel
configure with default options and sysvipc tests on a 5.1.2 kernel with
--enable-kernel=5.1.
* sysdeps/unix/sysv/linux/i386/kernel-features.h.
(__ASSUME_DIRECT_SYSVIPC_SYSCALLS): Only undefine if
[__LINUX_KERNEL_VERSION < 0x050100].
(__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/msgctl.c (__old_msgctl): Only use wire-up
syscall if __ASSUME_SYSVIPC_DEFAULT_IPC_64 is not defined.
* sysdeps/unix/sysv/linux/semctl.c (__old_semctl): Likewise.
* sysdeps/unix/sysv/linux/shmctl.c (__old_shmctl): Likewise.
* sysdeps/unix/sysv/linux/semop.c (semop): Only use wire-up if
__NR_semop is also defined.
* sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Likewise.
---
sysdeps/unix/sysv/linux/i386/kernel-features.h | 8 +++++---
sysdeps/unix/sysv/linux/m68k/kernel-features.h | 8 +++++---
sysdeps/unix/sysv/linux/mips/kernel-features.h | 12 ++++++++----
sysdeps/unix/sysv/linux/msgctl.c | 6 +++++-
sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 8 +++++---
sysdeps/unix/sysv/linux/s390/kernel-features.h | 8 +++++---
sysdeps/unix/sysv/linux/semctl.c | 6 +++++-
sysdeps/unix/sysv/linux/semop.c | 4 +++-
sysdeps/unix/sysv/linux/semtimedop.c | 4 +++-
sysdeps/unix/sysv/linux/sh/kernel-features.h | 8 +++++---
sysdeps/unix/sysv/linux/shmctl.c | 6 +++++-
sysdeps/unix/sysv/linux/sparc/kernel-features.h | 10 ++++++----
12 files changed, 60 insertions(+), 28 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 411eb2fca4..8c398ddd1f 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -43,9 +43,11 @@
# undef __ASSUME_SENDTO_SYSCALL
#endif
-/* i686 only supports ipc syscall. */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+/* i686 only supports ipc syscall before 5.1. */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+#endif
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS 1
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 46418977c8..c9be6bc167 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -50,6 +50,8 @@
# undef __ASSUME_SET_ROBUST_LIST
#endif
-/* m68k only supports ipc syscall. */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+/* m68k only supports ipc syscall before 5.1. */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+#endif
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index b9fa89c81d..8c85193a7a 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -31,8 +31,12 @@
pairs to start with an even-number register. */
#if _MIPS_SIM == _ABIO32
# define __ASSUME_ALIGNED_REGISTER_PAIRS 1
-/* mips32 only supports ipc syscall. */
-# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+/* mips32 only supports ipc syscall before 5.1. */
+# if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+# else
+# endif
/* The o32 MIPS fadvise64 syscall behaves as fadvise64_64. */
# define __ASSUME_FADVISE64_AS_64_64 1
@@ -40,6 +44,8 @@
/* mips32 support wire-up network syscalls. */
# define __ASSUME_RECV_SYSCALL 1
# define __ASSUME_SEND_SYSCALL 1
+#else
+# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
#endif
/* Define that mips64-n32 is a ILP32 ABI to set the correct interface to
@@ -50,5 +56,3 @@
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS 1
-
-#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
index 2d49567686..1f034ebc6f 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -61,7 +61,11 @@ int
attribute_compat_text_section
__old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
{
-#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#if defined(__ASSUME_DIRECT_SYSVIPC_SYSCALLS) \
+ && !defined(__ASSUME_SYSVIPC_DEFAULT_IPC_64)
+ /* For architecture that have wire-up msgctl but also have __IPC_64 to a
+ value different than default (0x0), it means the old syscall was done
+ using __NR_ipc. */
return INLINE_SYSCALL_CALL (msgctl, msqid, cmd, buf);
#else
return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf);
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index e787182396..fd2f22d730 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -44,9 +44,11 @@
#include_next <kernel-features.h>
-/* powerpc only supports ipc syscall. */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+/* powerpc only supports ipc syscall before 5.1. */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+#endif
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS 1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 57077ea4cc..7997a78e1d 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -45,9 +45,11 @@
# undef __ASSUME_SENDTO_SYSCALL
#endif
-/* s390 only supports ipc syscall. */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+/* s390 only supports ipc syscall before 5.1. */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+#endif
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS2
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index d428400681..46bce6baac 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -98,7 +98,11 @@ __old_semctl (int semid, int semnum, int cmd, ...)
break;
}
-# ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#if defined(__ASSUME_DIRECT_SYSVIPC_SYSCALLS) \
+ && !defined(__ASSUME_SYSVIPC_DEFAULT_IPC_64)
+ /* For architecture that have wire-up semctl but also have __IPC_64 to a
+ value different than default (0x0), it means the old syscall was done
+ using __NR_ipc. */
return INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd, arg.array);
# else
return INLINE_SYSCALL_CALL (ipc, IPCOP_semctl, semid, semnum, cmd,
diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
index 119ee06878..e401f3487b 100644
--- a/sysdeps/unix/sysv/linux/semop.c
+++ b/sysdeps/unix/sysv/linux/semop.c
@@ -26,7 +26,9 @@
int
semop (int semid, struct sembuf *sops, size_t nsops)
{
-#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ /* semop wire-up syscall is not exported for 32-bit ABIs (they have
+ semtimedop_time64 instead with uses a 64-bit time_t). */
+#if defined(__ASSUME_DIRECT_SYSVIPC_SYSCALLS) && defined (__NR_semop)
return INLINE_SYSCALL_CALL (semop, semid, sops, nsops);
#else
return INLINE_SYSCALL_CALL (ipc, IPCOP_semop, semid, nsops, 0, sops);
diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c
index 1d746c4117..589ffc3fc8 100644
--- a/sysdeps/unix/sysv/linux/semtimedop.c
+++ b/sysdeps/unix/sysv/linux/semtimedop.c
@@ -27,7 +27,9 @@ int
semtimedop (int semid, struct sembuf *sops, size_t nsops,
const struct timespec *timeout)
{
-#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ /* semtimedop wire-up syscall is not exported for 32-bit ABIs (they have
+ semtimedop_time64 instead with uses a 64-bit time_t). */
+#if defined(__ASSUME_DIRECT_SYSVIPC_SYSCALLS) && defined (__NR_semtimedop)
return INLINE_SYSCALL_CALL (semtimedop, semid, sops, nsops, timeout);
#else
return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid,
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index cf68256abe..1721b89158 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -41,9 +41,11 @@
before the offset. */
#define __ASSUME_PRW_DUMMY_ARG 1
-/* sh only supports ipc syscall. */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+/* sh only supports ipc syscall before 5.1. */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+#endif
/* Support for several syscalls was added in 4.8. */
#if __LINUX_KERNEL_VERSION < 0x040800
diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
index b322f205f8..40aa115b24 100644
--- a/sysdeps/unix/sysv/linux/shmctl.c
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -63,7 +63,11 @@ int
attribute_compat_text_section
__old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf)
{
-#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#if defined(__ASSUME_DIRECT_SYSVIPC_SYSCALLS) \
+ && !defined(__ASSUME_SYSVIPC_DEFAULT_IPC_64)
+ /* For architecture that have wire-up shmctl but also have __IPC_64 to a
+ value different than default (0x0), it means the old syscall was done
+ using __NR_ipc. */
return INLINE_SYSCALL_CALL (shmctl, shmid, cmd, buf);
#else
return INLINE_SYSCALL_CALL (ipc, IPCOP_shmctl, shmid, cmd, 0, buf);
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 82c8236c23..b8f2212002 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -58,10 +58,12 @@
# undef __NR_pause
#endif
-/* sparc only supports ipc syscall. */
-#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-#ifndef __arch64__
-# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+/* sparc only supports ipc syscall before 5.1. */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+# if !defined __arch64__
+# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+# endif
#endif
/* Support for the renameat2 syscall was added in 3.16. */
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] ipc: Refactor sysvipc internal definitions
@ 2019-05-20 17:53 Adhemerval Zanella
2019-05-20 17:53 ` [PATCH v2 2/2] Update sysvipc kernel-features.h files for Linux 5.1 Adhemerval Zanella
2019-08-09 12:18 ` [PATCH v2 1/2] ipc: Refactor sysvipc internal definitions Adhemerval Zanella
0 siblings, 2 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2019-05-20 17:53 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Added __ASSUME_SYSVIPC_DEFAULT_IPC_64 instead of redefine __IPC_64
on kernel-features.h. The new assume macro is used to setup the
__IPC_64 value on ipc-priv.h.
- Annexed the 'ipc: Refactor sysvipc compat type' to make it possible
share the generic ipc_priv.h definions for all architectures.
--
This patch refactor the internal sysvipc in two main points:
1. Add a new __ASSUME_SYSVIPC_DEFAULT_IPC_64 to infer the __IPC_64
value in wire-up or ipc syscall. The defaut value assumed for
__IPC_64 is also changed from 0x100 to 0x0, aligning with Linux
generic UAPI. The idea is to simplify the Linux 5.1 wire-up for
sysvipc syscalls for some 32-bit ABIs (which expectes __IPC_64
being 0x0) and simplify new ports (which would not require add
a ipc_priv.h to override the __IPC_64 value).
2. It removes some duplicated definition from sysvipc compat code
at ipc_priv.h. The idea is also to make it simpler to enable
the new wireup sysvipc on Linux v5.1.
There is no semantic change expected on any port. Checked with a build
against all affected ABIs.
* sysdeps/unix/sysv/linux/ipc_priv.h (__OLD_IPC_ID_TYPE,
__OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
(__old_ipc_perm): Use the new defines.
* sysdeps/unix/sysv/linux/alpha/ipc_priv.h (__OLD_IPC_ID_TYPE,
__OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
(__old_ipc_perm): Use the new defines.
* sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h (__OLD_IPC_ID_TYPE,
__OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
(__old_ipc_perm): Use the new defines.
* sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (__OLD_IPC_ID_TYPE,
__OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
(__old_ipc_perm): Use the new defines.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_SYSVIPC_DEFAULT_IPC_64): Define.
* sysdeps/unix/sysv/linux/alpha/kernel-features.h
(__ASSUME_SYSVIPC_DEFAULT_IPC_64): Undefine.
* sysdeps/unix/sysv/linux/arm/kernel-features.h
(__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
(__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
[!__arch64__] (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
* sysdeps/unix/sysv/linux/nios2/kernel-features.h: New file.
* sysdeps/unix/sysv/linux/hppa/ipc_priv.h: Remove file.
* sysdeps/unix/sysv/linux/ia64/ipc_priv.h: Likewise.
* sysdeps/unix/sysv/linux/nios2/ipc_priv.h: Likewise.
* sysdeps/unix/sysv/linux/csky/ipc_priv.h: Likewise.
* sysdeps/unix/sysv/linux/riscv/ipc_priv.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/ipc_priv.h: Likewise.
---
sysdeps/unix/sysv/linux/alpha/ipc_priv.h | 18 +++--------
.../unix/sysv/linux/alpha/kernel-features.h | 3 ++
sysdeps/unix/sysv/linux/arm/kernel-features.h | 2 ++
sysdeps/unix/sysv/linux/hppa/ipc_priv.h | 21 ------------
.../unix/sysv/linux/i386/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/ia64/ipc_priv.h | 21 ------------
sysdeps/unix/sysv/linux/ipc_priv.h | 31 +++++++++++++-----
sysdeps/unix/sysv/linux/kernel-features.h | 3 ++
.../unix/sysv/linux/m68k/kernel-features.h | 1 +
.../sysv/linux/microblaze/kernel-features.h | 2 ++
.../unix/sysv/linux/mips/kernel-features.h | 2 ++
.../unix/sysv/linux/mips/mips64/ipc_priv.h | 18 +++--------
sysdeps/unix/sysv/linux/nios2/ipc_priv.h | 21 ------------
.../ipc_priv.h => nios2/kernel-features.h} | 11 ++++---
sysdeps/unix/sysv/linux/powerpc/ipc_priv.h | 25 +++------------
.../unix/sysv/linux/powerpc/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/riscv/ipc_priv.h | 21 ------------
.../unix/sysv/linux/s390/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/sh/kernel-features.h | 1 +
.../unix/sysv/linux/sparc/kernel-features.h | 3 ++
.../unix/sysv/linux/sparc/sparc64/ipc_priv.h | 20 ++++--------
sysdeps/unix/sysv/linux/x86_64/ipc_priv.h | 32 -------------------
22 files changed, 67 insertions(+), 192 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/hppa/ipc_priv.h
delete mode 100644 sysdeps/unix/sysv/linux/ia64/ipc_priv.h
delete mode 100644 sysdeps/unix/sysv/linux/nios2/ipc_priv.h
rename sysdeps/unix/sysv/linux/{csky/ipc_priv.h => nios2/kernel-features.h} (69%)
delete mode 100644 sysdeps/unix/sysv/linux/riscv/ipc_priv.h
delete mode 100644 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
diff --git a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
index fc5e713f42..fa79bddcf3 100644
--- a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
@@ -16,17 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <sys/ipc.h> /* For __key_t */
-
-#define __IPC_64 0x100
-
-struct __old_ipc_perm
-{
- __key_t __key; /* Key. */
- unsigned int uid; /* Owner's user ID. */
- unsigned int gid; /* Owner's group ID. */
- unsigned int cuid; /* Creator's user ID. */
- unsigned int cgid; /* Creator's group ID. */
- unsigned int mode; /* Read/write permission. */
- unsigned short int __seq; /* Sequence number. */
-};
+#define __OLD_IPC_ID_TYPE unsigned int
+#define __OLD_IPC_MODE_TYPE unsigned int
+#define __OLD_IPC_SEQ_TYPE unsigned short int
+#include <sysdeps/unix/sysv/linux/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
index 4a5d029c1d..f3aab5bcee 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
@@ -53,4 +53,7 @@
# undef __ASSUME_STATX
#endif
+/* Alpha support old sysvipc even being a 64-bit architecture. */
+#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+
#endif /* _KERNEL_FEATURES_H */
diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
index 2d2d355844..75ac97a82f 100644
--- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -50,3 +50,5 @@
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS 1
+
+#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
diff --git a/sysdeps/unix/sysv/linux/hppa/ipc_priv.h b/sysdeps/unix/sysv/linux/hppa/ipc_priv.h
deleted file mode 100644
index 5e170a9a2b..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/ipc_priv.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Old SysV permission definition for Linux. Hppa version.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sys/ipc.h> /* For __key_t */
-
-#define __IPC_64 0x0
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 3ac725b5a2..411eb2fca4 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -45,6 +45,7 @@
/* i686 only supports ipc syscall. */
#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS 1
diff --git a/sysdeps/unix/sysv/linux/ia64/ipc_priv.h b/sysdeps/unix/sysv/linux/ia64/ipc_priv.h
deleted file mode 100644
index 6b2438cd03..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/ipc_priv.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Old SysV permission definition for Linux. IA64 version.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sys/ipc.h> /* For __key_t */
-
-#define __IPC_64 0x0
diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
index 1d1bd19541..d387b44c8f 100644
--- a/sysdeps/unix/sysv/linux/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/ipc_priv.h
@@ -17,18 +17,33 @@
<http://www.gnu.org/licenses/>. */
#include <sys/ipc.h> /* For __key_t */
-
-#define __IPC_64 0x100
+#include <kernel-features.h>
+
+#ifdef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+# define __IPC_64 0x0
+#else
+# define __IPC_64 0x100
+#endif
+
+#ifndef __OLD_IPC_ID_TYPE
+# define __OLD_IPC_ID_TYPE unsigned short int
+#endif
+#ifndef __OLD_IPC_MODE_TYPE
+# define __OLD_IPC_MODE_TYPE unsigned short int
+#endif
+#ifndef __OLD_IPC_SEQ_TYPE
+# define __OLD_IPC_SEQ_TYPE unsigned short int
+#endif
struct __old_ipc_perm
{
__key_t __key; /* Key. */
- unsigned short int uid; /* Owner's user ID. */
- unsigned short int gid; /* Owner's group ID. */
- unsigned short int cuid; /* Creator's user ID. */
- unsigned short int cgid; /* Creator's group ID. */
- unsigned short int mode; /* Read/write permission. */
- unsigned short int __seq; /* Sequence number. */
+ __OLD_IPC_ID_TYPE uid; /* Owner's user ID. */
+ __OLD_IPC_ID_TYPE gid; /* Owner's group ID. */
+ __OLD_IPC_ID_TYPE cuid; /* Creator's user ID. */
+ __OLD_IPC_ID_TYPE cgid; /* Creator's group ID. */
+ __OLD_IPC_MODE_TYPE mode; /* Read/write permission. */
+ __OLD_IPC_SEQ_TYPE __seq; /* Sequence number. */
};
#define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index bc5c959f58..fa99a11c2d 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -80,6 +80,9 @@
/* Support for SysV IPC through wired syscalls. All supported architectures
either support ipc syscall and/or all the ipc correspondent syscalls. */
#define __ASSUME_DIRECT_SYSVIPC_SYSCALLS 1
+/* The generic default __IPC_64 value is 0x0, however some architectures
+ require a different value of 0x100. */
+#define __ASSUME_SYSVIPC_DEFAULT_IPC_64 1
/* Support for p{read,write}v2 was added in 4.6. However Linux default
implementation does not assume the __ASSUME_* and instead use a fallback
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 1976724362..46418977c8 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -52,3 +52,4 @@
/* m68k only supports ipc syscall. */
#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 8df19400af..bed0c4a4e5 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -72,3 +72,5 @@
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS3
+
+#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index c341c3fa10..b9fa89c81d 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -50,3 +50,5 @@
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS 1
+
+#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
index bb31656069..682ec35662 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
@@ -16,17 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <sys/ipc.h>
-
-#define __IPC_64 0x100
-
-struct __old_ipc_perm
-{
- __key_t __key; /* Key. */
- int uid; /* Owner's user ID. */
- int gid; /* Owner's group ID. */
- int cuid; /* Creator's user ID. */
- int cgid; /* Creator's group ID. */
- int mode; /* Read/write permission. */
- unsigned short int __seq; /* Sequence number. */
-};
+#define __OLD_IPC_ID_TYPE int
+#define __OLD_IPC_MODE_TYPE int
+#define __OLD_IPC_SEQ_TYPE unsigned short int
+#include <sysdeps/unix/sysv/linux/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/nios2/ipc_priv.h b/sysdeps/unix/sysv/linux/nios2/ipc_priv.h
deleted file mode 100644
index d6e6be797a..0000000000
--- a/sysdeps/unix/sysv/linux/nios2/ipc_priv.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Old SysV permission definition for Linux. Nios II version.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sys/ipc.h> /* For __key_t */
-
-#define __IPC_64 0x0
diff --git a/sysdeps/unix/sysv/linux/csky/ipc_priv.h b/sysdeps/unix/sysv/linux/nios2/kernel-features.h
similarity index 69%
rename from sysdeps/unix/sysv/linux/csky/ipc_priv.h
rename to sysdeps/unix/sysv/linux/nios2/kernel-features.h
index e1beadb2a0..7f4023831e 100644
--- a/sysdeps/unix/sysv/linux/csky/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/nios2/kernel-features.h
@@ -1,5 +1,6 @@
-/* Old SysV permission definition for Linux. C-SKY version.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
+/* Set flags signalling availability of kernel features based on given
+ kernel version number. NIOS2 version.
+ Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,9 +14,9 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
+ License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <sys/ipc.h> /* For __key_t */
+#include_next <kernel-features.h>
-#define __IPC_64 0x0
+#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
index 3450933f56..f641ed9a32 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
@@ -16,24 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <sys/ipc.h> /* For __key_t */
-
-#define __IPC_64 0x100
-
-struct __old_ipc_perm
-{
- __key_t __key; /* Key. */
- unsigned int uid; /* Owner's user ID. */
- unsigned int gid; /* Owner's group ID. */
- unsigned int cuid; /* Creator's user ID. */
- unsigned int cgid; /* Creator's group ID. */
- unsigned int mode; /* Read/write permission. */
- unsigned short int __seq; /* Sequence number. */
-};
-
-#define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
-
-#define MSGRCV_ARGS(__msgp, __msgtyp) \
- ((long int []){ (long int) __msgp, __msgtyp })
-
-#include <ipc_ops.h>
+#define __OLD_IPC_ID_TYPE unsigned int
+#define __OLD_IPC_MODE_TYPE unsigned int
+#define __OLD_IPC_SEQ_TYPE unsigned short int
+#include <sysdeps/unix/sysv/linux/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 413a185db3..e787182396 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -46,6 +46,7 @@
/* powerpc only supports ipc syscall. */
#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS 1
diff --git a/sysdeps/unix/sysv/linux/riscv/ipc_priv.h b/sysdeps/unix/sysv/linux/riscv/ipc_priv.h
deleted file mode 100644
index ea957a56be..0000000000
--- a/sysdeps/unix/sysv/linux/riscv/ipc_priv.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Old SysV permission definition for Linux. RISC-V version.
- Copyright (C) 2018-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sys/ipc.h> /* For __key_t */
-
-#define __IPC_64 0x0
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 8fdf38c454..57077ea4cc 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -47,6 +47,7 @@
/* s390 only supports ipc syscall. */
#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS2
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index b11a5cb544..cf68256abe 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -43,6 +43,7 @@
/* sh only supports ipc syscall. */
#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
/* Support for several syscalls was added in 4.8. */
#if __LINUX_KERNEL_VERSION < 0x040800
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index f441bd811d..82c8236c23 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -60,6 +60,9 @@
/* sparc only supports ipc syscall. */
#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#ifndef __arch64__
+# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
+#endif
/* Support for the renameat2 syscall was added in 3.16. */
#if __LINUX_KERNEL_VERSION < 0x031000
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
index 8936aed022..3d813fe9e6 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
@@ -16,26 +16,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <sys/ipc.h> /* For __key_t */
-
-#define __IPC_64 0x0
-
-struct __old_ipc_perm
-{
- __key_t __key; /* Key. */
- unsigned int uid; /* Owner's user ID. */
- unsigned int gid; /* Owner's group ID. */
- unsigned int cuid; /* Creator's user ID. */
- unsigned int cgid; /* Creator's group ID. */
- unsigned int mode; /* Read/write permission. */
- unsigned short int __seq; /* Sequence number. */
-};
+#define __OLD_IPC_ID_TYPE unsigned int
+#define __OLD_IPC_MODE_TYPE unsigned int
+#define __OLD_IPC_SEQ_TYPE unsigned short int
+#include <sysdeps/unix/sysv/linux/ipc_priv.h>
/* SPARC semctl multiplex syscall expects the union pointed address, not
the union address itself. */
+#undef SEMCTL_ARG_ADDRESS
#define SEMCTL_ARG_ADDRESS(__arg) __arg.array
/* Also for msgrcv it does not use the kludge on final 2 arguments. */
+#undef MSGRCV_ARGS
#define MSGRCV_ARGS(__msgp, __msgtyp) __msgp, __msgtyp
#include <ipc_ops.h>
diff --git a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h b/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
deleted file mode 100644
index 1ac288aa65..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Old SysV permission definition for Linux. x86_64 version.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sys/ipc.h> /* For __key_t */
-
-#define __IPC_64 0x0
-
-struct __old_ipc_perm
-{
- __key_t __key; /* Key. */
- unsigned short uid; /* Owner's user ID. */
- unsigned short gid; /* Owner's group ID. */
- unsigned short cuid; /* Creator's user ID. */
- unsigned short cgid; /* Creator's group ID. */
- unsigned short mode; /* Read/write permission. */
- unsigned short int __seq; /* Sequence number. */
-};
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] Update sysvipc kernel-features.h files for Linux 5.1
2019-05-20 17:53 ` [PATCH v2 2/2] Update sysvipc kernel-features.h files for Linux 5.1 Adhemerval Zanella
@ 2019-05-20 19:10 ` Joseph Myers
2019-05-20 19:20 ` Adhemerval Zanella
2019-08-28 14:07 ` Adhemerval Zanella
1 sibling, 1 reply; 7+ messages in thread
From: Joseph Myers @ 2019-05-20 19:10 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
As a general issue in this patch, you're missing spaces before '(' in
calls to 'defined'. 'defined' should be treated like a function for this
purpose, and have such spaces (the parentheses are optional, you can just
do "defined MACRO").
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] Update sysvipc kernel-features.h files for Linux 5.1
2019-05-20 19:10 ` Joseph Myers
@ 2019-05-20 19:20 ` Adhemerval Zanella
0 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2019-05-20 19:20 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha
On 20/05/2019 16:10, Joseph Myers wrote:
> As a general issue in this patch, you're missing spaces before '(' in
> calls to 'defined'. 'defined' should be treated like a function for this
> purpose, and have such spaces (the parentheses are optional, you can just
> do "defined MACRO").
>
Alright, I change it locally to add the required spaces. Thanks for pointing
this out.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] ipc: Refactor sysvipc internal definitions
2019-05-20 17:53 [PATCH v2 1/2] ipc: Refactor sysvipc internal definitions Adhemerval Zanella
2019-05-20 17:53 ` [PATCH v2 2/2] Update sysvipc kernel-features.h files for Linux 5.1 Adhemerval Zanella
@ 2019-08-09 12:18 ` Adhemerval Zanella
2019-08-28 14:06 ` Adhemerval Zanella
1 sibling, 1 reply; 7+ messages in thread
From: Adhemerval Zanella @ 2019-08-09 12:18 UTC (permalink / raw)
To: libc-alpha
Ping.
On 20/05/2019 14:53, Adhemerval Zanella wrote:
> Changes from previous version:
>
> - Added __ASSUME_SYSVIPC_DEFAULT_IPC_64 instead of redefine __IPC_64
> on kernel-features.h. The new assume macro is used to setup the
> __IPC_64 value on ipc-priv.h.
>
> - Annexed the 'ipc: Refactor sysvipc compat type' to make it possible
> share the generic ipc_priv.h definions for all architectures.
>
> --
>
> This patch refactor the internal sysvipc in two main points:
>
> 1. Add a new __ASSUME_SYSVIPC_DEFAULT_IPC_64 to infer the __IPC_64
> value in wire-up or ipc syscall. The defaut value assumed for
> __IPC_64 is also changed from 0x100 to 0x0, aligning with Linux
> generic UAPI. The idea is to simplify the Linux 5.1 wire-up for
> sysvipc syscalls for some 32-bit ABIs (which expectes __IPC_64
> being 0x0) and simplify new ports (which would not require add
> a ipc_priv.h to override the __IPC_64 value).
>
> 2. It removes some duplicated definition from sysvipc compat code
> at ipc_priv.h. The idea is also to make it simpler to enable
> the new wireup sysvipc on Linux v5.1.
>
> There is no semantic change expected on any port. Checked with a build
> against all affected ABIs.
>
> * sysdeps/unix/sysv/linux/ipc_priv.h (__OLD_IPC_ID_TYPE,
> __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
> (__old_ipc_perm): Use the new defines.
> * sysdeps/unix/sysv/linux/alpha/ipc_priv.h (__OLD_IPC_ID_TYPE,
> __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
> (__old_ipc_perm): Use the new defines.
> * sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h (__OLD_IPC_ID_TYPE,
> __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
> (__old_ipc_perm): Use the new defines.
> * sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (__OLD_IPC_ID_TYPE,
> __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
> (__old_ipc_perm): Use the new defines.
> * sysdeps/unix/sysv/linux/kernel-features.h
> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Define.
> * sysdeps/unix/sysv/linux/alpha/kernel-features.h
> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Undefine.
> * sysdeps/unix/sysv/linux/arm/kernel-features.h
> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/i386/kernel-features.h
> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/m68k/kernel-features.h
> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/mips/kernel-features.h
> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/s390/kernel-features.h
> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/sh/kernel-features.h
> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/sparc/kernel-features.h
> [!__arch64__] (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/nios2/kernel-features.h: New file.
> * sysdeps/unix/sysv/linux/hppa/ipc_priv.h: Remove file.
> * sysdeps/unix/sysv/linux/ia64/ipc_priv.h: Likewise.
> * sysdeps/unix/sysv/linux/nios2/ipc_priv.h: Likewise.
> * sysdeps/unix/sysv/linux/csky/ipc_priv.h: Likewise.
> * sysdeps/unix/sysv/linux/riscv/ipc_priv.h: Likewise.
> * sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h: Likewise.
> * sysdeps/unix/sysv/linux/x86_64/ipc_priv.h: Likewise.
> ---
> sysdeps/unix/sysv/linux/alpha/ipc_priv.h | 18 +++--------
> .../unix/sysv/linux/alpha/kernel-features.h | 3 ++
> sysdeps/unix/sysv/linux/arm/kernel-features.h | 2 ++
> sysdeps/unix/sysv/linux/hppa/ipc_priv.h | 21 ------------
> .../unix/sysv/linux/i386/kernel-features.h | 1 +
> sysdeps/unix/sysv/linux/ia64/ipc_priv.h | 21 ------------
> sysdeps/unix/sysv/linux/ipc_priv.h | 31 +++++++++++++-----
> sysdeps/unix/sysv/linux/kernel-features.h | 3 ++
> .../unix/sysv/linux/m68k/kernel-features.h | 1 +
> .../sysv/linux/microblaze/kernel-features.h | 2 ++
> .../unix/sysv/linux/mips/kernel-features.h | 2 ++
> .../unix/sysv/linux/mips/mips64/ipc_priv.h | 18 +++--------
> sysdeps/unix/sysv/linux/nios2/ipc_priv.h | 21 ------------
> .../ipc_priv.h => nios2/kernel-features.h} | 11 ++++---
> sysdeps/unix/sysv/linux/powerpc/ipc_priv.h | 25 +++------------
> .../unix/sysv/linux/powerpc/kernel-features.h | 1 +
> sysdeps/unix/sysv/linux/riscv/ipc_priv.h | 21 ------------
> .../unix/sysv/linux/s390/kernel-features.h | 1 +
> sysdeps/unix/sysv/linux/sh/kernel-features.h | 1 +
> .../unix/sysv/linux/sparc/kernel-features.h | 3 ++
> .../unix/sysv/linux/sparc/sparc64/ipc_priv.h | 20 ++++--------
> sysdeps/unix/sysv/linux/x86_64/ipc_priv.h | 32 -------------------
> 22 files changed, 67 insertions(+), 192 deletions(-)
> delete mode 100644 sysdeps/unix/sysv/linux/hppa/ipc_priv.h
> delete mode 100644 sysdeps/unix/sysv/linux/ia64/ipc_priv.h
> delete mode 100644 sysdeps/unix/sysv/linux/nios2/ipc_priv.h
> rename sysdeps/unix/sysv/linux/{csky/ipc_priv.h => nios2/kernel-features.h} (69%)
> delete mode 100644 sysdeps/unix/sysv/linux/riscv/ipc_priv.h
> delete mode 100644 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
>
> diff --git a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
> index fc5e713f42..fa79bddcf3 100644
> --- a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
> +++ b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
> @@ -16,17 +16,7 @@
> License along with the GNU C Library; if not, see
> <http://www.gnu.org/licenses/>. */
>
> -#include <sys/ipc.h> /* For __key_t */
> -
> -#define __IPC_64 0x100
> -
> -struct __old_ipc_perm
> -{
> - __key_t __key; /* Key. */
> - unsigned int uid; /* Owner's user ID. */
> - unsigned int gid; /* Owner's group ID. */
> - unsigned int cuid; /* Creator's user ID. */
> - unsigned int cgid; /* Creator's group ID. */
> - unsigned int mode; /* Read/write permission. */
> - unsigned short int __seq; /* Sequence number. */
> -};
> +#define __OLD_IPC_ID_TYPE unsigned int
> +#define __OLD_IPC_MODE_TYPE unsigned int
> +#define __OLD_IPC_SEQ_TYPE unsigned short int
> +#include <sysdeps/unix/sysv/linux/ipc_priv.h>
> diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
> index 4a5d029c1d..f3aab5bcee 100644
> --- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
> @@ -53,4 +53,7 @@
> # undef __ASSUME_STATX
> #endif
>
> +/* Alpha support old sysvipc even being a 64-bit architecture. */
> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +
> #endif /* _KERNEL_FEATURES_H */
> diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
> index 2d2d355844..75ac97a82f 100644
> --- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
> @@ -50,3 +50,5 @@
>
> #undef __ASSUME_CLONE_DEFAULT
> #define __ASSUME_CLONE_BACKWARDS 1
> +
> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> diff --git a/sysdeps/unix/sysv/linux/hppa/ipc_priv.h b/sysdeps/unix/sysv/linux/hppa/ipc_priv.h
> deleted file mode 100644
> index 5e170a9a2b..0000000000
> --- a/sysdeps/unix/sysv/linux/hppa/ipc_priv.h
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/* Old SysV permission definition for Linux. Hppa version.
> - Copyright (C) 2017-2019 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <http://www.gnu.org/licenses/>. */
> -
> -#include <sys/ipc.h> /* For __key_t */
> -
> -#define __IPC_64 0x0
> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> index 3ac725b5a2..411eb2fca4 100644
> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> @@ -45,6 +45,7 @@
>
> /* i686 only supports ipc syscall. */
> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>
> #undef __ASSUME_CLONE_DEFAULT
> #define __ASSUME_CLONE_BACKWARDS 1
> diff --git a/sysdeps/unix/sysv/linux/ia64/ipc_priv.h b/sysdeps/unix/sysv/linux/ia64/ipc_priv.h
> deleted file mode 100644
> index 6b2438cd03..0000000000
> --- a/sysdeps/unix/sysv/linux/ia64/ipc_priv.h
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/* Old SysV permission definition for Linux. IA64 version.
> - Copyright (C) 2017-2019 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <http://www.gnu.org/licenses/>. */
> -
> -#include <sys/ipc.h> /* For __key_t */
> -
> -#define __IPC_64 0x0
> diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
> index 1d1bd19541..d387b44c8f 100644
> --- a/sysdeps/unix/sysv/linux/ipc_priv.h
> +++ b/sysdeps/unix/sysv/linux/ipc_priv.h
> @@ -17,18 +17,33 @@
> <http://www.gnu.org/licenses/>. */
>
> #include <sys/ipc.h> /* For __key_t */
> -
> -#define __IPC_64 0x100
> +#include <kernel-features.h>
> +
> +#ifdef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +# define __IPC_64 0x0
> +#else
> +# define __IPC_64 0x100
> +#endif
> +
> +#ifndef __OLD_IPC_ID_TYPE
> +# define __OLD_IPC_ID_TYPE unsigned short int
> +#endif
> +#ifndef __OLD_IPC_MODE_TYPE
> +# define __OLD_IPC_MODE_TYPE unsigned short int
> +#endif
> +#ifndef __OLD_IPC_SEQ_TYPE
> +# define __OLD_IPC_SEQ_TYPE unsigned short int
> +#endif
>
> struct __old_ipc_perm
> {
> __key_t __key; /* Key. */
> - unsigned short int uid; /* Owner's user ID. */
> - unsigned short int gid; /* Owner's group ID. */
> - unsigned short int cuid; /* Creator's user ID. */
> - unsigned short int cgid; /* Creator's group ID. */
> - unsigned short int mode; /* Read/write permission. */
> - unsigned short int __seq; /* Sequence number. */
> + __OLD_IPC_ID_TYPE uid; /* Owner's user ID. */
> + __OLD_IPC_ID_TYPE gid; /* Owner's group ID. */
> + __OLD_IPC_ID_TYPE cuid; /* Creator's user ID. */
> + __OLD_IPC_ID_TYPE cgid; /* Creator's group ID. */
> + __OLD_IPC_MODE_TYPE mode; /* Read/write permission. */
> + __OLD_IPC_SEQ_TYPE __seq; /* Sequence number. */
> };
>
> #define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index bc5c959f58..fa99a11c2d 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -80,6 +80,9 @@
> /* Support for SysV IPC through wired syscalls. All supported architectures
> either support ipc syscall and/or all the ipc correspondent syscalls. */
> #define __ASSUME_DIRECT_SYSVIPC_SYSCALLS 1
> +/* The generic default __IPC_64 value is 0x0, however some architectures
> + require a different value of 0x100. */
> +#define __ASSUME_SYSVIPC_DEFAULT_IPC_64 1
>
> /* Support for p{read,write}v2 was added in 4.6. However Linux default
> implementation does not assume the __ASSUME_* and instead use a fallback
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index 1976724362..46418977c8 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -52,3 +52,4 @@
>
> /* m68k only supports ipc syscall. */
> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> index 8df19400af..bed0c4a4e5 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> @@ -72,3 +72,5 @@
>
> #undef __ASSUME_CLONE_DEFAULT
> #define __ASSUME_CLONE_BACKWARDS3
> +
> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
> index c341c3fa10..b9fa89c81d 100644
> --- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
> @@ -50,3 +50,5 @@
>
> #undef __ASSUME_CLONE_DEFAULT
> #define __ASSUME_CLONE_BACKWARDS 1
> +
> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
> index bb31656069..682ec35662 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
> @@ -16,17 +16,7 @@
> License along with the GNU C Library; if not, see
> <http://www.gnu.org/licenses/>. */
>
> -#include <sys/ipc.h>
> -
> -#define __IPC_64 0x100
> -
> -struct __old_ipc_perm
> -{
> - __key_t __key; /* Key. */
> - int uid; /* Owner's user ID. */
> - int gid; /* Owner's group ID. */
> - int cuid; /* Creator's user ID. */
> - int cgid; /* Creator's group ID. */
> - int mode; /* Read/write permission. */
> - unsigned short int __seq; /* Sequence number. */
> -};
> +#define __OLD_IPC_ID_TYPE int
> +#define __OLD_IPC_MODE_TYPE int
> +#define __OLD_IPC_SEQ_TYPE unsigned short int
> +#include <sysdeps/unix/sysv/linux/ipc_priv.h>
> diff --git a/sysdeps/unix/sysv/linux/nios2/ipc_priv.h b/sysdeps/unix/sysv/linux/nios2/ipc_priv.h
> deleted file mode 100644
> index d6e6be797a..0000000000
> --- a/sysdeps/unix/sysv/linux/nios2/ipc_priv.h
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/* Old SysV permission definition for Linux. Nios II version.
> - Copyright (C) 2017-2019 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <http://www.gnu.org/licenses/>. */
> -
> -#include <sys/ipc.h> /* For __key_t */
> -
> -#define __IPC_64 0x0
> diff --git a/sysdeps/unix/sysv/linux/csky/ipc_priv.h b/sysdeps/unix/sysv/linux/nios2/kernel-features.h
> similarity index 69%
> rename from sysdeps/unix/sysv/linux/csky/ipc_priv.h
> rename to sysdeps/unix/sysv/linux/nios2/kernel-features.h
> index e1beadb2a0..7f4023831e 100644
> --- a/sysdeps/unix/sysv/linux/csky/ipc_priv.h
> +++ b/sysdeps/unix/sysv/linux/nios2/kernel-features.h
> @@ -1,5 +1,6 @@
> -/* Old SysV permission definition for Linux. C-SKY version.
> - Copyright (C) 2017-2019 Free Software Foundation, Inc.
> +/* Set flags signalling availability of kernel features based on given
> + kernel version number. NIOS2 version.
> + Copyright (C) 2019 Free Software Foundation, Inc.
> This file is part of the GNU C Library.
>
> The GNU C Library is free software; you can redistribute it and/or
> @@ -13,9 +14,9 @@
> Lesser General Public License for more details.
>
> You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> + License along with the GNU C Library. If not, see
> <http://www.gnu.org/licenses/>. */
>
> -#include <sys/ipc.h> /* For __key_t */
> +#include_next <kernel-features.h>
>
> -#define __IPC_64 0x0
> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
> index 3450933f56..f641ed9a32 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
> @@ -16,24 +16,7 @@
> License along with the GNU C Library; if not, see
> <http://www.gnu.org/licenses/>. */
>
> -#include <sys/ipc.h> /* For __key_t */
> -
> -#define __IPC_64 0x100
> -
> -struct __old_ipc_perm
> -{
> - __key_t __key; /* Key. */
> - unsigned int uid; /* Owner's user ID. */
> - unsigned int gid; /* Owner's group ID. */
> - unsigned int cuid; /* Creator's user ID. */
> - unsigned int cgid; /* Creator's group ID. */
> - unsigned int mode; /* Read/write permission. */
> - unsigned short int __seq; /* Sequence number. */
> -};
> -
> -#define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
> -
> -#define MSGRCV_ARGS(__msgp, __msgtyp) \
> - ((long int []){ (long int) __msgp, __msgtyp })
> -
> -#include <ipc_ops.h>
> +#define __OLD_IPC_ID_TYPE unsigned int
> +#define __OLD_IPC_MODE_TYPE unsigned int
> +#define __OLD_IPC_SEQ_TYPE unsigned short int
> +#include <sysdeps/unix/sysv/linux/ipc_priv.h>
> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> index 413a185db3..e787182396 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> @@ -46,6 +46,7 @@
>
> /* powerpc only supports ipc syscall. */
> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>
> #undef __ASSUME_CLONE_DEFAULT
> #define __ASSUME_CLONE_BACKWARDS 1
> diff --git a/sysdeps/unix/sysv/linux/riscv/ipc_priv.h b/sysdeps/unix/sysv/linux/riscv/ipc_priv.h
> deleted file mode 100644
> index ea957a56be..0000000000
> --- a/sysdeps/unix/sysv/linux/riscv/ipc_priv.h
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/* Old SysV permission definition for Linux. RISC-V version.
> - Copyright (C) 2018-2019 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <http://www.gnu.org/licenses/>. */
> -
> -#include <sys/ipc.h> /* For __key_t */
> -
> -#define __IPC_64 0x0
> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> index 8fdf38c454..57077ea4cc 100644
> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> @@ -47,6 +47,7 @@
>
> /* s390 only supports ipc syscall. */
> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>
> #undef __ASSUME_CLONE_DEFAULT
> #define __ASSUME_CLONE_BACKWARDS2
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index b11a5cb544..cf68256abe 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -43,6 +43,7 @@
>
> /* sh only supports ipc syscall. */
> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>
> /* Support for several syscalls was added in 4.8. */
> #if __LINUX_KERNEL_VERSION < 0x040800
> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> index f441bd811d..82c8236c23 100644
> --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> @@ -60,6 +60,9 @@
>
> /* sparc only supports ipc syscall. */
> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +#ifndef __arch64__
> +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +#endif
>
> /* Support for the renameat2 syscall was added in 3.16. */
> #if __LINUX_KERNEL_VERSION < 0x031000
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
> index 8936aed022..3d813fe9e6 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
> @@ -16,26 +16,18 @@
> License along with the GNU C Library; if not, see
> <http://www.gnu.org/licenses/>. */
>
> -#include <sys/ipc.h> /* For __key_t */
> -
> -#define __IPC_64 0x0
> -
> -struct __old_ipc_perm
> -{
> - __key_t __key; /* Key. */
> - unsigned int uid; /* Owner's user ID. */
> - unsigned int gid; /* Owner's group ID. */
> - unsigned int cuid; /* Creator's user ID. */
> - unsigned int cgid; /* Creator's group ID. */
> - unsigned int mode; /* Read/write permission. */
> - unsigned short int __seq; /* Sequence number. */
> -};
> +#define __OLD_IPC_ID_TYPE unsigned int
> +#define __OLD_IPC_MODE_TYPE unsigned int
> +#define __OLD_IPC_SEQ_TYPE unsigned short int
> +#include <sysdeps/unix/sysv/linux/ipc_priv.h>
>
> /* SPARC semctl multiplex syscall expects the union pointed address, not
> the union address itself. */
> +#undef SEMCTL_ARG_ADDRESS
> #define SEMCTL_ARG_ADDRESS(__arg) __arg.array
>
> /* Also for msgrcv it does not use the kludge on final 2 arguments. */
> +#undef MSGRCV_ARGS
> #define MSGRCV_ARGS(__msgp, __msgtyp) __msgp, __msgtyp
>
> #include <ipc_ops.h>
> diff --git a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h b/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
> deleted file mode 100644
> index 1ac288aa65..0000000000
> --- a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
> +++ /dev/null
> @@ -1,32 +0,0 @@
> -/* Old SysV permission definition for Linux. x86_64 version.
> - Copyright (C) 2016-2019 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <http://www.gnu.org/licenses/>. */
> -
> -#include <sys/ipc.h> /* For __key_t */
> -
> -#define __IPC_64 0x0
> -
> -struct __old_ipc_perm
> -{
> - __key_t __key; /* Key. */
> - unsigned short uid; /* Owner's user ID. */
> - unsigned short gid; /* Owner's group ID. */
> - unsigned short cuid; /* Creator's user ID. */
> - unsigned short cgid; /* Creator's group ID. */
> - unsigned short mode; /* Read/write permission. */
> - unsigned short int __seq; /* Sequence number. */
> -};
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] ipc: Refactor sysvipc internal definitions
2019-08-09 12:18 ` [PATCH v2 1/2] ipc: Refactor sysvipc internal definitions Adhemerval Zanella
@ 2019-08-28 14:06 ` Adhemerval Zanella
0 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2019-08-28 14:06 UTC (permalink / raw)
To: libc-alpha
Ping (x2).
On 09/08/2019 09:18, Adhemerval Zanella wrote:
> Ping.
>
> On 20/05/2019 14:53, Adhemerval Zanella wrote:
>> Changes from previous version:
>>
>> - Added __ASSUME_SYSVIPC_DEFAULT_IPC_64 instead of redefine __IPC_64
>> on kernel-features.h. The new assume macro is used to setup the
>> __IPC_64 value on ipc-priv.h.
>>
>> - Annexed the 'ipc: Refactor sysvipc compat type' to make it possible
>> share the generic ipc_priv.h definions for all architectures.
>>
>> --
>>
>> This patch refactor the internal sysvipc in two main points:
>>
>> 1. Add a new __ASSUME_SYSVIPC_DEFAULT_IPC_64 to infer the __IPC_64
>> value in wire-up or ipc syscall. The defaut value assumed for
>> __IPC_64 is also changed from 0x100 to 0x0, aligning with Linux
>> generic UAPI. The idea is to simplify the Linux 5.1 wire-up for
>> sysvipc syscalls for some 32-bit ABIs (which expectes __IPC_64
>> being 0x0) and simplify new ports (which would not require add
>> a ipc_priv.h to override the __IPC_64 value).
>>
>> 2. It removes some duplicated definition from sysvipc compat code
>> at ipc_priv.h. The idea is also to make it simpler to enable
>> the new wireup sysvipc on Linux v5.1.
>>
>> There is no semantic change expected on any port. Checked with a build
>> against all affected ABIs.
>>
>> * sysdeps/unix/sysv/linux/ipc_priv.h (__OLD_IPC_ID_TYPE,
>> __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
>> (__old_ipc_perm): Use the new defines.
>> * sysdeps/unix/sysv/linux/alpha/ipc_priv.h (__OLD_IPC_ID_TYPE,
>> __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
>> (__old_ipc_perm): Use the new defines.
>> * sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h (__OLD_IPC_ID_TYPE,
>> __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
>> (__old_ipc_perm): Use the new defines.
>> * sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (__OLD_IPC_ID_TYPE,
>> __OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
>> (__old_ipc_perm): Use the new defines.
>> * sysdeps/unix/sysv/linux/kernel-features.h
>> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Define.
>> * sysdeps/unix/sysv/linux/alpha/kernel-features.h
>> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Undefine.
>> * sysdeps/unix/sysv/linux/arm/kernel-features.h
>> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
>> * sysdeps/unix/sysv/linux/i386/kernel-features.h
>> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
>> * sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
>> * sysdeps/unix/sysv/linux/mips/kernel-features.h
>> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
>> * sysdeps/unix/sysv/linux/microblaze/kernel-features.h
>> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
>> * sysdeps/unix/sysv/linux/powerpc/kernel-features.h
>> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
>> * sysdeps/unix/sysv/linux/s390/kernel-features.h
>> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
>> * sysdeps/unix/sysv/linux/sh/kernel-features.h
>> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
>> * sysdeps/unix/sysv/linux/sparc/kernel-features.h
>> [!__arch64__] (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
>> * sysdeps/unix/sysv/linux/nios2/kernel-features.h: New file.
>> * sysdeps/unix/sysv/linux/hppa/ipc_priv.h: Remove file.
>> * sysdeps/unix/sysv/linux/ia64/ipc_priv.h: Likewise.
>> * sysdeps/unix/sysv/linux/nios2/ipc_priv.h: Likewise.
>> * sysdeps/unix/sysv/linux/csky/ipc_priv.h: Likewise.
>> * sysdeps/unix/sysv/linux/riscv/ipc_priv.h: Likewise.
>> * sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h: Likewise.
>> * sysdeps/unix/sysv/linux/x86_64/ipc_priv.h: Likewise.
>> ---
>> sysdeps/unix/sysv/linux/alpha/ipc_priv.h | 18 +++--------
>> .../unix/sysv/linux/alpha/kernel-features.h | 3 ++
>> sysdeps/unix/sysv/linux/arm/kernel-features.h | 2 ++
>> sysdeps/unix/sysv/linux/hppa/ipc_priv.h | 21 ------------
>> .../unix/sysv/linux/i386/kernel-features.h | 1 +
>> sysdeps/unix/sysv/linux/ia64/ipc_priv.h | 21 ------------
>> sysdeps/unix/sysv/linux/ipc_priv.h | 31 +++++++++++++-----
>> sysdeps/unix/sysv/linux/kernel-features.h | 3 ++
>> .../unix/sysv/linux/m68k/kernel-features.h | 1 +
>> .../sysv/linux/microblaze/kernel-features.h | 2 ++
>> .../unix/sysv/linux/mips/kernel-features.h | 2 ++
>> .../unix/sysv/linux/mips/mips64/ipc_priv.h | 18 +++--------
>> sysdeps/unix/sysv/linux/nios2/ipc_priv.h | 21 ------------
>> .../ipc_priv.h => nios2/kernel-features.h} | 11 ++++---
>> sysdeps/unix/sysv/linux/powerpc/ipc_priv.h | 25 +++------------
>> .../unix/sysv/linux/powerpc/kernel-features.h | 1 +
>> sysdeps/unix/sysv/linux/riscv/ipc_priv.h | 21 ------------
>> .../unix/sysv/linux/s390/kernel-features.h | 1 +
>> sysdeps/unix/sysv/linux/sh/kernel-features.h | 1 +
>> .../unix/sysv/linux/sparc/kernel-features.h | 3 ++
>> .../unix/sysv/linux/sparc/sparc64/ipc_priv.h | 20 ++++--------
>> sysdeps/unix/sysv/linux/x86_64/ipc_priv.h | 32 -------------------
>> 22 files changed, 67 insertions(+), 192 deletions(-)
>> delete mode 100644 sysdeps/unix/sysv/linux/hppa/ipc_priv.h
>> delete mode 100644 sysdeps/unix/sysv/linux/ia64/ipc_priv.h
>> delete mode 100644 sysdeps/unix/sysv/linux/nios2/ipc_priv.h
>> rename sysdeps/unix/sysv/linux/{csky/ipc_priv.h => nios2/kernel-features.h} (69%)
>> delete mode 100644 sysdeps/unix/sysv/linux/riscv/ipc_priv.h
>> delete mode 100644 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
>>
>> diff --git a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
>> index fc5e713f42..fa79bddcf3 100644
>> --- a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
>> +++ b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
>> @@ -16,17 +16,7 @@
>> License along with the GNU C Library; if not, see
>> <http://www.gnu.org/licenses/>. */
>>
>> -#include <sys/ipc.h> /* For __key_t */
>> -
>> -#define __IPC_64 0x100
>> -
>> -struct __old_ipc_perm
>> -{
>> - __key_t __key; /* Key. */
>> - unsigned int uid; /* Owner's user ID. */
>> - unsigned int gid; /* Owner's group ID. */
>> - unsigned int cuid; /* Creator's user ID. */
>> - unsigned int cgid; /* Creator's group ID. */
>> - unsigned int mode; /* Read/write permission. */
>> - unsigned short int __seq; /* Sequence number. */
>> -};
>> +#define __OLD_IPC_ID_TYPE unsigned int
>> +#define __OLD_IPC_MODE_TYPE unsigned int
>> +#define __OLD_IPC_SEQ_TYPE unsigned short int
>> +#include <sysdeps/unix/sysv/linux/ipc_priv.h>
>> diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
>> index 4a5d029c1d..f3aab5bcee 100644
>> --- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
>> @@ -53,4 +53,7 @@
>> # undef __ASSUME_STATX
>> #endif
>>
>> +/* Alpha support old sysvipc even being a 64-bit architecture. */
>> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>> +
>> #endif /* _KERNEL_FEATURES_H */
>> diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
>> index 2d2d355844..75ac97a82f 100644
>> --- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
>> @@ -50,3 +50,5 @@
>>
>> #undef __ASSUME_CLONE_DEFAULT
>> #define __ASSUME_CLONE_BACKWARDS 1
>> +
>> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>> diff --git a/sysdeps/unix/sysv/linux/hppa/ipc_priv.h b/sysdeps/unix/sysv/linux/hppa/ipc_priv.h
>> deleted file mode 100644
>> index 5e170a9a2b..0000000000
>> --- a/sysdeps/unix/sysv/linux/hppa/ipc_priv.h
>> +++ /dev/null
>> @@ -1,21 +0,0 @@
>> -/* Old SysV permission definition for Linux. Hppa version.
>> - Copyright (C) 2017-2019 Free Software Foundation, Inc.
>> - This file is part of the GNU C Library.
>> -
>> - The GNU C Library is free software; you can redistribute it and/or
>> - modify it under the terms of the GNU Lesser General Public
>> - License as published by the Free Software Foundation; either
>> - version 2.1 of the License, or (at your option) any later version.
>> -
>> - The GNU C Library is distributed in the hope that it will be useful,
>> - but WITHOUT ANY WARRANTY; without even the implied warranty of
>> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> - Lesser General Public License for more details.
>> -
>> - You should have received a copy of the GNU Lesser General Public
>> - License along with the GNU C Library; if not, see
>> - <http://www.gnu.org/licenses/>. */
>> -
>> -#include <sys/ipc.h> /* For __key_t */
>> -
>> -#define __IPC_64 0x0
>> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
>> index 3ac725b5a2..411eb2fca4 100644
>> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
>> @@ -45,6 +45,7 @@
>>
>> /* i686 only supports ipc syscall. */
>> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
>> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>>
>> #undef __ASSUME_CLONE_DEFAULT
>> #define __ASSUME_CLONE_BACKWARDS 1
>> diff --git a/sysdeps/unix/sysv/linux/ia64/ipc_priv.h b/sysdeps/unix/sysv/linux/ia64/ipc_priv.h
>> deleted file mode 100644
>> index 6b2438cd03..0000000000
>> --- a/sysdeps/unix/sysv/linux/ia64/ipc_priv.h
>> +++ /dev/null
>> @@ -1,21 +0,0 @@
>> -/* Old SysV permission definition for Linux. IA64 version.
>> - Copyright (C) 2017-2019 Free Software Foundation, Inc.
>> - This file is part of the GNU C Library.
>> -
>> - The GNU C Library is free software; you can redistribute it and/or
>> - modify it under the terms of the GNU Lesser General Public
>> - License as published by the Free Software Foundation; either
>> - version 2.1 of the License, or (at your option) any later version.
>> -
>> - The GNU C Library is distributed in the hope that it will be useful,
>> - but WITHOUT ANY WARRANTY; without even the implied warranty of
>> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> - Lesser General Public License for more details.
>> -
>> - You should have received a copy of the GNU Lesser General Public
>> - License along with the GNU C Library; if not, see
>> - <http://www.gnu.org/licenses/>. */
>> -
>> -#include <sys/ipc.h> /* For __key_t */
>> -
>> -#define __IPC_64 0x0
>> diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
>> index 1d1bd19541..d387b44c8f 100644
>> --- a/sysdeps/unix/sysv/linux/ipc_priv.h
>> +++ b/sysdeps/unix/sysv/linux/ipc_priv.h
>> @@ -17,18 +17,33 @@
>> <http://www.gnu.org/licenses/>. */
>>
>> #include <sys/ipc.h> /* For __key_t */
>> -
>> -#define __IPC_64 0x100
>> +#include <kernel-features.h>
>> +
>> +#ifdef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>> +# define __IPC_64 0x0
>> +#else
>> +# define __IPC_64 0x100
>> +#endif
>> +
>> +#ifndef __OLD_IPC_ID_TYPE
>> +# define __OLD_IPC_ID_TYPE unsigned short int
>> +#endif
>> +#ifndef __OLD_IPC_MODE_TYPE
>> +# define __OLD_IPC_MODE_TYPE unsigned short int
>> +#endif
>> +#ifndef __OLD_IPC_SEQ_TYPE
>> +# define __OLD_IPC_SEQ_TYPE unsigned short int
>> +#endif
>>
>> struct __old_ipc_perm
>> {
>> __key_t __key; /* Key. */
>> - unsigned short int uid; /* Owner's user ID. */
>> - unsigned short int gid; /* Owner's group ID. */
>> - unsigned short int cuid; /* Creator's user ID. */
>> - unsigned short int cgid; /* Creator's group ID. */
>> - unsigned short int mode; /* Read/write permission. */
>> - unsigned short int __seq; /* Sequence number. */
>> + __OLD_IPC_ID_TYPE uid; /* Owner's user ID. */
>> + __OLD_IPC_ID_TYPE gid; /* Owner's group ID. */
>> + __OLD_IPC_ID_TYPE cuid; /* Creator's user ID. */
>> + __OLD_IPC_ID_TYPE cgid; /* Creator's group ID. */
>> + __OLD_IPC_MODE_TYPE mode; /* Read/write permission. */
>> + __OLD_IPC_SEQ_TYPE __seq; /* Sequence number. */
>> };
>>
>> #define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
>> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
>> index bc5c959f58..fa99a11c2d 100644
>> --- a/sysdeps/unix/sysv/linux/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
>> @@ -80,6 +80,9 @@
>> /* Support for SysV IPC through wired syscalls. All supported architectures
>> either support ipc syscall and/or all the ipc correspondent syscalls. */
>> #define __ASSUME_DIRECT_SYSVIPC_SYSCALLS 1
>> +/* The generic default __IPC_64 value is 0x0, however some architectures
>> + require a different value of 0x100. */
>> +#define __ASSUME_SYSVIPC_DEFAULT_IPC_64 1
>>
>> /* Support for p{read,write}v2 was added in 4.6. However Linux default
>> implementation does not assume the __ASSUME_* and instead use a fallback
>> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> index 1976724362..46418977c8 100644
>> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> @@ -52,3 +52,4 @@
>>
>> /* m68k only supports ipc syscall. */
>> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
>> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
>> index 8df19400af..bed0c4a4e5 100644
>> --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
>> @@ -72,3 +72,5 @@
>>
>> #undef __ASSUME_CLONE_DEFAULT
>> #define __ASSUME_CLONE_BACKWARDS3
>> +
>> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>> diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
>> index c341c3fa10..b9fa89c81d 100644
>> --- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
>> @@ -50,3 +50,5 @@
>>
>> #undef __ASSUME_CLONE_DEFAULT
>> #define __ASSUME_CLONE_BACKWARDS 1
>> +
>> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
>> index bb31656069..682ec35662 100644
>> --- a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
>> +++ b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
>> @@ -16,17 +16,7 @@
>> License along with the GNU C Library; if not, see
>> <http://www.gnu.org/licenses/>. */
>>
>> -#include <sys/ipc.h>
>> -
>> -#define __IPC_64 0x100
>> -
>> -struct __old_ipc_perm
>> -{
>> - __key_t __key; /* Key. */
>> - int uid; /* Owner's user ID. */
>> - int gid; /* Owner's group ID. */
>> - int cuid; /* Creator's user ID. */
>> - int cgid; /* Creator's group ID. */
>> - int mode; /* Read/write permission. */
>> - unsigned short int __seq; /* Sequence number. */
>> -};
>> +#define __OLD_IPC_ID_TYPE int
>> +#define __OLD_IPC_MODE_TYPE int
>> +#define __OLD_IPC_SEQ_TYPE unsigned short int
>> +#include <sysdeps/unix/sysv/linux/ipc_priv.h>
>> diff --git a/sysdeps/unix/sysv/linux/nios2/ipc_priv.h b/sysdeps/unix/sysv/linux/nios2/ipc_priv.h
>> deleted file mode 100644
>> index d6e6be797a..0000000000
>> --- a/sysdeps/unix/sysv/linux/nios2/ipc_priv.h
>> +++ /dev/null
>> @@ -1,21 +0,0 @@
>> -/* Old SysV permission definition for Linux. Nios II version.
>> - Copyright (C) 2017-2019 Free Software Foundation, Inc.
>> - This file is part of the GNU C Library.
>> -
>> - The GNU C Library is free software; you can redistribute it and/or
>> - modify it under the terms of the GNU Lesser General Public
>> - License as published by the Free Software Foundation; either
>> - version 2.1 of the License, or (at your option) any later version.
>> -
>> - The GNU C Library is distributed in the hope that it will be useful,
>> - but WITHOUT ANY WARRANTY; without even the implied warranty of
>> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> - Lesser General Public License for more details.
>> -
>> - You should have received a copy of the GNU Lesser General Public
>> - License along with the GNU C Library; if not, see
>> - <http://www.gnu.org/licenses/>. */
>> -
>> -#include <sys/ipc.h> /* For __key_t */
>> -
>> -#define __IPC_64 0x0
>> diff --git a/sysdeps/unix/sysv/linux/csky/ipc_priv.h b/sysdeps/unix/sysv/linux/nios2/kernel-features.h
>> similarity index 69%
>> rename from sysdeps/unix/sysv/linux/csky/ipc_priv.h
>> rename to sysdeps/unix/sysv/linux/nios2/kernel-features.h
>> index e1beadb2a0..7f4023831e 100644
>> --- a/sysdeps/unix/sysv/linux/csky/ipc_priv.h
>> +++ b/sysdeps/unix/sysv/linux/nios2/kernel-features.h
>> @@ -1,5 +1,6 @@
>> -/* Old SysV permission definition for Linux. C-SKY version.
>> - Copyright (C) 2017-2019 Free Software Foundation, Inc.
>> +/* Set flags signalling availability of kernel features based on given
>> + kernel version number. NIOS2 version.
>> + Copyright (C) 2019 Free Software Foundation, Inc.
>> This file is part of the GNU C Library.
>>
>> The GNU C Library is free software; you can redistribute it and/or
>> @@ -13,9 +14,9 @@
>> Lesser General Public License for more details.
>>
>> You should have received a copy of the GNU Lesser General Public
>> - License along with the GNU C Library; if not, see
>> + License along with the GNU C Library. If not, see
>> <http://www.gnu.org/licenses/>. */
>>
>> -#include <sys/ipc.h> /* For __key_t */
>> +#include_next <kernel-features.h>
>>
>> -#define __IPC_64 0x0
>> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
>> index 3450933f56..f641ed9a32 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
>> +++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
>> @@ -16,24 +16,7 @@
>> License along with the GNU C Library; if not, see
>> <http://www.gnu.org/licenses/>. */
>>
>> -#include <sys/ipc.h> /* For __key_t */
>> -
>> -#define __IPC_64 0x100
>> -
>> -struct __old_ipc_perm
>> -{
>> - __key_t __key; /* Key. */
>> - unsigned int uid; /* Owner's user ID. */
>> - unsigned int gid; /* Owner's group ID. */
>> - unsigned int cuid; /* Creator's user ID. */
>> - unsigned int cgid; /* Creator's group ID. */
>> - unsigned int mode; /* Read/write permission. */
>> - unsigned short int __seq; /* Sequence number. */
>> -};
>> -
>> -#define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
>> -
>> -#define MSGRCV_ARGS(__msgp, __msgtyp) \
>> - ((long int []){ (long int) __msgp, __msgtyp })
>> -
>> -#include <ipc_ops.h>
>> +#define __OLD_IPC_ID_TYPE unsigned int
>> +#define __OLD_IPC_MODE_TYPE unsigned int
>> +#define __OLD_IPC_SEQ_TYPE unsigned short int
>> +#include <sysdeps/unix/sysv/linux/ipc_priv.h>
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
>> index 413a185db3..e787182396 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
>> @@ -46,6 +46,7 @@
>>
>> /* powerpc only supports ipc syscall. */
>> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
>> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>>
>> #undef __ASSUME_CLONE_DEFAULT
>> #define __ASSUME_CLONE_BACKWARDS 1
>> diff --git a/sysdeps/unix/sysv/linux/riscv/ipc_priv.h b/sysdeps/unix/sysv/linux/riscv/ipc_priv.h
>> deleted file mode 100644
>> index ea957a56be..0000000000
>> --- a/sysdeps/unix/sysv/linux/riscv/ipc_priv.h
>> +++ /dev/null
>> @@ -1,21 +0,0 @@
>> -/* Old SysV permission definition for Linux. RISC-V version.
>> - Copyright (C) 2018-2019 Free Software Foundation, Inc.
>> - This file is part of the GNU C Library.
>> -
>> - The GNU C Library is free software; you can redistribute it and/or
>> - modify it under the terms of the GNU Lesser General Public
>> - License as published by the Free Software Foundation; either
>> - version 2.1 of the License, or (at your option) any later version.
>> -
>> - The GNU C Library is distributed in the hope that it will be useful,
>> - but WITHOUT ANY WARRANTY; without even the implied warranty of
>> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> - Lesser General Public License for more details.
>> -
>> - You should have received a copy of the GNU Lesser General Public
>> - License along with the GNU C Library; if not, see
>> - <http://www.gnu.org/licenses/>. */
>> -
>> -#include <sys/ipc.h> /* For __key_t */
>> -
>> -#define __IPC_64 0x0
>> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
>> index 8fdf38c454..57077ea4cc 100644
>> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
>> @@ -47,6 +47,7 @@
>>
>> /* s390 only supports ipc syscall. */
>> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
>> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>>
>> #undef __ASSUME_CLONE_DEFAULT
>> #define __ASSUME_CLONE_BACKWARDS2
>> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
>> index b11a5cb544..cf68256abe 100644
>> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
>> @@ -43,6 +43,7 @@
>>
>> /* sh only supports ipc syscall. */
>> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
>> +#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>>
>> /* Support for several syscalls was added in 4.8. */
>> #if __LINUX_KERNEL_VERSION < 0x040800
>> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
>> index f441bd811d..82c8236c23 100644
>> --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
>> @@ -60,6 +60,9 @@
>>
>> /* sparc only supports ipc syscall. */
>> #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
>> +#ifndef __arch64__
>> +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
>> +#endif
>>
>> /* Support for the renameat2 syscall was added in 3.16. */
>> #if __LINUX_KERNEL_VERSION < 0x031000
>> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
>> index 8936aed022..3d813fe9e6 100644
>> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
>> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
>> @@ -16,26 +16,18 @@
>> License along with the GNU C Library; if not, see
>> <http://www.gnu.org/licenses/>. */
>>
>> -#include <sys/ipc.h> /* For __key_t */
>> -
>> -#define __IPC_64 0x0
>> -
>> -struct __old_ipc_perm
>> -{
>> - __key_t __key; /* Key. */
>> - unsigned int uid; /* Owner's user ID. */
>> - unsigned int gid; /* Owner's group ID. */
>> - unsigned int cuid; /* Creator's user ID. */
>> - unsigned int cgid; /* Creator's group ID. */
>> - unsigned int mode; /* Read/write permission. */
>> - unsigned short int __seq; /* Sequence number. */
>> -};
>> +#define __OLD_IPC_ID_TYPE unsigned int
>> +#define __OLD_IPC_MODE_TYPE unsigned int
>> +#define __OLD_IPC_SEQ_TYPE unsigned short int
>> +#include <sysdeps/unix/sysv/linux/ipc_priv.h>
>>
>> /* SPARC semctl multiplex syscall expects the union pointed address, not
>> the union address itself. */
>> +#undef SEMCTL_ARG_ADDRESS
>> #define SEMCTL_ARG_ADDRESS(__arg) __arg.array
>>
>> /* Also for msgrcv it does not use the kludge on final 2 arguments. */
>> +#undef MSGRCV_ARGS
>> #define MSGRCV_ARGS(__msgp, __msgtyp) __msgp, __msgtyp
>>
>> #include <ipc_ops.h>
>> diff --git a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h b/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
>> deleted file mode 100644
>> index 1ac288aa65..0000000000
>> --- a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
>> +++ /dev/null
>> @@ -1,32 +0,0 @@
>> -/* Old SysV permission definition for Linux. x86_64 version.
>> - Copyright (C) 2016-2019 Free Software Foundation, Inc.
>> - This file is part of the GNU C Library.
>> -
>> - The GNU C Library is free software; you can redistribute it and/or
>> - modify it under the terms of the GNU Lesser General Public
>> - License as published by the Free Software Foundation; either
>> - version 2.1 of the License, or (at your option) any later version.
>> -
>> - The GNU C Library is distributed in the hope that it will be useful,
>> - but WITHOUT ANY WARRANTY; without even the implied warranty of
>> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> - Lesser General Public License for more details.
>> -
>> - You should have received a copy of the GNU Lesser General Public
>> - License along with the GNU C Library; if not, see
>> - <http://www.gnu.org/licenses/>. */
>> -
>> -#include <sys/ipc.h> /* For __key_t */
>> -
>> -#define __IPC_64 0x0
>> -
>> -struct __old_ipc_perm
>> -{
>> - __key_t __key; /* Key. */
>> - unsigned short uid; /* Owner's user ID. */
>> - unsigned short gid; /* Owner's group ID. */
>> - unsigned short cuid; /* Creator's user ID. */
>> - unsigned short cgid; /* Creator's group ID. */
>> - unsigned short mode; /* Read/write permission. */
>> - unsigned short int __seq; /* Sequence number. */
>> -};
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] Update sysvipc kernel-features.h files for Linux 5.1
2019-05-20 17:53 ` [PATCH v2 2/2] Update sysvipc kernel-features.h files for Linux 5.1 Adhemerval Zanella
2019-05-20 19:10 ` Joseph Myers
@ 2019-08-28 14:07 ` Adhemerval Zanella
1 sibling, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2019-08-28 14:07 UTC (permalink / raw)
To: libc-alpha
Ping (x2) with Joseph raised issue corrected (missing spaces before '(' in
calls to 'defined', 'defined' should be treated like a function, and have
such spaces added).
On 20/05/2019 14:53, Adhemerval Zanella wrote:
> Changes from previous version:
>
> - Fixed condition to use wire-up syscalls for semop and semtimedop.
>
> --
>
> Linux 5.1 adds missing SySV IPC syscalls to the syscall table for
> remanining one that still uses the ipc syscall on glibc (m68k, mips-o32,
> powerpc, s390, sh, and sparc32). However the newly added direct ipc
> syscall are different than the old ones:
>
> 1. They do not expect IPC_64, meaning __IPC_64 should be set to zero
> when new syscalls are used. And new syscalls can not be used
> for compat functions like __old_semctl (to emulated old sysvipc it
> requires to use the old __NR_ipc syscall without __IPC_64).
> Thus IPC_64 is redefined for newer kernels on affected ABIs.
>
> 2. semtimedop and semop does not exist on 32-bit ABIs (only
> semtimedop_time64 is supplied). The provided syscall wrappers only
> uses the wire-up syscall if __NR_semtimedop and __NR_semop are
> also defined.
>
> Checked on x86_64-linux-gnu and i686-linux-gnu on both a 4.15 kernel
> configure with default options and sysvipc tests on a 5.1.2 kernel with
> --enable-kernel=5.1.
>
> * sysdeps/unix/sysv/linux/i386/kernel-features.h.
> (__ASSUME_DIRECT_SYSVIPC_SYSCALLS): Only undefine if
> [__LINUX_KERNEL_VERSION < 0x050100].
> (__ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/m68k/kernel-features.h
> (__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
> __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/mips/kernel-features.h
> (__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
> __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> (__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
> __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/s390/kernel-features.h
> (__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
> __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/sh/kernel-features.h
> (__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
> __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/sparc/kernel-features.h
> (__ASSUME_DIRECT_SYSVIPC_SYSCALLS,
> __ASSUME_SYSVIPC_DEFAULT_IPC_64): Likewise.
> * sysdeps/unix/sysv/linux/msgctl.c (__old_msgctl): Only use wire-up
> syscall if __ASSUME_SYSVIPC_DEFAULT_IPC_64 is not defined.
> * sysdeps/unix/sysv/linux/semctl.c (__old_semctl): Likewise.
> * sysdeps/unix/sysv/linux/shmctl.c (__old_shmctl): Likewise.
> * sysdeps/unix/sysv/linux/semop.c (semop): Only use wire-up if
> __NR_semop is also defined.
> * sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Likewise.
> ---
> sysdeps/unix/sysv/linux/i386/kernel-features.h | 8 +++++---
> sysdeps/unix/sysv/linux/m68k/kernel-features.h | 8 +++++---
> sysdeps/unix/sysv/linux/mips/kernel-features.h | 12 ++++++++----
> sysdeps/unix/sysv/linux/msgctl.c | 6 +++++-
> sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 8 +++++---
> sysdeps/unix/sysv/linux/s390/kernel-features.h | 8 +++++---
> sysdeps/unix/sysv/linux/semctl.c | 6 +++++-
> sysdeps/unix/sysv/linux/semop.c | 4 +++-
> sysdeps/unix/sysv/linux/semtimedop.c | 4 +++-
> sysdeps/unix/sysv/linux/sh/kernel-features.h | 8 +++++---
> sysdeps/unix/sysv/linux/shmctl.c | 6 +++++-
> sysdeps/unix/sysv/linux/sparc/kernel-features.h | 10 ++++++----
> 12 files changed, 60 insertions(+), 28 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> index 411eb2fca4..8c398ddd1f 100644
> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> @@ -43,9 +43,11 @@
> # undef __ASSUME_SENDTO_SYSCALL
> #endif
>
> -/* i686 only supports ipc syscall. */
> -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +/* i686 only supports ipc syscall before 5.1. */
> +#if __LINUX_KERNEL_VERSION < 0x050100
> +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +#endif
>
> #undef __ASSUME_CLONE_DEFAULT
> #define __ASSUME_CLONE_BACKWARDS 1
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index 46418977c8..c9be6bc167 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -50,6 +50,8 @@
> # undef __ASSUME_SET_ROBUST_LIST
> #endif
>
> -/* m68k only supports ipc syscall. */
> -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +/* m68k only supports ipc syscall before 5.1. */
> +#if __LINUX_KERNEL_VERSION < 0x050100
> +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
> index b9fa89c81d..8c85193a7a 100644
> --- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
> @@ -31,8 +31,12 @@
> pairs to start with an even-number register. */
> #if _MIPS_SIM == _ABIO32
> # define __ASSUME_ALIGNED_REGISTER_PAIRS 1
> -/* mips32 only supports ipc syscall. */
> -# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +/* mips32 only supports ipc syscall before 5.1. */
> +# if __LINUX_KERNEL_VERSION < 0x050100
> +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +# else
> +# endif
>
> /* The o32 MIPS fadvise64 syscall behaves as fadvise64_64. */
> # define __ASSUME_FADVISE64_AS_64_64 1
> @@ -40,6 +44,8 @@
> /* mips32 support wire-up network syscalls. */
> # define __ASSUME_RECV_SYSCALL 1
> # define __ASSUME_SEND_SYSCALL 1
> +#else
> +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> #endif
>
> /* Define that mips64-n32 is a ILP32 ABI to set the correct interface to
> @@ -50,5 +56,3 @@
>
> #undef __ASSUME_CLONE_DEFAULT
> #define __ASSUME_CLONE_BACKWARDS 1
> -
> -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
> index 2d49567686..1f034ebc6f 100644
> --- a/sysdeps/unix/sysv/linux/msgctl.c
> +++ b/sysdeps/unix/sysv/linux/msgctl.c
> @@ -61,7 +61,11 @@ int
> attribute_compat_text_section
> __old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
> {
> -#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +#if defined(__ASSUME_DIRECT_SYSVIPC_SYSCALLS) \
> + && !defined(__ASSUME_SYSVIPC_DEFAULT_IPC_64)
> + /* For architecture that have wire-up msgctl but also have __IPC_64 to a
> + value different than default (0x0), it means the old syscall was done
> + using __NR_ipc. */
> return INLINE_SYSCALL_CALL (msgctl, msqid, cmd, buf);
> #else
> return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf);
> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> index e787182396..fd2f22d730 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> @@ -44,9 +44,11 @@
>
> #include_next <kernel-features.h>
>
> -/* powerpc only supports ipc syscall. */
> -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +/* powerpc only supports ipc syscall before 5.1. */
> +#if __LINUX_KERNEL_VERSION < 0x050100
> +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +#endif
>
> #undef __ASSUME_CLONE_DEFAULT
> #define __ASSUME_CLONE_BACKWARDS 1
> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> index 57077ea4cc..7997a78e1d 100644
> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> @@ -45,9 +45,11 @@
> # undef __ASSUME_SENDTO_SYSCALL
> #endif
>
> -/* s390 only supports ipc syscall. */
> -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +/* s390 only supports ipc syscall before 5.1. */
> +#if __LINUX_KERNEL_VERSION < 0x050100
> +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +#endif
>
> #undef __ASSUME_CLONE_DEFAULT
> #define __ASSUME_CLONE_BACKWARDS2
> diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
> index d428400681..46bce6baac 100644
> --- a/sysdeps/unix/sysv/linux/semctl.c
> +++ b/sysdeps/unix/sysv/linux/semctl.c
> @@ -98,7 +98,11 @@ __old_semctl (int semid, int semnum, int cmd, ...)
> break;
> }
>
> -# ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +#if defined(__ASSUME_DIRECT_SYSVIPC_SYSCALLS) \
> + && !defined(__ASSUME_SYSVIPC_DEFAULT_IPC_64)
> + /* For architecture that have wire-up semctl but also have __IPC_64 to a
> + value different than default (0x0), it means the old syscall was done
> + using __NR_ipc. */
> return INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd, arg.array);
> # else
> return INLINE_SYSCALL_CALL (ipc, IPCOP_semctl, semid, semnum, cmd,
> diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
> index 119ee06878..e401f3487b 100644
> --- a/sysdeps/unix/sysv/linux/semop.c
> +++ b/sysdeps/unix/sysv/linux/semop.c
> @@ -26,7 +26,9 @@
> int
> semop (int semid, struct sembuf *sops, size_t nsops)
> {
> -#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> + /* semop wire-up syscall is not exported for 32-bit ABIs (they have
> + semtimedop_time64 instead with uses a 64-bit time_t). */
> +#if defined(__ASSUME_DIRECT_SYSVIPC_SYSCALLS) && defined (__NR_semop)
> return INLINE_SYSCALL_CALL (semop, semid, sops, nsops);
> #else
> return INLINE_SYSCALL_CALL (ipc, IPCOP_semop, semid, nsops, 0, sops);
> diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c
> index 1d746c4117..589ffc3fc8 100644
> --- a/sysdeps/unix/sysv/linux/semtimedop.c
> +++ b/sysdeps/unix/sysv/linux/semtimedop.c
> @@ -27,7 +27,9 @@ int
> semtimedop (int semid, struct sembuf *sops, size_t nsops,
> const struct timespec *timeout)
> {
> -#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> + /* semtimedop wire-up syscall is not exported for 32-bit ABIs (they have
> + semtimedop_time64 instead with uses a 64-bit time_t). */
> +#if defined(__ASSUME_DIRECT_SYSVIPC_SYSCALLS) && defined (__NR_semtimedop)
> return INLINE_SYSCALL_CALL (semtimedop, semid, sops, nsops, timeout);
> #else
> return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid,
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index cf68256abe..1721b89158 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -41,9 +41,11 @@
> before the offset. */
> #define __ASSUME_PRW_DUMMY_ARG 1
>
> -/* sh only supports ipc syscall. */
> -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> -#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +/* sh only supports ipc syscall before 5.1. */
> +#if __LINUX_KERNEL_VERSION < 0x050100
> +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +#endif
>
> /* Support for several syscalls was added in 4.8. */
> #if __LINUX_KERNEL_VERSION < 0x040800
> diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
> index b322f205f8..40aa115b24 100644
> --- a/sysdeps/unix/sysv/linux/shmctl.c
> +++ b/sysdeps/unix/sysv/linux/shmctl.c
> @@ -63,7 +63,11 @@ int
> attribute_compat_text_section
> __old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf)
> {
> -#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +#if defined(__ASSUME_DIRECT_SYSVIPC_SYSCALLS) \
> + && !defined(__ASSUME_SYSVIPC_DEFAULT_IPC_64)
> + /* For architecture that have wire-up shmctl but also have __IPC_64 to a
> + value different than default (0x0), it means the old syscall was done
> + using __NR_ipc. */
> return INLINE_SYSCALL_CALL (shmctl, shmid, cmd, buf);
> #else
> return INLINE_SYSCALL_CALL (ipc, IPCOP_shmctl, shmid, cmd, 0, buf);
> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> index 82c8236c23..b8f2212002 100644
> --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> @@ -58,10 +58,12 @@
> # undef __NR_pause
> #endif
>
> -/* sparc only supports ipc syscall. */
> -#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> -#ifndef __arch64__
> -# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +/* sparc only supports ipc syscall before 5.1. */
> +#if __LINUX_KERNEL_VERSION < 0x050100
> +# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
> +# if !defined __arch64__
> +# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
> +# endif
> #endif
>
> /* Support for the renameat2 syscall was added in 3.16. */
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-08-28 14:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 17:53 [PATCH v2 1/2] ipc: Refactor sysvipc internal definitions Adhemerval Zanella
2019-05-20 17:53 ` [PATCH v2 2/2] Update sysvipc kernel-features.h files for Linux 5.1 Adhemerval Zanella
2019-05-20 19:10 ` Joseph Myers
2019-05-20 19:20 ` Adhemerval Zanella
2019-08-28 14:07 ` Adhemerval Zanella
2019-08-09 12:18 ` [PATCH v2 1/2] ipc: Refactor sysvipc internal definitions Adhemerval Zanella
2019-08-28 14:06 ` Adhemerval Zanella
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).