public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/bz18231] ipc: Refactor sysvipc internal definitions
@ 2019-07-30 20:30 Adhemerval Zanella
0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2019-07-30 20:30 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9f2f2807d10f5767eaf7d6b22d331be98d3c818b
commit 9f2f2807d10f5767eaf7d6b22d331be98d3c818b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed May 15 15:20:58 2019 -0300
ipc: Refactor sysvipc internal definitions
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.
Diff:
---
sysdeps/unix/sysv/linux/alpha/ipc_priv.h | 18 +++---------
sysdeps/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 --------------
sysdeps/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 ++
sysdeps/unix/sysv/linux/m68k/kernel-features.h | 1 +
.../unix/sysv/linux/microblaze/kernel-features.h | 2 ++
sysdeps/unix/sysv/linux/mips/kernel-features.h | 2 ++
sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h | 18 +++---------
sysdeps/unix/sysv/linux/nios2/ipc_priv.h | 21 --------------
.../{csky/ipc_priv.h => nios2/kernel-features.h} | 11 ++++----
sysdeps/unix/sysv/linux/powerpc/ipc_priv.h | 28 +++----------------
sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/riscv/ipc_priv.h | 21 --------------
sysdeps/unix/sysv/linux/s390/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/sh/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/sparc/kernel-features.h | 3 ++
sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h | 20 ++++----------
sysdeps/unix/sysv/linux/x86_64/ipc_priv.h | 32 ----------------------
22 files changed, 67 insertions(+), 195 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
index fc5e713..fa79bdd 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 81f6c36..0de8881 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
@@ -52,4 +52,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 4220adf..c6604a8 100644
--- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -49,3 +49,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 5e170a9..0000000
--- 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 3ac725b..411eb2f 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 6b2438c..0000000
--- 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 1d1bd19..d387b44 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 1518bb5..42df126 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 1976724..4641897 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 a787409..3575818 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -67,3 +67,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 c341c3f..b9fa89c 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 bb31656..682ec35 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 d6e6be7..0000000
--- 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 e1beadb..7f40238 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 304ecc8..f641ed9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
@@ -16,27 +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 })
-
-#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
- (__nsops), 0, (__sops), (__timeout)
-
-#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 413a185..e787182 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 ea957a5..0000000
--- 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 8fdf38c..57077ea 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 0f287fb..110d6d3 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 f441bd8..82c8236 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 e436599..4ec29e5 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
#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
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 1ac288a..0000000
--- 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] 2+ messages in thread
* [glibc/azanella/bz18231] ipc: Refactor sysvipc internal definitions
@ 2019-07-23 20:34 Adhemerval Zanella
0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2019-07-23 20:34 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ea248d4f1df4000eda1f6cf47745918e268bf0ae
commit ea248d4f1df4000eda1f6cf47745918e268bf0ae
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed May 15 15:20:58 2019 -0300
ipc: Refactor sysvipc internal definitions
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.
Diff:
---
sysdeps/unix/sysv/linux/alpha/ipc_priv.h | 18 +++---------
sysdeps/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 --------------
sysdeps/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 ++
sysdeps/unix/sysv/linux/m68k/kernel-features.h | 1 +
.../unix/sysv/linux/microblaze/kernel-features.h | 2 ++
sysdeps/unix/sysv/linux/mips/kernel-features.h | 2 ++
sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h | 18 +++---------
sysdeps/unix/sysv/linux/nios2/ipc_priv.h | 21 --------------
.../{csky/ipc_priv.h => nios2/kernel-features.h} | 11 ++++----
sysdeps/unix/sysv/linux/powerpc/ipc_priv.h | 28 +++----------------
sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/riscv/ipc_priv.h | 21 --------------
sysdeps/unix/sysv/linux/s390/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/sh/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/sparc/kernel-features.h | 3 ++
sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h | 20 ++++----------
sysdeps/unix/sysv/linux/x86_64/ipc_priv.h | 32 ----------------------
22 files changed, 67 insertions(+), 195 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
index fc5e713..fa79bdd 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 81f6c36..0de8881 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
@@ -52,4 +52,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 4220adf..c6604a8 100644
--- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -49,3 +49,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 5e170a9..0000000
--- 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 3ac725b..411eb2f 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 6b2438c..0000000
--- 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 1d1bd19..d387b44 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 1518bb5..42df126 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 1976724..4641897 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 a787409..3575818 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -67,3 +67,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 c341c3f..b9fa89c 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 bb31656..682ec35 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 d6e6be7..0000000
--- 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 e1beadb..7f40238 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 304ecc8..f641ed9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
@@ -16,27 +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 })
-
-#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
- (__nsops), 0, (__sops), (__timeout)
-
-#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 413a185..e787182 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 ea957a5..0000000
--- 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 8fdf38c..57077ea 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 0f287fb..110d6d3 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 f441bd8..82c8236 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 e436599..4ec29e5 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
#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \
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 1ac288a..0000000
--- 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] 2+ messages in thread
end of thread, other threads:[~2019-07-30 20:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 20:30 [glibc/azanella/bz18231] ipc: Refactor sysvipc internal definitions Adhemerval Zanella
-- strict thread matches above, loose matches on Subject: below --
2019-07-23 20:34 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).