* [PATCH v3 00/17] Consolidate Linux sysvipc implementation
@ 2016-11-08 20:30 Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 03/17] Consolidate Linux msgctl implementation Adhemerval Zanella
` (18 more replies)
0 siblings, 19 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:30 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Refactor ipc_priv.h header to have working definition for all
architectures. The header basically contains Linux specific
ABI definitions for the architecture to correctly use default
implementation, including old ipc_perm definition, calling
convention, and __IPC_64 value.
- Set all architectures to use the default implementation. It
leaded to some code changes to accomodate all the architectures
calling convention (with ipc_priv.h change) and some fixes
on new default implementation.
- Change mips64 implementation way to use the default one.
- Some tests changes (name typos).
--
This patchset is a continuation of my Linux syscall consolidation
implementation and aimed for SySV IPC (message queue, semaphore,
and shared memory).
Current Linux default implementation only defines the old ipc
syscall method. Architectures need to either to imply the generic
syscalls.list or reimplement the syscall definition. To simplify
and allow to remove some old arch-specific implementation, I added
the direct syscall method for all supported IPC mechanisms.
Other changes are simple code reorganization to simplify and all
compatibility required for various ports.
The patchset also adds 3 simple tests that aims to check for correct
argument passing on syscall. The idea is not to be an extensive
testing of all supported IPC.
Checked on x86_64, i686, armhf, aarch64, and powerpc64le.
Adhemerval Zanella (17):
Add __ASSUME_SYSVIPC_SYSCALL for Linux
Refactor Linux ipc_priv header
Consolidate Linux msgctl implementation
Consolidate Linux msgrcv implementation
Use msgsnd syscall for Linux implementation
Use msgget syscall for Linux implementation
Add SYSV message queue test
Consolidate Linux semctl implementation
Use semget syscall for Linux implementation
Use semop syscall for Linux implementation
Consolidate Linux semtimedop implementation
Add SYSV semaphore test
Use shmat syscall for Linux implementation
Consolidate Linux shmctl implementation
Use shmdt syscall for linux implementation
Use shmget syscall for linux implementation
Add SYSV shared memory test
ChangeLog | 229 +++++++++++++++++++++
sysdeps/unix/sysv/linux/aarch64/ipc_priv.h | 32 +++
sysdeps/unix/sysv/linux/alpha/Makefile | 3 -
sysdeps/unix/sysv/linux/alpha/ipc_priv.h | 33 ++-
sysdeps/unix/sysv/linux/alpha/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/alpha/msgctl.c | 1 -
sysdeps/unix/sysv/linux/alpha/semctl.c | 1 -
sysdeps/unix/sysv/linux/alpha/shmctl.c | 1 -
sysdeps/unix/sysv/linux/alpha/syscalls.list | 13 --
sysdeps/unix/sysv/linux/arm/msgctl.c | 33 ---
sysdeps/unix/sysv/linux/arm/semctl.c | 54 -----
sysdeps/unix/sysv/linux/arm/shmctl.c | 34 ---
sysdeps/unix/sysv/linux/arm/syscalls.list | 12 --
sysdeps/unix/sysv/linux/generic/syscalls.list | 14 --
sysdeps/unix/sysv/linux/hppa/syscalls.list | 14 --
sysdeps/unix/sysv/linux/i386/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/ia64/syscalls.list | 14 --
sysdeps/unix/sysv/linux/ipc_ops.h | 30 +++
sysdeps/unix/sysv/linux/ipc_priv.h | 23 +--
sysdeps/unix/sysv/linux/kernel-features.h | 4 +
sysdeps/unix/sysv/linux/m68k/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/m68k/semtimedop.S | 69 -------
sysdeps/unix/sysv/linux/microblaze/msgctl.c | 1 -
sysdeps/unix/sysv/linux/microblaze/semctl.c | 1 -
sysdeps/unix/sysv/linux/microblaze/shmctl.c | 1 -
sysdeps/unix/sysv/linux/microblaze/syscalls.list | 12 --
sysdeps/unix/sysv/linux/mips/ipc_priv.h | 1 -
sysdeps/unix/sysv/linux/mips/kernel-features.h | 2 +
sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h | 32 +++
sysdeps/unix/sysv/linux/mips/mips64/msgctl.c | 17 +-
sysdeps/unix/sysv/linux/mips/mips64/semctl.c | 38 +---
sysdeps/unix/sysv/linux/mips/mips64/shmctl.c | 17 +-
sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 12 --
sysdeps/unix/sysv/linux/msgctl.c | 45 ++--
sysdeps/unix/sysv/linux/msgget.c | 11 +-
sysdeps/unix/sysv/linux/msgrcv.c | 26 +--
sysdeps/unix/sysv/linux/msgsnd.c | 11 +-
sysdeps/unix/sysv/linux/powerpc/ipc_priv.h | 23 +--
sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/s390/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 14 --
sysdeps/unix/sysv/linux/s390/semtimedop.c | 12 +-
sysdeps/unix/sysv/linux/semctl.c | 58 +++---
sysdeps/unix/sysv/linux/semget.c | 11 +-
sysdeps/unix/sysv/linux/semop.c | 10 +-
sysdeps/unix/sysv/linux/semtimedop.c | 13 +-
sysdeps/unix/sysv/linux/sh/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/shmat.c | 17 +-
sysdeps/unix/sysv/linux/shmctl.c | 59 +++---
sysdeps/unix/sysv/linux/shmdt.c | 12 +-
sysdeps/unix/sysv/linux/shmget.c | 13 +-
sysdeps/unix/sysv/linux/sparc/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h | 41 ++++
sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c | 32 ---
sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c | 54 -----
sysdeps/unix/sysv/linux/x86_64/ipc_priv.h | 32 +++
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 12 --
sysvipc/Makefile | 2 +
sysvipc/test-sysvmsg.c | 128 ++++++++++++
sysvipc/test-sysvsem.c | 116 +++++++++++
sysvipc/test-sysvshm.c | 130 ++++++++++++
test-skeleton.c | 2 +
62 files changed, 1010 insertions(+), 643 deletions(-)
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ipc_priv.h
delete mode 100644 sysdeps/unix/sysv/linux/alpha/msgctl.c
delete mode 100644 sysdeps/unix/sysv/linux/alpha/semctl.c
delete mode 100644 sysdeps/unix/sysv/linux/alpha/shmctl.c
delete mode 100644 sysdeps/unix/sysv/linux/arm/msgctl.c
delete mode 100644 sysdeps/unix/sysv/linux/arm/semctl.c
delete mode 100644 sysdeps/unix/sysv/linux/arm/shmctl.c
create mode 100644 sysdeps/unix/sysv/linux/ipc_ops.h
delete mode 100644 sysdeps/unix/sysv/linux/m68k/semtimedop.S
delete mode 100644 sysdeps/unix/sysv/linux/microblaze/msgctl.c
delete mode 100644 sysdeps/unix/sysv/linux/microblaze/semctl.c
delete mode 100644 sysdeps/unix/sysv/linux/microblaze/shmctl.c
delete mode 100644 sysdeps/unix/sysv/linux/mips/ipc_priv.h
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
create mode 100644 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
create mode 100644 sysvipc/test-sysvmsg.c
create mode 100644 sysvipc/test-sysvsem.c
create mode 100644 sysvipc/test-sysvshm.c
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 01/17] Add __ASSUME_SYSVIPC_SYSCALL for Linux
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (5 preceding siblings ...)
2016-11-08 20:30 ` [PATCH v3 12/17] Add SYSV semaphore test Adhemerval Zanella
@ 2016-11-08 20:30 ` Adhemerval Zanella
2016-11-08 21:19 ` Andreas Schwab
2016-11-08 20:30 ` [PATCH v3 13/17] Use shmat syscall for Linux implementation Adhemerval Zanella
` (11 subsequent siblings)
18 siblings, 1 reply; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:30 UTC (permalink / raw)
To: libc-alpha
On current minimum supported kernels, the SysV IPC on Linux is provided
by either the ipc syscalls or correspondent wire syscalls. Also, for
architectures that supports wire syscalls all syscalls are supported
in a set (msgct, msgrcv, msgsnd, msgget, semctl, semget, semop, semtimedop,
shmctl, shmat, shmget, shmdt).
The architectures that only supports ipc syscall are:
- i386, m68k, microblaze, mips32, powerpc (powerpc32, powerpc64, and
powerpc64le), s390 (32 and 64 bits), sh, sparc32, and sparc64.
And the architectures that only supports wired syscalls are:
- aarch64, alpha, hppa, ia64, mips64, mips64n32, nios2, tile
(tilepro, tilegx, and tilegx64), and x86_64
Also arm is the only one that supports both wire syscalls and the
ipc, although the ipc one is deprecated.
This patch adds a new define, __ASSUME_SYSVIPC_SYSCALL, that wired
syscalls are supported on the system and the general idea is to use
it where possible.
I also checked the syscall table for all architectures on Linux 4.9
and there is no change on described support for Linux 2.6.32/3.2.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_SYSVIPC_SYSCALL): New define.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_SYSVIPC_SYSCALL): Undef.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
(__ASSUME_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_SYSVIPC_SYSCALL): Likewise.
---
ChangeLog | 19 +++++++++++++++++++
sysdeps/unix/sysv/linux/i386/kernel-features.h | 3 +++
sysdeps/unix/sysv/linux/kernel-features.h | 4 ++++
sysdeps/unix/sysv/linux/m68k/kernel-features.h | 3 +++
sysdeps/unix/sysv/linux/mips/kernel-features.h | 2 ++
sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 3 +++
sysdeps/unix/sysv/linux/s390/kernel-features.h | 3 +++
sysdeps/unix/sysv/linux/sh/kernel-features.h | 3 +++
sysdeps/unix/sysv/linux/sparc/kernel-features.h | 3 +++
9 files changed, 43 insertions(+)
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 148963c..3da13d4 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -52,3 +52,6 @@
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
#endif
+
+/* i686 only supports ipc syscall. */
+#undef __ASSUME_SYSVIPC_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 1d3b554..cb0bc28 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -147,3 +147,7 @@
separate syscalls were only added later. */
#define __ASSUME_SENDMSG_SYSCALL 1
#define __ASSUME_RECVMSG_SYSCALL 1
+
+/* Support for SysV IPC through wired syscalls. All supported architectures
+ either support ipc syscall and/or all the ipc correspondent syscalls. */
+#define __ASSUME_SYSVIPC_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 46ec601..f0fd7ce 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -54,3 +54,6 @@
# undef __ASSUME_REQUEUE_PI
# undef __ASSUME_SET_ROBUST_LIST
#endif
+
+/* m68k only supports ipc syscall. */
+#undef __ASSUME_SYSVIPC_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index b486d90..5e88c8e 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -32,6 +32,8 @@
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_SYSVIPC_SYSCALL
#endif
/* Define that mips64-n32 is a ILP32 ABI to set the correct interface to
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 42a53f2..a81caf3 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -52,3 +52,6 @@
#endif
#include_next <kernel-features.h>
+
+/* powerpc only supports ipc syscall. */
+#undef __ASSUME_SYSVIPC_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index b3edee4..652436b 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -48,3 +48,6 @@
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
#endif
+
+/* s390 only supports ipc syscall. */
+#undef __ASSUME_SYSVIPC_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index ea4fdbc..f6175f7 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -50,3 +50,6 @@
the kernel interface for p{read,write}64 adds a dummy long argument
before the offset. */
#define __ASSUME_PRW_DUMMY_ARG 1
+
+/* sh only supports ipc syscall. */
+#undef __ASSUME_SYSVIPC_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 69c9c7c..20578bb 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -37,3 +37,6 @@
# undef __ASSUME_REQUEUE_PI
# undef __ASSUME_SET_ROBUST_LIST
#endif
+
+/* sparc only supports ipc syscall. */
+#undef __ASSUME_SYSVIPC_SYSCALL
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 10/17] Use semop syscall for Linux implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 03/17] Consolidate Linux msgctl implementation Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 11/17] Consolidate Linux semtimedop implementation Adhemerval Zanella
@ 2016-11-08 20:30 ` Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 04/17] Consolidate Linux msgrcv implementation Adhemerval Zanella
` (15 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:30 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Remove semop from syscalls.list.
--
This patch add a direct call to semop syscall if it is supported by
kernel headers.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semop): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semop):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semop):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/semop.c (semop): Use semop syscall if it is
defined.
---
ChangeLog | 14 ++++++++++++++
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/syscalls.list | 1 -
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/microblaze/syscalls.list | 1 -
sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/semop.c | 10 ++++++----
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
11 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6544bfd..d7a8b00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2016-11-08 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/alpha/syscalls.list (semop): Remove.
+ * sysdeps/unix/sysv/linux/arm/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semop):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semop):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/semop.c (semop): Use semop syscall if it is
+ defined.
+
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semget): Likewise.
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 2533263..c20543a 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -4,7 +4,6 @@ shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
sigstack - sigstack 2 sigstack
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index ef5bd01..3014db8 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -26,7 +26,6 @@ personality EXTRA personality Ei:i __personality personality
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 485f6fe..54e1778 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
semtimedop - semtimedop i:ipip semtimedop
-semop - semop i:ipi __semop semop
shmget - shmget i:iii __shmget shmget
shmctl - shmctl i:iip __shmctl shmctl
shmat - shmat i:ipi __shmat shmat
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 685ab93..8fbcaba 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -5,7 +5,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 56200ba..b9271cc 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -9,7 +9,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index a0b8ebf..3da653d 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -11,5 +11,4 @@ personality EXTRA personality Ei:i __personality personality
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index facae19..308e9f8 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -8,5 +8,4 @@ truncate - truncate i:si truncate truncate64
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 288e080..924d182 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -5,4 +5,3 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
index 593eb4c..bd57009 100644
--- a/sysdeps/unix/sysv/linux/semop.c
+++ b/sysdeps/unix/sysv/linux/semop.c
@@ -16,17 +16,19 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/sem.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Perform user-defined atomical operation of array of semaphores. */
int
semop (int semid, struct sembuf *sops, size_t nsops)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_semop, semid, (int) nsops, 0, sops);
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (semop, semid, sops, nsops);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semop, semid, nsops, 0, sops);
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index a6d2636..0a333a4 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,7 +6,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 03/17] Consolidate Linux msgctl implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
@ 2016-11-08 20:30 ` Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 11/17] Consolidate Linux semtimedop implementation Adhemerval Zanella
` (17 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:30 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Fix alpha issues and remove old unnecessary implementations.
- Change mips64 way to use default implementation (by undef SHLIB_COMPAT).
- Remove msgctl from syscalls.list.
--
This patch consolidates the msgctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/msgctl.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldmsgctl.
* sysdeps/unix/sysv/linux/alpha/msgctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/msgctl.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (oldmsgctl): Remove.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/msgctl.c: Use default
implementation.
* sysdeps/unix/sysv/linux/msgctl.c (__new_msgctl): Use msgctl syscall
if defined.
---
ChangeLog | 17 ++++++++
sysdeps/unix/sysv/linux/alpha/Makefile | 2 +-
sysdeps/unix/sysv/linux/alpha/msgctl.c | 1 -
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/msgctl.c | 33 ----------------
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/microblaze/msgctl.c | 1 -
sysdeps/unix/sysv/linux/mips/mips64/msgctl.c | 17 +++-----
sysdeps/unix/sysv/linux/msgctl.c | 45 +++++++++++-----------
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
13 files changed, 46 insertions(+), 76 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/alpha/msgctl.c
delete mode 100644 sysdeps/unix/sysv/linux/arm/msgctl.c
delete mode 100644 sysdeps/unix/sysv/linux/microblaze/msgctl.c
diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile
index 45941b0..c24dc2e 100644
--- a/sysdeps/unix/sysv/linux/alpha/Makefile
+++ b/sysdeps/unix/sysv/linux/alpha/Makefile
@@ -18,7 +18,7 @@ sysdep_routines += osf_select osf_gettimeofday osf_settimeofday \
osf_getrusage osf_wait4
# Support old ipc control
-sysdep_routines += oldmsgctl oldsemctl oldshmctl
+sysdep_routines += oldsemctl oldshmctl
CFLAGS-ioperm.c = -Wa,-mev6
endif
diff --git a/sysdeps/unix/sysv/linux/alpha/msgctl.c b/sysdeps/unix/sysv/linux/alpha/msgctl.c
deleted file mode 100644
index d65a5b9..0000000
--- a/sysdeps/unix/sysv/linux/alpha/msgctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 0c9efcb..f82c9da 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-oldmsgctl EXTRA msgctl i:iip __old_msgctl msgctl@GLIBC_2.0
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
diff --git a/sysdeps/unix/sysv/linux/arm/msgctl.c b/sysdeps/unix/sysv/linux/arm/msgctl.c
deleted file mode 100644
index 83c6744..0000000
--- a/sysdeps/unix/sysv/linux/arm/msgctl.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
- 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 <errno.h>
-#include <sys/msg.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-
-int
-__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
-{
- return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, buf);
-}
-
-#include <shlib-compat.h>
-versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 5993ab4..dea452b 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
msgget - msgget i:ii __msgget msgget
-msgctl - msgctl i:iip __msgctl msgctl
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
semget - semget i:iii __semget semget
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index a95c3dd..ead0e99 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-msgctl - msgctl i:iip __msgctl msgctl
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 68b6c9a..8a66ca9 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
-msgctl - msgctl i:iip __msgctl msgctl
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
diff --git a/sysdeps/unix/sysv/linux/microblaze/msgctl.c b/sysdeps/unix/sysv/linux/microblaze/msgctl.c
deleted file mode 100644
index d65a5b9..0000000
--- a/sysdeps/unix/sysv/linux/microblaze/msgctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c b/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
index c4dc7ff..928c3dc 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
@@ -15,18 +15,11 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <sys/msg.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
+#include <shlib-compat.h>
-int __msgctl (int msqid, int cmd, struct msqid_ds *buf);
+#undef SHLIB_COMPAT
+#define SHLIB_COMPAT(a, b, c) 0
-int
-__msgctl (int msqid, int cmd, struct msqid_ds *buf)
-{
- return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, buf);
-}
+#define DEFAULT_VERSION GLIBC_2_0
-#include <shlib-compat.h>
-versioned_symbol (libc, __msgctl, msgctl, GLIBC_2_0);
+#include <sysdeps/unix/sysv/linux/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
index e48fbb3..b8445fb 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -16,17 +16,30 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/msg.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <string.h>
-#include <sys/syscall.h>
#include <shlib-compat.h>
+#include <errno.h>
+
+#ifndef DEFAULT_VERSION
+# define DEFAULT_VERSION GLIBC_2_2
+#endif
+
+int
+__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
+{
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd | __IPC_64, 0,
+ buf);
+#endif
+}
+versioned_symbol (libc, __new_msgctl, msgctl, DEFAULT_VERSION);
-#include <kernel-features.h>
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
struct __old_msqid_ds
{
struct __old_ipc_perm msg_perm; /* structure describing operation permission */
@@ -44,27 +57,15 @@ struct __old_msqid_ds
__ipc_pid_t msg_lrpid; /* pid of last msgrcv() */
};
-/* Allows to control internal state and destruction of message queue
- objects. */
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
-int __old_msgctl (int, int, struct __old_msqid_ds *);
-#endif
-int __new_msgctl (int, int, struct msqid_ds *);
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
int
attribute_compat_text_section
__old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, buf);
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf);
+#endif
}
compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
#endif
-
-int
-__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
-{
- return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd | __IPC_64, 0, buf);
-}
-
-versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 9f03d26..808cbbb 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-msgctl - msgctl i:iip __msgctl msgctl
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index d09d101..9eb51a4 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -2,7 +2,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
-msgctl - msgctl i:iip __msgctl msgctl
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 02/17] Refactor Linux ipc_priv header
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (7 preceding siblings ...)
2016-11-08 20:30 ` [PATCH v3 13/17] Use shmat syscall for Linux implementation Adhemerval Zanella
@ 2016-11-08 20:30 ` Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 14/17] Consolidate Linux shmctl implementation Adhemerval Zanella
` (9 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:30 UTC (permalink / raw)
To: libc-alpha
This patch refactor current ipc_priv.h Linux headers in two directions:
- Remove cross platform references (for instance alpha including powerpc
definition) and add required definition for each required port. The
idea is to avoid tie one architecture definition with another and make
platform change independent.
- Move all common definitions (the ipc syscall commands) on a common
header, ipc_ops.h.
- Add all architecture ABI peculiarities to ipc_priv, including calling
conventions and __IPC_64 value.
Since current IPC_64 default now on kernel is 0x100, some architectures
require it to 0 (for instance x86_64) while others continue to use a
non zero default regardless (powerpc).
* sysdeps/unix/sysv/linux/aarch64/ipc_priv.h: New file.
* sysdeps/unix/sysv/linux/alpha/ipc_priv.h: Avoid included other arch
definition and define its own.
* sysdeps/unix/sysv/linux/ipc_ops.h: New file.
* sysdeps/unix/sysv/linux/x86_64/ipc_priv.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h: Likewise.
* sysdeps/unix/sysv/linux/mips/ipc_priv.h: Remove file.
* sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h: New file.
* sysdeps/unix/sysv/linux/ipc_priv.h: Move ipc syscall operation
definitions to common header.
* sysdeps/unix/sysv/linux/powerpc/ipc_priv.h: Use common syscall
operation from ipc_ops.h.
---
ChangeLog | 12 +++++++
sysdeps/unix/sysv/linux/aarch64/ipc_priv.h | 32 ++++++++++++++++++
sysdeps/unix/sysv/linux/alpha/ipc_priv.h | 33 ++++++++++++++++++-
sysdeps/unix/sysv/linux/ipc_ops.h | 30 +++++++++++++++++
sysdeps/unix/sysv/linux/ipc_priv.h | 23 +++++--------
sysdeps/unix/sysv/linux/mips/ipc_priv.h | 1 -
sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h | 32 ++++++++++++++++++
sysdeps/unix/sysv/linux/powerpc/ipc_priv.h | 23 +++++--------
sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h | 41 ++++++++++++++++++++++++
sysdeps/unix/sysv/linux/x86_64/ipc_priv.h | 32 ++++++++++++++++++
10 files changed, 227 insertions(+), 32 deletions(-)
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ipc_priv.h
create mode 100644 sysdeps/unix/sysv/linux/ipc_ops.h
delete mode 100644 sysdeps/unix/sysv/linux/mips/ipc_priv.h
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
create mode 100644 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
diff --git a/ChangeLog b/ChangeLog
index 77c94dc..8520a7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2016-11-08 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/aarch64/ipc_priv.h: New file.
+ * sysdeps/unix/sysv/linux/alpha/ipc_priv.h: Avoid included other arch
+ definition and define its own.
+ * sysdeps/unix/sysv/linux/ipc_ops.h: New file.
+ * sysdeps/unix/sysv/linux/x86_64/ipc_priv.h: Likewise.
+ * sysdeps/unix/sysv/linux/mips/ipc_priv.h: Remove file.
+ * sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h: New file.
+ * sysdeps/unix/sysv/linux/ipc_priv.h: Move ipc syscall operation
+ definitions to common header.
+ * sysdeps/unix/sysv/linux/powerpc/ipc_priv.h: Use common syscall
+ operation from ipc_ops.h.
+
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_SYSVIPC_SYSCALL): New define.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
diff --git a/sysdeps/unix/sysv/linux/aarch64/ipc_priv.h b/sysdeps/unix/sysv/linux/aarch64/ipc_priv.h
new file mode 100644
index 0000000..1a31396
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ipc_priv.h
@@ -0,0 +1,32 @@
+/* Old SysV permission definition for Linux. AArch64 version.
+ Copyright (C) 2016 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 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. */
+};
diff --git a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
index 67883be..06444fc 100644
--- a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
@@ -1 +1,32 @@
-#include <sysdeps/unix/sysv/linux/powerpc/ipc_priv.h>
+/* Old SysV permission definition for Linux. Alpha version.
+ Copyright (C) 2016 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 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. */
+};
diff --git a/sysdeps/unix/sysv/linux/ipc_ops.h b/sysdeps/unix/sysv/linux/ipc_ops.h
new file mode 100644
index 0000000..ea3028c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ipc_ops.h
@@ -0,0 +1,30 @@
+/* The codes for the functions to use the ipc syscall multiplexer.
+ Copyright (C) 2016 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/>. */
+
+#define IPCOP_semop 1
+#define IPCOP_semget 2
+#define IPCOP_semctl 3
+#define IPCOP_semtimedop 4
+#define IPCOP_msgsnd 11
+#define IPCOP_msgrcv 12
+#define IPCOP_msgget 13
+#define IPCOP_msgctl 14
+#define IPCOP_shmat 21
+#define IPCOP_shmdt 22
+#define IPCOP_shmget 23
+#define IPCOP_shmctl 24
diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
index 7ded463..9b97f00 100644
--- a/sysdeps/unix/sysv/linux/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/ipc_priv.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Old SysV permission definition for Linux. Default version.
+ Copyright (C) 1995-2016 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
@@ -15,7 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <sys/ipc.h>
+#include <sys/ipc.h> /* For __key_t */
#define __IPC_64 0x100
@@ -30,17 +31,9 @@ struct __old_ipc_perm
unsigned short int __seq; /* Sequence number. */
};
+#define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
-/* The codes for the functions to use the ipc syscall multiplexer. */
-#define IPCOP_semop 1
-#define IPCOP_semget 2
-#define IPCOP_semctl 3
-#define IPCOP_semtimedop 4
-#define IPCOP_msgsnd 11
-#define IPCOP_msgrcv 12
-#define IPCOP_msgget 13
-#define IPCOP_msgctl 14
-#define IPCOP_shmat 21
-#define IPCOP_shmdt 22
-#define IPCOP_shmget 23
-#define IPCOP_shmctl 24
+#define MSGRCV_ARGS(__msgp, __msgtyp) \
+ ((long int []){ (long int) __msgp, __msgtyp })
+
+#include <ipc_ops.h>
diff --git a/sysdeps/unix/sysv/linux/mips/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/ipc_priv.h
deleted file mode 100644
index 67883be..0000000
--- a/sysdeps/unix/sysv/linux/mips/ipc_priv.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/powerpc/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
new file mode 100644
index 0000000..9f47d89
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
@@ -0,0 +1,32 @@
+/* Old SysV permission definition for Linux. MIPS64 version.
+ Copyright (C) 2016 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>
+
+#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. */
+};
diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
index baae7ab..4f72f58 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Old SysV permission definition for Linux. PowerPC version.
+ Copyright (C) 1995-2016 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
@@ -15,7 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <sys/ipc.h>
+#include <sys/ipc.h> /* For __key_t */
#define __IPC_64 0x100
@@ -30,17 +31,9 @@ struct __old_ipc_perm
unsigned short int __seq; /* Sequence number. */
};
+#define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
-/* The codes for the functions to use the ipc syscall multiplexer. */
-#define IPCOP_semop 1
-#define IPCOP_semget 2
-#define IPCOP_semctl 3
-#define IPCOP_semtimedop 4
-#define IPCOP_msgsnd 11
-#define IPCOP_msgrcv 12
-#define IPCOP_msgget 13
-#define IPCOP_msgctl 14
-#define IPCOP_shmat 21
-#define IPCOP_shmdt 22
-#define IPCOP_shmget 23
-#define IPCOP_shmctl 24
+#define MSGRCV_ARGS(__msgp, __msgtyp) \
+ ((long int []){ (long int) __msgp, __msgtyp })
+
+#include <ipc_ops.h>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
new file mode 100644
index 0000000..386ff8a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
@@ -0,0 +1,41 @@
+/* Old SysV permission definition for Linux. x86_64 version.
+ Copyright (C) 2016 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 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. */
+};
+
+/* SPARC semctl multiplex syscall expects the union pointed address, not
+ the union address itself. */
+#define SEMCTL_ARG_ADDRESS(__arg) __arg.array
+
+/* Also for msgrcv it does not use the kludge on final 2 arguments. */
+#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
new file mode 100644
index 0000000..d39db53
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
@@ -0,0 +1,32 @@
+/* Old SysV permission definition for Linux. x86_64 version.
+ Copyright (C) 2016 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.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 15/17] Use shmdt syscall for linux implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (3 preceding siblings ...)
2016-11-08 20:30 ` [PATCH v3 04/17] Consolidate Linux msgrcv implementation Adhemerval Zanella
@ 2016-11-08 20:30 ` Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 12/17] Add SYSV semaphore test Adhemerval Zanella
` (13 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:30 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Remove shmdt from syscalls.list.
--
this patch add a direct call to shmdt syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmdt): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmdt):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmdt):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/shmdt.c (shmdt): Use shmdt syscall if it is
defined.
---
ChangeLog | 14 ++++++++++++++
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/syscalls.list | 1 -
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/microblaze/syscalls.list | 1 -
sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/shmdt.c | 12 +++++++-----
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
11 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index bf9c8ad..096bf22 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
sigstack - sigstack 2 sigstack
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index f50a5cf..b1ea664 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -23,7 +23,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 80244c4..51ce148 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
shmget - shmget i:iii __shmget shmget
-shmdt - shmdt i:s __shmdt shmdt
# Socket APIs
socket - socket i:iii __socket socket
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index d755bfd..e75dd43 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 90bd870..5ebade1 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 8b844f2..7a5666f 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -8,5 +8,4 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index c6883c5..461b4ef 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -5,5 +5,4 @@ truncate - truncate i:si truncate truncate64
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 4d478ce..0ccbffa 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,5 +1,4 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/shmdt.c b/sysdeps/unix/sysv/linux/shmdt.c
index 7224d6f..9475161 100644
--- a/sysdeps/unix/sysv/linux/shmdt.c
+++ b/sysdeps/unix/sysv/linux/shmdt.c
@@ -16,12 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <sys/shm.h>
+#include <sys/msg.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Detach shared memory segment starting at address specified by SHMADDR
from the caller's data segment. */
@@ -29,5 +27,9 @@
int
shmdt (const void *shmaddr)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_shmdt, 0, 0, 0, (void *) shmaddr);
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (shmdt, shmaddr);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_shmdt, 0, 0, 0, shmaddr);
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index a5db9dc..65a03ff 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -2,7 +2,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 11/17] Consolidate Linux semtimedop implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 03/17] Consolidate Linux msgctl implementation Adhemerval Zanella
@ 2016-11-08 20:30 ` Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 10/17] Use semop syscall for Linux implementation Adhemerval Zanella
` (16 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:30 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Remove semtimedop from syscalls.list.
--
This patch consolidates the semtimedop Linux implementation in only
one default file, sysdeps/unix/sysv/linux/semtimedop.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semtimedop): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/m68k/semtimedop.S: Remove file.
* sysdeps/unix/sysv/linux/s390/semtimedop.c: Reorganize headers and
add a comment about s390 syscall difference from default one.
* sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use semtimedop
syscall if it is defined.
---
ChangeLog | 17 ++++++
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/syscalls.list | 1 -
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/m68k/semtimedop.S | 69 -----------------------
sysdeps/unix/sysv/linux/microblaze/syscalls.list | 1 -
sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/s390/semtimedop.c | 12 ++--
sysdeps/unix/sysv/linux/semtimedop.c | 13 +++--
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
12 files changed, 31 insertions(+), 88 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/m68k/semtimedop.S
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index c20543a..8d3a042 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -4,7 +4,6 @@ shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
sigstack - sigstack 2 sigstack
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 3014db8..1b2de93 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -26,7 +26,6 @@ personality EXTRA personality Ei:i __personality personality
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 54e1778..e12fb3e 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# SysV APIs
-semtimedop - semtimedop i:ipip semtimedop
shmget - shmget i:iii __shmget shmget
shmctl - shmctl i:iip __shmctl shmctl
shmat - shmat i:ipi __shmat shmat
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 8fbcaba..a8fbc44 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -5,7 +5,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index b9271cc..eda4e4e 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -9,7 +9,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/m68k/semtimedop.S b/sysdeps/unix/sysv/linux/m68k/semtimedop.S
deleted file mode 100644
index b291070..0000000
--- a/sysdeps/unix/sysv/linux/m68k/semtimedop.S
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Andreas Schwab <schwab@suse.de>, 2003.
-
- 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 <sysdep.h>
-
-#define SYSOP_semtimedop 4
-
-#define SVRSP 8 /* saved register space */
-#define PARMS 4+SVRSP /* space for 3 saved regs */
-#define SEMID PARMS
-#define SOPS SEMID+4
-#define NSOPS SOPS+4
-#define TIMEOUT NSOPS+4
-
- .text
-ENTRY (semtimedop)
-
- /* Save registers. */
- move.l %d2, %a1
- move.l %d3, -(%sp)
- cfi_adjust_cfa_offset (4)
- move.l %d5, -(%sp)
- cfi_adjust_cfa_offset (4)
- cfi_register (%d2, %a1)
- cfi_rel_offset (%d3, 0)
- cfi_rel_offset (%d5, 4)
-
- move.l #SYSOP_semtimedop, %d1
- move.l SEMID(%sp), %d2
- move.l NSOPS(%sp), %d3
- move.l SOPS(%sp), %d5
- move.l TIMEOUT(%sp), %a0
- move.l #SYS_ify (ipc), %d0
-
- trap #0
-
- /* Restore registers. */
- move.l (%sp)+, %d5
- cfi_adjust_cfa_offset (-4)
- cfi_restore (%d5)
- move.l (%sp)+, %d3
- cfi_adjust_cfa_offset (-4)
- cfi_restore (%d3)
- move.l %a1, %d2
- cfi_restore (%d2)
-
- /* Check for error. */
- tst.l %d0
- jmi SYSCALL_ERROR_LABEL
-
- /* Successful; return the syscall's value. */
- ret
-
-PSEUDO_END (semtimedop)
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 3da653d..d9afda0 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -11,4 +11,3 @@ personality EXTRA personality Ei:i __personality personality
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index 308e9f8..63e037e 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -8,4 +8,3 @@ truncate - truncate i:si truncate truncate64
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/s390/semtimedop.c b/sysdeps/unix/sysv/linux/s390/semtimedop.c
index f226953..db43f00 100644
--- a/sysdeps/unix/sysv/linux/s390/semtimedop.c
+++ b/sysdeps/unix/sysv/linux/s390/semtimedop.c
@@ -16,12 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/sem.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Perform user-defined atomical operation of array of semaphores. */
@@ -29,6 +27,10 @@ int
semtimedop (int semid, struct sembuf *sops, size_t nsops,
const struct timespec *timeout)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_semtimedop,
- semid, (int) nsops, timeout, sops);
+ /* The s390 sys_ipc variant has only five parameters instead of six
+ (as for default variant) and the only difference is the handling of
+ SEMTIMEDOP where on s390 the third parameter is used as a pointer
+ to a struct timespec where the generic variant uses fifth parameter. */
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid, nsops, timeout,
+ sops);
}
diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c
index 30ee7fe..6ae8142 100644
--- a/sysdeps/unix/sysv/linux/semtimedop.c
+++ b/sysdeps/unix/sysv/linux/semtimedop.c
@@ -16,12 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/sem.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Perform user-defined atomical operation of array of semaphores. */
@@ -29,7 +27,10 @@ int
semtimedop (int semid, struct sembuf *sops, size_t nsops,
const struct timespec *timeout)
{
- return INLINE_SYSCALL (ipc, 6, IPCOP_semtimedop,
- semid, (int) nsops, 0, sops,
- timeout);
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (semtimedop, semid, sops, nsops, timeout);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid, nsops, 0, sops,
+ timeout);
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 0a333a4..8c5bfcb 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,7 +6,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 13/17] Use shmat syscall for Linux implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (6 preceding siblings ...)
2016-11-08 20:30 ` [PATCH v3 01/17] Add __ASSUME_SYSVIPC_SYSCALL for Linux Adhemerval Zanella
@ 2016-11-08 20:30 ` Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 02/17] Refactor Linux ipc_priv header Adhemerval Zanella
` (10 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:30 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Remove semat from syscalls.list.
- Fixed alpha build with correct __NR_shmat definition.
--
This patch add a direct call to shmat syscall if it is supported by
kernel features.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmat): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmat):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmat):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/alpha/kernel-features.h (__NR_shmat):
Define to __NR_osf_shmat.
* sysdeps/unix/sysv/linux/shmat.c (shmat): Use shmat syscall if it is
defined.
---
ChangeLog | 16 ++++++++++++++++
sysdeps/unix/sysv/linux/alpha/kernel-features.h | 3 +++
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/syscalls.list | 1 -
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/microblaze/syscalls.list | 1 -
sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 9 ++++-----
sysdeps/unix/sysv/linux/shmat.c | 17 ++++++++---------
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
12 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
index f09222d..2fc3b77 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
@@ -29,4 +29,7 @@
#undef __ASSUME_STATFS64
#define __ASSUME_STATFS64 0
+/* Alpha defines SysV ipc shmat syscall with a different name. */
+#define __NR_shmat __NR_osf_shmat
+
#endif /* _KERNEL_FEATURES_H */
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 8d3a042..9948d2d 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 1b2de93..f50a5cf 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -23,7 +23,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index e12fb3e..0df73a9 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -3,7 +3,6 @@
# SysV APIs
shmget - shmget i:iii __shmget shmget
shmctl - shmctl i:iip __shmctl shmctl
-shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
# Socket APIs
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index a8fbc44..f757f02 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index eda4e4e..b0a3a44 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
-shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index d9afda0..8b844f2 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -8,6 +8,5 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index 63e037e..c6883c5 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -5,6 +5,5 @@ truncate - truncate i:si truncate truncate64
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 924d182..40ed7c5 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,7 +1,6 @@
-# File name Caller Syscall name # args Strong name Weak names
+# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmat - shmat i:ipi __shmat shmat
-shmctl - shmctl i:iip __shmctl shmctl
-shmdt - shmdt i:s __shmdt shmdt
-shmget - shmget i:iii __shmget shmget
+shmctl - shmctl i:iip __shmctl shmctl
+shmdt - shmdt i:s __shmdt shmdt
+shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c
index 5afc93c..a105bcb 100644
--- a/sysdeps/unix/sysv/linux/shmat.c
+++ b/sysdeps/unix/sysv/linux/shmat.c
@@ -16,13 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <sys/shm.h>
+#include <sys/msg.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <unistd.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Attach the shared memory segment associated with SHMID to the data
segment of the calling process. SHMADDR and SHMFLG determine how
@@ -31,17 +28,19 @@
void *
shmat (int shmid, const void *shmaddr, int shmflg)
{
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return (void*) INLINE_SYSCALL_CALL (shmat, shmid, shmaddr, shmflg);
+#else
INTERNAL_SYSCALL_DECL(err);
unsigned long resultvar;
void *raddr;
- resultvar = INTERNAL_SYSCALL (ipc, err, 5, IPCOP_shmat,
- shmid, shmflg,
- (long int) &raddr,
- (void *) shmaddr);
+ resultvar = INTERNAL_SYSCALL_CALL (ipc, err, IPCOP_shmat, shmid, shmflg,
+ &raddr, shmaddr);
if (INTERNAL_SYSCALL_ERROR_P (resultvar, err))
return (void *) INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (resultvar,
err));
return raddr;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 8c5bfcb..1c2c663 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -2,7 +2,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
-shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 04/17] Consolidate Linux msgrcv implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (2 preceding siblings ...)
2016-11-08 20:30 ` [PATCH v3 10/17] Use semop syscall for Linux implementation Adhemerval Zanella
@ 2016-11-08 20:30 ` Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 15/17] Use shmdt syscall for linux implementation Adhemerval Zanella
` (14 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:30 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Use MSGRCV_ARGS to pass latest 2 arguments to accomodate sparc64
requirement.
- Remove msgrcv from syscalls.list.
--
This patch consolidates the msgrcv Linux implementation in only
one default file, sysdeps/unix/sysv/linux/msgrcv.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgctl): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise,
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/msgrcv.c (__libc_msgrcv): Use msgrcv syscall
if defined.
* sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c: Remove file.
---
ChangeLog | 15 ++++++++++
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/syscalls.list | 1 -
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/microblaze/syscalls.list | 1 -
sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/msgrcv.c | 26 ++++--------------
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c | 32 ----------------------
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
12 files changed, 21 insertions(+), 61 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index f82c9da..ddbd672 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 82402b1..297f7e7 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -24,7 +24,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index dea452b..6869a48 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
semget - semget i:iii __semget semget
semctl - semctl i:iiii __semctl semctl
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index ead0e99..e4e40a0 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -2,7 +2,6 @@
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 8a66ca9..a60e615 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -6,7 +6,6 @@ getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index da0fd4e..99dc33b 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -9,7 +9,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index d2d851e..1f06389 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -6,7 +6,6 @@ truncate - truncate i:si truncate truncate64
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c
index c4dd219..720a2fc 100644
--- a/sysdeps/unix/sysv/linux/msgrcv.c
+++ b/sysdeps/unix/sysv/linux/msgrcv.c
@@ -16,33 +16,19 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/msg.h>
#include <ipc_priv.h>
-
#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-/* Kludge to work around Linux' restriction of only up to five
- arguments to a system call. */
-struct ipc_kludge
- {
- void *msgp;
- long int msgtyp;
- };
-
ssize_t
__libc_msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp,
int msgflg)
{
- /* The problem here is that Linux' calling convention only allows up to
- fives parameters to a system call. */
- struct ipc_kludge tmp;
-
- tmp.msgp = msgp;
- tmp.msgtyp = msgtyp;
-
- return SYSCALL_CANCEL (ipc, IPCOP_msgrcv, msqid, msgsz, msgflg, &tmp);
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return SYSCALL_CANCEL (msgrcv, msqid, msgp, msgsz, msgtyp, msgflg);
+#else
+ return SYSCALL_CANCEL (ipc, IPCOP_msgrcv, msqid, msgsz, msgflg,
+ MSGRCV_ARGS (msgp, msgtyp));
+#endif
}
weak_alias (__libc_msgrcv, msgrcv)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 808cbbb..59b93fe 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -2,7 +2,6 @@
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c b/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
deleted file mode 100644
index ccaa4ee..0000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 2010-2016 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 <errno.h>
-#include <sys/msg.h>
-#include <ipc_priv.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-ssize_t
-__libc_msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp,
- int msgflg)
-{
- return SYSCALL_CANCEL (ipc, IPCOP_msgrcv, msqid, msgsz, msgflg,
- msgp, msgtyp);
-}
-weak_alias (__libc_msgrcv, msgrcv)
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 9eb51a4..945f084 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -3,7 +3,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 12/17] Add SYSV semaphore test
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (4 preceding siblings ...)
2016-11-08 20:30 ` [PATCH v3 15/17] Use shmdt syscall for linux implementation Adhemerval Zanella
@ 2016-11-08 20:30 ` Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 01/17] Add __ASSUME_SYSVIPC_SYSCALL for Linux Adhemerval Zanella
` (12 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:30 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Change some error strings (it was using message queue names).
--
This patch adds a simple SYSV semaphore test to check for correct
argument passing on kernel. The idea is neither to be an extensive
testing nor to check for any specific Linux test.
* sysvipc/Makefile (tests): Add test-sysvsem.
* sysvipc/test-sysvsem.c: New file.
---
ChangeLog | 3 ++
sysvipc/Makefile | 2 +-
sysvipc/test-sysvsem.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 120 insertions(+), 1 deletion(-)
create mode 100644 sysvipc/test-sysvsem.c
diff --git a/sysvipc/Makefile b/sysvipc/Makefile
index 73bb9cf..32d64dc 100644
--- a/sysvipc/Makefile
+++ b/sysvipc/Makefile
@@ -30,7 +30,7 @@ routines := ftok \
semop semget semctl semtimedop \
shmat shmdt shmget shmctl
-tests := test-sysvmsg
+tests := test-sysvmsg test-sysvsem
include ../Rules
diff --git a/sysvipc/test-sysvsem.c b/sysvipc/test-sysvsem.c
new file mode 100644
index 0000000..b71bc03
--- /dev/null
+++ b/sysvipc/test-sysvsem.c
@@ -0,0 +1,116 @@
+/* Basic tests for SYSV semaphore functions.
+ Copyright (C) 2016 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 <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+
+static void do_prepare (void);
+#define PREPARE(argc, argv) do_prepare ()
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+/* This defines the `main' function and some more. */
+#include <test-skeleton.c>
+
+/* These are for the temporary file we generate. */
+static char *name;
+static int semid;
+
+static void
+remove_sem (void)
+{
+ /* Enforce message queue removal in case o early test failure.
+ Ignore error since the msgq maybe already being removed. */
+ semctl (semid, 0, IPC_RMID, 0);
+}
+
+static void
+do_prepare (void)
+{
+ int fd = create_temp_file ("tst-sysvsem.", &name);
+ if (fd == -1)
+ FAIL_EXIT1 ("cannot create temporary file (errno=%d)", errno);
+}
+
+/* It is not an extensive test, but rather a functional one aimed to check
+ correct parameter passing on kernel. */
+
+#define SEM_MODE 0644
+
+static int
+do_test (void)
+{
+ atexit (remove_sem);
+
+ key_t key = ftok (name, 'G');
+ if (key == -1)
+ FAIL_EXIT1 ("ftok failed");
+
+ semid = semget(key, 1, IPC_CREAT | IPC_EXCL | SEM_MODE);
+ if (semid == -1)
+ {
+ if (errno == ENOSYS)
+ FAIL_UNSUPPORTED ("msgget not supported");
+ FAIL_EXIT1 ("semget failed (errno=%d)", errno);
+ }
+
+ /* Get semaphore kernel information and do some sanitiy checks. */
+ struct semid_ds seminfo;
+ if (semctl (semid, 0, IPC_STAT, &seminfo) == -1)
+ FAIL_EXIT1 ("semctl with IPC_STAT failed (errno=%d)", errno);
+
+ if (seminfo.sem_perm.__key != key)
+ FAIL_EXIT1 ("semid_ds::sem_perm::key (%d) != %d",
+ (int) seminfo.sem_perm.__key, (int) key);
+ if (seminfo.sem_perm.mode != SEM_MODE)
+ FAIL_EXIT1 ("semid_ds::sem_perm::mode (%o) != %o",
+ seminfo.sem_perm.mode, SEM_MODE);
+ if (seminfo.sem_nsems != 1)
+ FAIL_EXIT1 ("semid_ds::sem_nsems (%lu) != 1",
+ (long unsigned) seminfo.sem_nsems);
+
+ /* Some lock/unlock basic tests. */
+ struct sembuf sb1 = { 0, 1, 0 };
+ if (semop (semid, &sb1, 1) == -1)
+ FAIL_EXIT1 ("semop failed (errno=%i)", errno);
+
+ struct sembuf sb2 = { 0, -1, 0 };
+ if (semop (semid, &sb2, 1) == -1)
+ FAIL_EXIT1 ("semop failed (errno=%i)", errno);
+
+#ifdef _GNU_SOURCE
+ /* Set a time for half a second. The semaphore operation should timeout
+ with EAGAIN. */
+ struct timespec ts = { 0 /* sec */, 500000000 /* nsec */ };
+ if (semtimedop (semid, &sb2, 1, &ts) != -1
+ || (errno != EAGAIN && errno != ENOSYS))
+ FAIL_EXIT1 ("semtimedop succeed or returned errno != {EAGAIN,ENOSYS} "
+ "(errno=%i)", errno);
+#endif
+
+ /* Finally free up the semnaphore resource. */
+ if (semctl (semid, 0, IPC_RMID, 0) == -1)
+ FAIL_EXIT1 ("semctl failed (errno=%d)", errno);
+
+ return 0;
+}
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 16/17] Use shmget syscall for linux implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (10 preceding siblings ...)
2016-11-08 20:31 ` [PATCH v3 06/17] Use msgget syscall for Linux implementation Adhemerval Zanella
@ 2016-11-08 20:31 ` Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 17/17] Add SYSV shared memory test Adhemerval Zanella
` (6 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:31 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Remove shmget from syscalls.list.
--
this patch add a direct call to shmget syscall if it is supported by
kernel features.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmget):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmget):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/shmget.c (shmget): Use shmget syscall if it
is defined.
---
ChangeLog | 14 ++++++++++++++
sysdeps/unix/sysv/linux/alpha/syscalls.list | 2 --
sysdeps/unix/sysv/linux/arm/syscalls.list | 4 ----
sysdeps/unix/sysv/linux/generic/syscalls.list | 3 ---
sysdeps/unix/sysv/linux/hppa/syscalls.list | 3 ---
sysdeps/unix/sysv/linux/ia64/syscalls.list | 3 ---
sysdeps/unix/sysv/linux/microblaze/syscalls.list | 4 ----
sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 4 ----
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 4 ----
sysdeps/unix/sysv/linux/shmget.c | 13 +++++++------
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
11 files changed, 21 insertions(+), 34 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 096bf22..4001020 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,7 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-shmget - shmget i:iii __shmget shmget
-
sigstack - sigstack 2 sigstack
getpriority - getpriority i:ii __getpriority getpriority
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index b1ea664..0263eee 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -21,10 +21,6 @@ fanotify_mark EXTRA fanotify_mark i:iiiiis fanotify_mark
personality EXTRA personality Ei:i __personality personality
-# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
-# wrappers (to set __IPC_64).
-shmget - shmget i:iii __shmget shmget
-
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
bind - bind i:ipi __bind bind
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 51ce148..3bb5473 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,8 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-# SysV APIs
-shmget - shmget i:iii __shmget shmget
-
# Socket APIs
socket - socket i:iii __socket socket
socketpair - socketpair i:iiif __socketpair socketpair
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index e75dd43..6d47b11 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,8 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-# semaphore and shm system calls
-shmget - shmget i:iii __shmget shmget
-
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
bind - bind i:ipi __bind bind
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 5ebade1..dd07db3 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -4,9 +4,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
-# semaphore and shm system calls
-shmget - shmget i:iii __shmget shmget
-
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
bind - bind i:ipi __bind bind
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 7a5666f..932c9cc 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -5,7 +5,3 @@ cacheflush EXTRA cacheflush i:iiii __cacheflush cacheflush
prlimit64 EXTRA prlimit64 i:iipp prlimit64
fanotify_mark EXTRA fanotify_mark i:iiiiis fanotify_mark
personality EXTRA personality Ei:i __personality personality
-
-# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
-# wrappers (to set __IPC_64).
-shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index 461b4ef..536efc6 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -2,7 +2,3 @@
ftruncate - ftruncate i:ii __ftruncate ftruncate ftruncate64 __ftruncate64
truncate - truncate i:si truncate truncate64
-
-# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
-# wrappers (to set __IPC_64).
-shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
deleted file mode 100644
index 0ccbffa..0000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ /dev/null
@@ -1,4 +0,0 @@
-# File name Caller Syscall name # args Strong name Weak names
-
-# semaphore and shm system calls
-shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/shmget.c b/sysdeps/unix/sysv/linux/shmget.c
index bd624fc..c3e6c90 100644
--- a/sysdeps/unix/sysv/linux/shmget.c
+++ b/sysdeps/unix/sysv/linux/shmget.c
@@ -16,13 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <sys/shm.h>
+#include <sys/msg.h>
#include <ipc_priv.h>
-#include <stdlib.h> /* for definition of NULL */
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Return an identifier for an shared memory segment of at least size SIZE
which is associated with KEY. */
@@ -30,5 +27,9 @@
int
shmget (key_t key, size_t size, int shmflg)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_shmget, key, size, shmflg, NULL);
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (shmget, key, size, shmflg, NULL);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_shmget, key, size, shmflg, NULL);
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 65a03ff..51a9177 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -2,7 +2,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
-shmget - shmget i:iii __shmget shmget
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 05/17] Use msgsnd syscall for Linux implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (12 preceding siblings ...)
2016-11-08 20:31 ` [PATCH v3 17/17] Add SYSV shared memory test Adhemerval Zanella
@ 2016-11-08 20:31 ` Adhemerval Zanella
2016-11-08 21:13 ` Andreas Schwab
2016-11-08 20:31 ` [PATCH v3 07/17] Add SYSV message queue test Adhemerval Zanella
` (4 subsequent siblings)
18 siblings, 1 reply; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:31 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Remove msgsnd from syscalls.list.
--
This patch add a direct call to msgsnd syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgsnd): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgsnd):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgsnd):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/msgsnd.c (__libc_msgsnd): Use msgsnd syscall
if defined.
---
ChangeLog | 14 ++++++++++++++
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/syscalls.list | 1 -
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/microblaze/syscalls.list | 1 -
sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/msgsnd.c | 11 ++++++-----
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
11 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index ddbd672..ced9c10 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 297f7e7..43c464d 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -24,7 +24,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 6869a48..f65598a 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
semget - semget i:iii __semget semget
semctl - semctl i:iiii __semctl semctl
semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index e4e40a0..3fbd81a 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -2,7 +2,6 @@
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index a60e615..9edcbe6 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -6,7 +6,6 @@ getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 99dc33b..ed715ba 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -9,7 +9,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index 1f06389..fd84907 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -6,7 +6,6 @@ truncate - truncate i:si truncate truncate64
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
index 1457e43..7349786 100644
--- a/sysdeps/unix/sysv/linux/msgsnd.c
+++ b/sysdeps/unix/sysv/linux/msgsnd.c
@@ -16,17 +16,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <sys/msg.h>
+//#include <sys/msg.h>
#include <ipc_priv.h>
-
#include <sysdep-cancel.h>
-#include <sys/syscall.h>
int
__libc_msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg)
{
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return SYSCALL_CANCEL (msgsnd, msqid, msgp, msgsz, msgflg);
+#else
return SYSCALL_CANCEL (ipc, IPCOP_msgsnd, msqid, msgsz, msgflg,
- (void *) msgp);
+ msgp);
+#endif
}
weak_alias (__libc_msgsnd, msgsnd)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 59b93fe..259bdfc 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -2,7 +2,6 @@
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 945f084..1f04176 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -3,7 +3,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 06/17] Use msgget syscall for Linux implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (9 preceding siblings ...)
2016-11-08 20:31 ` [PATCH v3 14/17] Consolidate Linux shmctl implementation Adhemerval Zanella
@ 2016-11-08 20:31 ` Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 16/17] Use shmget syscall for linux implementation Adhemerval Zanella
` (7 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:31 UTC (permalink / raw)
To: libc-alpha
Changes from previous version
- Remove msgget from syscalls.list.
--
This patch add a direct call to msgget syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgget):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgget):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/msgget.c (msgget): Use msgget syscall if
define.
---
ChangeLog | 14 ++++++++++++++
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/syscalls.list | 1 -
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/microblaze/syscalls.list | 1 -
sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/msgget.c | 11 ++++++-----
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
11 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index ced9c10..54c1752 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-msgget - msgget i:ii __msgget msgget
shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 43c464d..4bf4826 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -23,7 +23,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index f65598a..ad75223 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# SysV APIs
-msgget - msgget i:ii __msgget msgget
semget - semget i:iii __semget semget
semctl - semctl i:iiii __semctl semctl
semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 3fbd81a..da2c9ab 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 9edcbe6..8056781 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index ed715ba..c40bac3 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -8,7 +8,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index fd84907..212392c 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -5,7 +5,6 @@ truncate - truncate i:si truncate truncate64
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/msgget.c b/sysdeps/unix/sysv/linux/msgget.c
index ef98c75..c00ebfd4 100644
--- a/sysdeps/unix/sysv/linux/msgget.c
+++ b/sysdeps/unix/sysv/linux/msgget.c
@@ -16,13 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/msg.h>
#include <ipc_priv.h>
-#include <stdlib.h> /* for definition of NULL */
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Return descriptor for message queue associated with KEY. The MSGFLG
parameter describes how to proceed with clashing of key values. */
@@ -30,5 +27,9 @@
int
msgget (key_t key, int msgflg)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_msgget, key, msgflg, 0, NULL);
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (msgget, key, msgflg);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_msgget, key, msgflg, 0, NULL);
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 259bdfc..f23b379 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 1f04176..53ead93 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -2,7 +2,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 17/17] Add SYSV shared memory test
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (11 preceding siblings ...)
2016-11-08 20:31 ` [PATCH v3 16/17] Use shmget syscall for linux implementation Adhemerval Zanella
@ 2016-11-08 20:31 ` Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 05/17] Use msgsnd syscall for Linux implementation Adhemerval Zanella
` (5 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:31 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Change some error strings (it was using message queue names).
--
This patch adds a simple SYSV shared memory test to check for correct
argument passing on kernel. The idea is neither to be an extensive
testing nor to check for any specific Linux test.
* sysvipc/Makefile (tests): Add test-sysvshm.
* sysvipc/test-sysvshm.c: New file.
---
ChangeLog | 3 ++
sysvipc/Makefile | 2 +-
sysvipc/test-sysvshm.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 134 insertions(+), 1 deletion(-)
create mode 100644 sysvipc/test-sysvshm.c
diff --git a/ChangeLog b/ChangeLog
index 55c462b..0d51c50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2016-11-08 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysvipc/Makefile (tests): Add test-sysvshm.
+ * sysvipc/test-sysvshm.c: New file.
+
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmget): Likewise.
diff --git a/sysvipc/Makefile b/sysvipc/Makefile
index 32d64dc..daede74 100644
--- a/sysvipc/Makefile
+++ b/sysvipc/Makefile
@@ -30,7 +30,7 @@ routines := ftok \
semop semget semctl semtimedop \
shmat shmdt shmget shmctl
-tests := test-sysvmsg test-sysvsem
+tests := test-sysvmsg test-sysvsem test-sysvshm
include ../Rules
diff --git a/sysvipc/test-sysvshm.c b/sysvipc/test-sysvshm.c
new file mode 100644
index 0000000..b4cb7df
--- /dev/null
+++ b/sysvipc/test-sysvshm.c
@@ -0,0 +1,130 @@
+/* Basic tests for SYSV shared memory functions.
+ Copyright (C) 2016 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 <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
+static void do_prepare (void);
+#define PREPARE(argc, argv) do_prepare ()
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+/* This defines the `main' function and some more. */
+#include <test-skeleton.c>
+
+/* These are for the temporary file we generate. */
+static char *name;
+static int shmid;
+
+static void
+remove_shm (void)
+{
+ /* Enforce message queue removal in case o early test failure.
+ Ignore error since the shm maybe already being removed. */
+ shmctl (shmid, IPC_RMID, 0);
+}
+
+static void
+do_prepare (void)
+{
+ int fd = create_temp_file ("tst-sysvshm.", &name);
+ if (fd == -1)
+ FAIL_EXIT1 ("cannot create temporary file (errno=%d)", errno);
+}
+
+#define CHECK_EQ(v, k) \
+ if ((v) != (k)) \
+ FAIL_EXIT1("%d != %d", v, k)
+
+/* It is not an extensive test, but rather a functional one aimed to check
+ correct parameter passing on kernel. */
+
+#define SHM_MODE 0666
+
+static int
+do_test (void)
+{
+ atexit (remove_shm);
+
+ key_t key = ftok (name, 'G');
+ if (key == -1)
+ FAIL_EXIT1 ("ftok failed");
+
+ long int pgsz = sysconf (_SC_PAGESIZE);
+ if (pgsz == -1)
+ FAIL_EXIT1 ("sysconf (_SC_PAGESIZE) failed (errno = %d)", errno);
+
+ shmid = shmget(key, pgsz, IPC_CREAT | IPC_EXCL | SHM_MODE);
+ if (shmid == -1)
+ {
+ if (errno == ENOSYS)
+ FAIL_UNSUPPORTED ("shmget not supported");
+ FAIL_EXIT1 ("shmget failed (errno=%d)", errno);
+ }
+
+ /* Get shared memory kernel information and do some sanitiy checks. */
+ struct shmid_ds shminfo;
+ if (shmctl (shmid, IPC_STAT, &shminfo) == -1)
+ FAIL_EXIT1 ("shmctl with IPC_STAT failed (errno=%d)", errno);
+
+ if (shminfo.shm_perm.__key != key)
+ FAIL_EXIT1 ("shmid_ds::shm_perm::key (%d) != %d",
+ (int) shminfo.shm_perm.__key, (int) key);
+ if (shminfo.shm_perm.mode != SHM_MODE)
+ FAIL_EXIT1 ("shmid_ds::shm_perm::mode (%o) != %o",
+ shminfo.shm_perm.mode, SHM_MODE);
+ if (shminfo.shm_segsz != pgsz)
+ FAIL_EXIT1 ("shmid_ds::shm_segsz (%lu) != %lu",
+ (long unsigned) shminfo.shm_segsz, pgsz);
+
+ /* Attach on shared memory and realize some operations. */
+ int *shmem = shmat (shmid, NULL, 0);
+ if (shmem == (void*) -1)
+ FAIL_EXIT1 ("shmem failed (errno=%d)", errno);
+
+ shmem[0] = 0x55555555;
+ shmem[32] = 0x44444444;
+ shmem[64] = 0x33333333;
+ shmem[128] = 0x22222222;
+
+ if (shmdt (shmem) == -1)
+ FAIL_EXIT1 ("shmem failed (errno=%d)", errno);
+
+ shmem = shmat (shmid, NULL, SHM_RDONLY);
+ if (shmem == (void*) -1)
+ FAIL_EXIT1 ("shmem failed (errno=%d)", errno);
+
+ CHECK_EQ (shmem[0], 0x55555555);
+ CHECK_EQ (shmem[32], 0x44444444);
+ CHECK_EQ (shmem[64], 0x33333333);
+ CHECK_EQ (shmem[128], 0x22222222);
+
+ if (shmdt (shmem) == -1)
+ FAIL_EXIT1 ("shmem failed (errno=%d)", errno);
+
+ /* Finally free up the semnaphore resource. */
+ if (shmctl (shmid, IPC_RMID, 0) == -1)
+ FAIL_EXIT1 ("semctl failed (errno=%d)", errno);
+
+ return 0;
+}
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 14/17] Consolidate Linux shmctl implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (8 preceding siblings ...)
2016-11-08 20:30 ` [PATCH v3 02/17] Refactor Linux ipc_priv header Adhemerval Zanella
@ 2016-11-08 20:31 ` Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 06/17] Use msgget syscall for Linux implementation Adhemerval Zanella
` (8 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:31 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Remove shmctl from syscalls.list.
--
This patch consolidates the shmctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/shmctl.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldshmctl.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmctl): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmctl):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/alpha/shmctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/shmctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/shmctl.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/shmctl.c: Use default
implementation.
* sysdeps/unix/sysv/linux/shmctl.c (__new_shmctl): Use shmctl syscall
if it is defined.
---
ChangeLog | 21 ++++++++
sysdeps/unix/sysv/linux/alpha/Makefile | 3 --
sysdeps/unix/sysv/linux/alpha/shmctl.c | 1 -
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/shmctl.c | 34 -------------
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/microblaze/shmctl.c | 1 -
sysdeps/unix/sysv/linux/mips/mips64/shmctl.c | 17 ++-----
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/shmctl.c | 59 ++++++++++------------
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
13 files changed, 53 insertions(+), 89 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/alpha/shmctl.c
delete mode 100644 sysdeps/unix/sysv/linux/arm/shmctl.c
delete mode 100644 sysdeps/unix/sysv/linux/microblaze/shmctl.c
diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile
index 386b3fd..4bbe9bf 100644
--- a/sysdeps/unix/sysv/linux/alpha/Makefile
+++ b/sysdeps/unix/sysv/linux/alpha/Makefile
@@ -17,9 +17,6 @@ sysdep_routines += osf_select osf_gettimeofday osf_settimeofday \
osf_getitimer osf_setitimer osf_utimes \
osf_getrusage osf_wait4
-# Support old ipc control
-sysdep_routines += oldshmctl
-
CFLAGS-ioperm.c = -Wa,-mev6
endif
diff --git a/sysdeps/unix/sysv/linux/alpha/shmctl.c b/sysdeps/unix/sysv/linux/alpha/shmctl.c
deleted file mode 100644
index f73ed6f..0000000
--- a/sysdeps/unix/sysv/linux/alpha/shmctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 9948d2d..bf9c8ad 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/arm/shmctl.c b/sysdeps/unix/sysv/linux/arm/shmctl.c
deleted file mode 100644
index 23c4b8d..0000000
--- a/sysdeps/unix/sysv/linux/arm/shmctl.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
- 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 <errno.h>
-#include <sys/shm.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bits/wordsize.h>
-
-
-int
-__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
-{
- return INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, buf);
-}
-
-#include <shlib-compat.h>
-versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 0df73a9..80244c4 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
shmget - shmget i:iii __shmget shmget
-shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
# Socket APIs
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index f757f02..d755bfd 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index b0a3a44..90bd870 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
-shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/microblaze/shmctl.c b/sysdeps/unix/sysv/linux/microblaze/shmctl.c
deleted file mode 100644
index f73ed6f..0000000
--- a/sysdeps/unix/sysv/linux/microblaze/shmctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c b/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c
index ea0fa94..f835cf8 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c
@@ -15,18 +15,11 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <sys/shm.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
+#include <shlib-compat.h>
-int __shmctl (int shmid, int cmd, struct shmid_ds *buf);
+#undef SHLIB_COMPAT
+#define SHLIB_COMPAT(a, b, c) 0
-int
-__shmctl (int shmid, int cmd, struct shmid_ds *buf)
-{
- return INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, buf);
-}
+#define DEFAULT_VERSION GLIBC_2_0
-#include <shlib-compat.h>
-versioned_symbol (libc, __shmctl, shmctl, GLIBC_2_0);
+#include <./sysdeps/unix/sysv/linux/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 40ed7c5..4d478ce 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
index b2caf75..f2b6830 100644
--- a/sysdeps/unix/sysv/linux/shmctl.c
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -16,18 +16,34 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/shm.h>
+#include <stdarg.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <string.h>
-#include <sys/syscall.h>
-#include <bits/wordsize.h>
#include <shlib-compat.h>
+#include <errno.h>
+
+
+#ifndef DEFAULT_VERSION
+# define DEFAULT_VERSION GLIBC_2_2
+#endif
-#include <kernel-features.h>
+/* Provide operations to control over shared memory segments. */
+int
+__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
+{
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (shmctl, shmid, cmd | __IPC_64, buf);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_shmctl, shmid, cmd | __IPC_64, 0,
+ buf);
+#endif
+}
+versioned_symbol (libc, __new_shmctl, shmctl, DEFAULT_VERSION);
+
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
struct __old_shmid_ds
{
struct __old_ipc_perm shm_perm; /* operation permission struct */
@@ -43,36 +59,15 @@ struct __old_shmid_ds
struct vm_area_struct *__attaches; /* descriptors for attaches */
};
-struct __old_shminfo
-{
- int shmmax;
- int shmmin;
- int shmmni;
- int shmseg;
- int shmall;
-};
-
-/* Provide operations to control over shared memory segments. */
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
-int __old_shmctl (int, int, struct __old_shmid_ds *);
-#endif
-int __new_shmctl (int, int, struct shmid_ds *);
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
int
attribute_compat_text_section
__old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf);
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (shmctl, shmid, cmd, buf);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_shmctl, shmid, cmd, 0, buf);
+#endif
}
compat_symbol (libc, __old_shmctl, shmctl, GLIBC_2_0);
#endif
-
-int
-__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
-{
- return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd | __IPC_64, 0,
- buf);
-}
-
-versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 1c2c663..a5db9dc 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -2,7 +2,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
-shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 07/17] Add SYSV message queue test
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (13 preceding siblings ...)
2016-11-08 20:31 ` [PATCH v3 05/17] Use msgsnd syscall for Linux implementation Adhemerval Zanella
@ 2016-11-08 20:31 ` Adhemerval Zanella
2016-11-08 21:23 ` Andreas Schwab
2016-11-08 20:31 ` [PATCH v3 09/17] Use semget syscall for Linux implementation Adhemerval Zanella
` (3 subsequent siblings)
18 siblings, 1 reply; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:31 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Fix msgbuf definition for ILP32
--
This patch adds a simple SYSV message queue test to check for correct
argument passing on kernel. The idea is neither to be an extensive
testing nor to check for any specific Linux test.
* sysvipc/Makefile (tests): Add test-sysvmsg.
* sysvipc/test-sysvmsg.c: New file.
* test-skeleton.c (FAIL_UNSUPPORTED): New define.
---
ChangeLog | 4 ++
sysvipc/Makefile | 2 +
sysvipc/test-sysvmsg.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++
test-skeleton.c | 2 +
4 files changed, 136 insertions(+)
create mode 100644 sysvipc/test-sysvmsg.c
diff --git a/sysvipc/Makefile b/sysvipc/Makefile
index 5f3479e..73bb9cf 100644
--- a/sysvipc/Makefile
+++ b/sysvipc/Makefile
@@ -30,6 +30,8 @@ routines := ftok \
semop semget semctl semtimedop \
shmat shmdt shmget shmctl
+tests := test-sysvmsg
+
include ../Rules
CFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/sysvipc/test-sysvmsg.c b/sysvipc/test-sysvmsg.c
new file mode 100644
index 0000000..65a1a3a
--- /dev/null
+++ b/sysvipc/test-sysvmsg.c
@@ -0,0 +1,128 @@
+/* Basic tests for SYSV message queue functions.
+ Copyright (C) 2016 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 <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+
+static void do_prepare (void);
+#define PREPARE(argc, argv) do_prepare ()
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+/* This defines the `main' function and some more. */
+#include <test-skeleton.c>
+
+#define TEXTSIZE 32
+struct msgbuf_t
+{
+#ifdef _GNU_SOURCE
+ __syscall_slong_t type;
+#else
+ long type;
+#endif
+ char buf[TEXTSIZE];
+};
+
+#define MSGTYPE 0x01020304
+#define MSGDATA "0123456789"
+
+/* These are for the temporary file we generate. */
+static char *name;
+static int msqid;
+
+static void
+remove_msq (void)
+{
+ /* Enforce message queue removal in case o early test failure.
+ Ignore error since the msgq maybe already being removed. */
+ msgctl (msqid, IPC_RMID, NULL);
+}
+
+static void
+do_prepare (void)
+{
+ int fd = create_temp_file ("tst-sysvmsg.", &name);
+ if (fd == -1)
+ FAIL_EXIT1 ("cannot create temporary file (errno=%d)", errno);
+}
+
+/* It is not an extensive test, but rather a functional one aimed to check
+ correct parameter passing on kernel. */
+
+#define MSGQ_MODE 0644
+
+static int
+do_test (void)
+{
+ atexit (remove_msq);
+
+ key_t key = ftok (name, 'G');
+ if (key == -1)
+ FAIL_EXIT1 ("ftok failed");
+
+ msqid = msgget (key, MSGQ_MODE | IPC_CREAT);
+ if (msqid == -1)
+ {
+ if (errno == ENOSYS)
+ FAIL_UNSUPPORTED ("msgget not supported");
+ FAIL_EXIT1 ("msgget failed (errno=%d)", errno);
+ }
+
+ /* Get message queue kernel information and do some sanitiy checks. */
+ struct msqid_ds msginfo;
+ if (msgctl (msqid, IPC_STAT, &msginfo) == -1)
+ FAIL_EXIT1 ("msgctl with IPC_STAT failed (errno=%d)", errno);
+
+ if (msginfo.msg_perm.__key != key)
+ FAIL_EXIT1 ("msgid_ds::msg_perm::key (%d) != %d",
+ (int) msginfo.msg_perm.__key, (int) key);
+ if (msginfo.msg_perm.mode != MSGQ_MODE)
+ FAIL_EXIT1 ("msgid_ds::msg_perm::mode (%o) != %o",
+ msginfo.msg_perm.mode, MSGQ_MODE);
+ if (msginfo.msg_qnum != 0)
+ FAIL_EXIT1 ("msgid_ds::msg_qnum (%lu) != 0",
+ (long unsigned) msginfo.msg_qnum);
+
+ /* Check if lastest argument (IPC_NOWAIT) is correct handled. */
+ struct msgbuf_t msg2rcv = { 0 };
+ if (msgrcv (msqid, &msg2rcv, sizeof (msg2rcv.buf), MSGTYPE,
+ IPC_NOWAIT) == -1
+ && errno != ENOMSG)
+ FAIL_EXIT1 ("msgrcv failed (errno=%d)", errno);
+
+ struct msgbuf_t msg2snd = { MSGTYPE, MSGDATA };
+ if (msgsnd (msqid, &msg2snd, sizeof (msg2snd.buf), 0) == -1)
+ FAIL_EXIT1 ("msgsnd failed (errno=%d)", errno);
+
+ if (msgrcv (msqid, &msg2rcv, sizeof (msg2rcv.buf), MSGTYPE, 0) == -1)
+ FAIL_EXIT1 ("msgrcv failed (errno=%d)", errno);
+
+ int ret = 0;
+ if (strncmp (msg2snd.buf, msg2rcv.buf, TEXTSIZE) != 0)
+ ret = 1;
+
+ if (msgctl (msqid, IPC_RMID, NULL) == -1)
+ FAIL_EXIT1 ("msgctl failed");
+
+ return ret;
+}
diff --git a/test-skeleton.c b/test-skeleton.c
index fa457be..c582db7 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -102,6 +102,8 @@ static const char *test_dir;
exit (value); \
})
+#define FAIL_UNSUPPORTED(...) FAIL_EXIT(77, __VA_ARGS__)
+
#define FAIL_EXIT1(...) FAIL_EXIT(1, __VA_ARGS__)
static void
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 08/17] Consolidate Linux semctl implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (15 preceding siblings ...)
2016-11-08 20:31 ` [PATCH v3 09/17] Use semget syscall for Linux implementation Adhemerval Zanella
@ 2016-11-08 20:31 ` Adhemerval Zanella
2016-11-09 13:57 ` [PATCH v3 00/17] Consolidate Linux sysvipc implementation Yury Norov
2016-11-25 14:02 ` Adhemerval Zanella
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:31 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Fix alpha issues and remove old unnecessary implementations.
- Change mips64 way to use default implementation (by undef SHLIB_COMPAT).
- Remove semctl from syscalls.list.
--
This patch consolidates the semctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/semctl.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldsemctl.
* sysdeps/unix/sysv/linux/alpha/semctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/semctl.c: Use defaulf
implementation.
* sysdeps/unix/sysv/linux/semctl.c (__new_semctl): Use semctl
syscall if it is defined.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semctl): Remove.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semctl): Likewise.
---
ChangeLog | 18 +++++++
sysdeps/unix/sysv/linux/alpha/Makefile | 2 +-
sysdeps/unix/sysv/linux/alpha/semctl.c | 1 -
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/semctl.c | 54 --------------------
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/microblaze/semctl.c | 1 -
sysdeps/unix/sysv/linux/mips/mips64/semctl.c | 38 ++------------
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/semctl.c | 58 +++++++++++-----------
sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c | 54 --------------------
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
14 files changed, 54 insertions(+), 178 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/alpha/semctl.c
delete mode 100644 sysdeps/unix/sysv/linux/arm/semctl.c
delete mode 100644 sysdeps/unix/sysv/linux/microblaze/semctl.c
delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile
index c24dc2e..386b3fd 100644
--- a/sysdeps/unix/sysv/linux/alpha/Makefile
+++ b/sysdeps/unix/sysv/linux/alpha/Makefile
@@ -18,7 +18,7 @@ sysdep_routines += osf_select osf_gettimeofday osf_settimeofday \
osf_getrusage osf_wait4
# Support old ipc control
-sysdep_routines += oldsemctl oldshmctl
+sysdep_routines += oldshmctl
CFLAGS-ioperm.c = -Wa,-mev6
endif
diff --git a/sysdeps/unix/sysv/linux/alpha/semctl.c b/sysdeps/unix/sysv/linux/alpha/semctl.c
deleted file mode 100644
index 4cb834a..0000000
--- a/sysdeps/unix/sysv/linux/alpha/semctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 54c1752..c12620a 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -7,7 +7,6 @@ shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
semget - semget i:iii __semget semget
-oldsemctl EXTRA semctl i:iiii __old_semctl semctl@GLIBC_2.0
sigstack - sigstack 2 sigstack
diff --git a/sysdeps/unix/sysv/linux/arm/semctl.c b/sysdeps/unix/sysv/linux/arm/semctl.c
deleted file mode 100644
index 79d9d3e..0000000
--- a/sysdeps/unix/sysv/linux/arm/semctl.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
- 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 <errno.h>
-#include <stdarg.h>
-#include <sys/sem.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-
-/* Define a `union semun' suitable for Linux here. */
-union semun
-{
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
- unsigned short int *array; /* array for GETALL & SETALL */
- struct seminfo *__buf; /* buffer for IPC_INFO */
-};
-
-int
-__new_semctl (int semid, int semnum, int cmd, ...)
-{
- union semun arg;
- va_list ap;
-
- va_start (ap, cmd);
-
- /* Get the argument. */
- arg = va_arg (ap, union semun);
-
- va_end (ap);
-
- return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd | __IPC_64,
- arg.array);
-}
-
-#include <shlib-compat.h>
-versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index ad75223..f95f1f7 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
semget - semget i:iii __semget semget
-semctl - semctl i:iiii __semctl semctl
semtimedop - semtimedop i:ipip semtimedop
semop - semop i:ipi __semop semop
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index da2c9ab..5040ef3 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -8,7 +8,6 @@ shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
semget - semget i:iii __semget semget
-semctl - semctl i:iiii __semctl semctl
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 8056781..ca5cba4 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -12,7 +12,6 @@ shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
semget - semget i:iii __semget semget
-semctl - semctl i:iiii __semctl semctl
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/microblaze/semctl.c b/sysdeps/unix/sysv/linux/microblaze/semctl.c
deleted file mode 100644
index 4cb834a..0000000
--- a/sysdeps/unix/sysv/linux/microblaze/semctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/semctl.c b/sysdeps/unix/sysv/linux/mips/mips64/semctl.c
index 1115a25..5a0c2a3 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/semctl.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/semctl.c
@@ -15,39 +15,11 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/sem.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
-
-/* Define a `union semun' suitable for Linux here. */
-union semun
-{
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
- unsigned short int *array; /* array for GETALL & SETALL */
- struct seminfo *__buf; /* buffer for IPC_INFO */
-};
-
-int __semctl (int semid, int semnum, int cmd, ...);
-
-int
-__semctl (int semid, int semnum, int cmd, ...)
-{
- union semun arg;
- va_list ap;
-
- va_start (ap, cmd);
-
- /* Get the argument. */
- arg = va_arg (ap, union semun);
+#include <shlib-compat.h>
- va_end (ap);
+#undef SHLIB_COMPAT
+#define SHLIB_COMPAT(a, b, c) 0
- return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd | __IPC_64,
- arg.array);
-}
+#define DEFAULT_VERSION GLIBC_2_0
-#include <shlib-compat.h>
-versioned_symbol (libc, __semctl, semctl, GLIBC_2_0);
+#include <sysdeps/unix/sysv/linux/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index f23b379..09ab580 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -7,4 +7,3 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semget - semget i:iii __semget semget
-semctl - semctl i:iiii __semctl semctl
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index ee84a1e..a2b9f0d 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -16,18 +16,14 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <stdarg.h>
#include <sys/sem.h>
+#include <stdarg.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <string.h>
-#include <sys/syscall.h>
#include <shlib-compat.h>
+#include <errno.h>
-#include <kernel-features.h>
-
+/* Old semid_ds definition. */
struct __old_semid_ds
{
struct __old_ipc_perm sem_perm; /* operation permission struct */
@@ -50,23 +46,17 @@ union semun
struct __old_semid_ds *__old_buf;
};
-/* Return identifier for array of NSEMS semaphores associated with
- KEY. */
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
-int __old_semctl (int semid, int semnum, int cmd, ...);
+#ifndef DEFAULT_VERSION
+# define DEFAULT_VERSION GLIBC_2_2
#endif
-int __new_semctl (int semid, int semnum, int cmd, ...);
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
int
-attribute_compat_text_section
-__old_semctl (int semid, int semnum, int cmd, ...)
+__new_semctl (int semid, int semnum, int cmd, ...)
{
- union semun arg;
+ union semun arg = { 0 };
va_list ap;
/* Get the argument only if required. */
- arg.buf = NULL;
switch (cmd)
{
case SETVAL: /* arg.val */
@@ -83,20 +73,28 @@ __old_semctl (int semid, int semnum, int cmd, ...)
break;
}
- return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
- &arg);
-}
-compat_symbol (libc, __old_semctl, semctl, GLIBC_2_0);
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd | __IPC_64,
+ arg.array);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
+ SEMCTL_ARG_ADDRESS (arg));
#endif
+}
+versioned_symbol (libc, __new_semctl, semctl, DEFAULT_VERSION);
+
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
+int __old_semctl (int semid, int semnum, int cmd, ...);
int
-__new_semctl (int semid, int semnum, int cmd, ...)
+attribute_compat_text_section
+__old_semctl (int semid, int semnum, int cmd, ...)
{
- union semun arg;
+ union semun arg = { 0 };
va_list ap;
/* Get the argument only if required. */
- arg.buf = NULL;
switch (cmd)
{
case SETVAL: /* arg.val */
@@ -113,8 +111,12 @@ __new_semctl (int semid, int semnum, int cmd, ...)
break;
}
- return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
- &arg);
+# ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd, arg.array);
+# else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semctl, semid, semnum, cmd,
+ SEMCTL_ARG_ADDRESS (arg));
+# endif
}
-
-versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2);
+compat_symbol (libc, __old_semctl, semctl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c b/sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
deleted file mode 100644
index a9ae4c6..0000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
- 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 <errno.h>
-#include <stdarg.h>
-#include <sys/sem.h>
-#include <ipc_priv.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-/* Define a `union semun' suitable for Linux here. */
-union semun
-{
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
- unsigned short int *array; /* array for GETALL & SETALL */
- struct seminfo *__buf; /* buffer for IPC_INFO */
-};
-
-/* Return identifier for array of NSEMS semaphores associated with
- KEY. */
-
-int
-semctl (int semid, int semnum, int cmd, ...)
-{
- union semun arg;
- va_list ap;
-
- va_start (ap, cmd);
-
- /* Get the argument. */
- arg = va_arg (ap, union semun);
-
- va_end (ap);
-
- return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
- arg.array);
-}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 53ead93..96ddfcb 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -9,7 +9,6 @@ shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
semget - semget i:iii __semget semget
-semctl - semctl i:iiii __semctl semctl
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 09/17] Use semget syscall for Linux implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (14 preceding siblings ...)
2016-11-08 20:31 ` [PATCH v3 07/17] Add SYSV message queue test Adhemerval Zanella
@ 2016-11-08 20:31 ` Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 08/17] Consolidate Linux semctl implementation Adhemerval Zanella
` (2 subsequent siblings)
18 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-08 20:31 UTC (permalink / raw)
To: libc-alpha
Changes from previous version:
- Remove semget from syscalls.list.
--
This patch add a direct call to semget syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semget):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semget):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/semget.c (semget): Use semget syscall
if it is defined.
---
ChangeLog | 14 ++++++++++++++
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/syscalls.list | 1 -
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/microblaze/syscalls.list | 1 -
sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/semget.c | 11 ++++++-----
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
11 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index c12620a..2533263 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -6,7 +6,6 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
sigstack - sigstack 2 sigstack
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 4bf4826..ef5bd01 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -28,7 +28,6 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index f95f1f7..485f6fe 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# SysV APIs
-semget - semget i:iii __semget semget
semtimedop - semtimedop i:ipip semtimedop
semop - semop i:ipi __semop semop
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 5040ef3..685ab93 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -7,7 +7,6 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index ca5cba4..56200ba 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -11,7 +11,6 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index c40bac3..a0b8ebf 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -13,4 +13,3 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index 212392c..facae19 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -10,4 +10,3 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 09ab580..288e080 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -6,4 +6,3 @@ shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
-semget - semget i:iii __semget semget
diff --git a/sysdeps/unix/sysv/linux/semget.c b/sysdeps/unix/sysv/linux/semget.c
index 52189fd..efdd967 100644
--- a/sysdeps/unix/sysv/linux/semget.c
+++ b/sysdeps/unix/sysv/linux/semget.c
@@ -16,13 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/sem.h>
#include <ipc_priv.h>
-#include <stdlib.h> /* for definition of NULL */
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Return identifier for array of NSEMS semaphores associated with
KEY. */
@@ -30,5 +27,9 @@
int
semget (key_t key, int nsems, int semflg)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_semget, key, nsems, semflg, NULL);
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (semget, key, nsems, semflg);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semget, key, nsems, semflg, NULL);
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 96ddfcb..a6d2636 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -8,7 +8,6 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 05/17] Use msgsnd syscall for Linux implementation
2016-11-08 20:31 ` [PATCH v3 05/17] Use msgsnd syscall for Linux implementation Adhemerval Zanella
@ 2016-11-08 21:13 ` Andreas Schwab
2016-11-09 13:23 ` Adhemerval Zanella
0 siblings, 1 reply; 31+ messages in thread
From: Andreas Schwab @ 2016-11-08 21:13 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
On Nov 08 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
> index 1457e43..7349786 100644
> --- a/sysdeps/unix/sysv/linux/msgsnd.c
> +++ b/sysdeps/unix/sysv/linux/msgsnd.c
> @@ -16,17 +16,18 @@
> License along with the GNU C Library; if not, see
> <http://www.gnu.org/licenses/>. */
>
> -#include <errno.h>
> -#include <sys/msg.h>
> +//#include <sys/msg.h>
That looks unintented.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 01/17] Add __ASSUME_SYSVIPC_SYSCALL for Linux
2016-11-08 20:30 ` [PATCH v3 01/17] Add __ASSUME_SYSVIPC_SYSCALL for Linux Adhemerval Zanella
@ 2016-11-08 21:19 ` Andreas Schwab
2016-11-09 13:23 ` Adhemerval Zanella
0 siblings, 1 reply; 31+ messages in thread
From: Andreas Schwab @ 2016-11-08 21:19 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
On Nov 08 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> This patch adds a new define, __ASSUME_SYSVIPC_SYSCALL, that wired
> syscalls are supported on the system and the general idea is to use
> it where possible.
For me, the name implies to use the ipc multiplexer, not the other way
round. Perhaps rename it to __ASSMUME_DIRECT_SYSVIPC_SYSCALLS.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 07/17] Add SYSV message queue test
2016-11-08 20:31 ` [PATCH v3 07/17] Add SYSV message queue test Adhemerval Zanella
@ 2016-11-08 21:23 ` Andreas Schwab
2016-11-09 13:28 ` Adhemerval Zanella
0 siblings, 1 reply; 31+ messages in thread
From: Andreas Schwab @ 2016-11-08 21:23 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
On Nov 08 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> +static void
> +remove_msq (void)
> +{
> + /* Enforce message queue removal in case o early test failure.
of
> + Ignore error since the msgq maybe already being removed. */
may already have been
> + /* Get message queue kernel information and do some sanitiy checks. */
sanity
> + /* Check if lastest argument (IPC_NOWAIT) is correct handled. */
last argument, correctly
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 01/17] Add __ASSUME_SYSVIPC_SYSCALL for Linux
2016-11-08 21:19 ` Andreas Schwab
@ 2016-11-09 13:23 ` Adhemerval Zanella
0 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-09 13:23 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-alpha
On 08/11/2016 19:18, Andreas Schwab wrote:
> On Nov 08 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
>
>> This patch adds a new define, __ASSUME_SYSVIPC_SYSCALL, that wired
>> syscalls are supported on the system and the general idea is to use
>> it where possible.
>
> For me, the name implies to use the ipc multiplexer, not the other way
> round. Perhaps rename it to __ASSMUME_DIRECT_SYSVIPC_SYSCALLS.
>
> Andreas.
>
Right, I changed it locally here to __ASSUME_DIRECT_SYSVIPC_SYSCALL.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 05/17] Use msgsnd syscall for Linux implementation
2016-11-08 21:13 ` Andreas Schwab
@ 2016-11-09 13:23 ` Adhemerval Zanella
0 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-09 13:23 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-alpha
On 08/11/2016 19:13, Andreas Schwab wrote:
> On Nov 08 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
>
>> diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
>> index 1457e43..7349786 100644
>> --- a/sysdeps/unix/sysv/linux/msgsnd.c
>> +++ b/sysdeps/unix/sysv/linux/msgsnd.c
>> @@ -16,17 +16,18 @@
>> License along with the GNU C Library; if not, see
>> <http://www.gnu.org/licenses/>. */
>>
>> -#include <errno.h>
>> -#include <sys/msg.h>
>> +//#include <sys/msg.h>
>
> That looks unintented.
>
> Andreas.
It is, I remove the comment on my local branch.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 07/17] Add SYSV message queue test
2016-11-08 21:23 ` Andreas Schwab
@ 2016-11-09 13:28 ` Adhemerval Zanella
0 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-09 13:28 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-alpha
On 08/11/2016 19:23, Andreas Schwab wrote:
> On Nov 08 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
>
>> +static void
>> +remove_msq (void)
>> +{
>> + /* Enforce message queue removal in case o early test failure.
>
> of
>
>> + Ignore error since the msgq maybe already being removed. */
>
> may already have been
>
>> + /* Get message queue kernel information and do some sanitiy checks. */
>
> sanity
>
>> + /* Check if lastest argument (IPC_NOWAIT) is correct handled. */
>
> last argument, correctly
>
> Andreas.
>
Ack, I corrected all the misspelling and grammatical mistakes in my local
branch. Some of them also occur in other tests (test-sysvshm.c and
test-sysvsem.c) and I also correct them.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 00/17] Consolidate Linux sysvipc implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (16 preceding siblings ...)
2016-11-08 20:31 ` [PATCH v3 08/17] Consolidate Linux semctl implementation Adhemerval Zanella
@ 2016-11-09 13:57 ` Yury Norov
2016-11-25 14:02 ` Adhemerval Zanella
18 siblings, 0 replies; 31+ messages in thread
From: Yury Norov @ 2016-11-09 13:57 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
On Tue, Nov 08, 2016 at 06:29:50PM -0200, Adhemerval Zanella wrote:
> Changes from previous version:
>
> - Refactor ipc_priv.h header to have working definition for all
> architectures. The header basically contains Linux specific
> ABI definitions for the architecture to correctly use default
> implementation, including old ipc_perm definition, calling
> convention, and __IPC_64 value.
>
> - Set all architectures to use the default implementation. It
> leaded to some code changes to accomodate all the architectures
> calling convention (with ipc_priv.h change) and some fixes
> on new default implementation.
>
> - Change mips64 implementation way to use the default one.
>
> - Some tests changes (name typos).
>
> --
>
> This patchset is a continuation of my Linux syscall consolidation
> implementation and aimed for SySV IPC (message queue, semaphore,
> and shared memory).
>
> Current Linux default implementation only defines the old ipc
> syscall method. Architectures need to either to imply the generic
> syscalls.list or reimplement the syscall definition. To simplify
> and allow to remove some old arch-specific implementation, I added
> the direct syscall method for all supported IPC mechanisms.
>
> Other changes are simple code reorganization to simplify and all
> compatibility required for various ports.
>
> The patchset also adds 3 simple tests that aims to check for correct
> argument passing on syscall. The idea is not to be an extensive
> testing of all supported IPC.
>
> Checked on x86_64, i686, armhf, aarch64, and powerpc64le.
Hi,
I tested it with ilp32 series for aarch64, with LTP. At first glance,
everything is OK.
Yury.
Testes-by: Yury Norov <ynorov@caviumnetworks.com> [on aarch64/ilp32]
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 00/17] Consolidate Linux sysvipc implementation
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
` (17 preceding siblings ...)
2016-11-09 13:57 ` [PATCH v3 00/17] Consolidate Linux sysvipc implementation Yury Norov
@ 2016-11-25 14:02 ` Adhemerval Zanella
2016-12-07 19:14 ` Adhemerval Zanella
18 siblings, 1 reply; 31+ messages in thread
From: Adhemerval Zanella @ 2016-11-25 14:02 UTC (permalink / raw)
To: libc-alpha
Ping (with Andreas comments fixed).
On 08/11/2016 18:29, Adhemerval Zanella wrote:
> Changes from previous version:
>
> - Refactor ipc_priv.h header to have working definition for all
> architectures. The header basically contains Linux specific
> ABI definitions for the architecture to correctly use default
> implementation, including old ipc_perm definition, calling
> convention, and __IPC_64 value.
>
> - Set all architectures to use the default implementation. It
> leaded to some code changes to accomodate all the architectures
> calling convention (with ipc_priv.h change) and some fixes
> on new default implementation.
>
> - Change mips64 implementation way to use the default one.
>
> - Some tests changes (name typos).
>
> --
>
> This patchset is a continuation of my Linux syscall consolidation
> implementation and aimed for SySV IPC (message queue, semaphore,
> and shared memory).
>
> Current Linux default implementation only defines the old ipc
> syscall method. Architectures need to either to imply the generic
> syscalls.list or reimplement the syscall definition. To simplify
> and allow to remove some old arch-specific implementation, I added
> the direct syscall method for all supported IPC mechanisms.
>
> Other changes are simple code reorganization to simplify and all
> compatibility required for various ports.
>
> The patchset also adds 3 simple tests that aims to check for correct
> argument passing on syscall. The idea is not to be an extensive
> testing of all supported IPC.
>
> Checked on x86_64, i686, armhf, aarch64, and powerpc64le.
>
> Adhemerval Zanella (17):
> Add __ASSUME_SYSVIPC_SYSCALL for Linux
> Refactor Linux ipc_priv header
> Consolidate Linux msgctl implementation
> Consolidate Linux msgrcv implementation
> Use msgsnd syscall for Linux implementation
> Use msgget syscall for Linux implementation
> Add SYSV message queue test
> Consolidate Linux semctl implementation
> Use semget syscall for Linux implementation
> Use semop syscall for Linux implementation
> Consolidate Linux semtimedop implementation
> Add SYSV semaphore test
> Use shmat syscall for Linux implementation
> Consolidate Linux shmctl implementation
> Use shmdt syscall for linux implementation
> Use shmget syscall for linux implementation
> Add SYSV shared memory test
>
> ChangeLog | 229 +++++++++++++++++++++
> sysdeps/unix/sysv/linux/aarch64/ipc_priv.h | 32 +++
> sysdeps/unix/sysv/linux/alpha/Makefile | 3 -
> sysdeps/unix/sysv/linux/alpha/ipc_priv.h | 33 ++-
> sysdeps/unix/sysv/linux/alpha/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/alpha/msgctl.c | 1 -
> sysdeps/unix/sysv/linux/alpha/semctl.c | 1 -
> sysdeps/unix/sysv/linux/alpha/shmctl.c | 1 -
> sysdeps/unix/sysv/linux/alpha/syscalls.list | 13 --
> sysdeps/unix/sysv/linux/arm/msgctl.c | 33 ---
> sysdeps/unix/sysv/linux/arm/semctl.c | 54 -----
> sysdeps/unix/sysv/linux/arm/shmctl.c | 34 ---
> sysdeps/unix/sysv/linux/arm/syscalls.list | 12 --
> sysdeps/unix/sysv/linux/generic/syscalls.list | 14 --
> sysdeps/unix/sysv/linux/hppa/syscalls.list | 14 --
> sysdeps/unix/sysv/linux/i386/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/ia64/syscalls.list | 14 --
> sysdeps/unix/sysv/linux/ipc_ops.h | 30 +++
> sysdeps/unix/sysv/linux/ipc_priv.h | 23 +--
> sysdeps/unix/sysv/linux/kernel-features.h | 4 +
> sysdeps/unix/sysv/linux/m68k/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/m68k/semtimedop.S | 69 -------
> sysdeps/unix/sysv/linux/microblaze/msgctl.c | 1 -
> sysdeps/unix/sysv/linux/microblaze/semctl.c | 1 -
> sysdeps/unix/sysv/linux/microblaze/shmctl.c | 1 -
> sysdeps/unix/sysv/linux/microblaze/syscalls.list | 12 --
> sysdeps/unix/sysv/linux/mips/ipc_priv.h | 1 -
> sysdeps/unix/sysv/linux/mips/kernel-features.h | 2 +
> sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h | 32 +++
> sysdeps/unix/sysv/linux/mips/mips64/msgctl.c | 17 +-
> sysdeps/unix/sysv/linux/mips/mips64/semctl.c | 38 +---
> sysdeps/unix/sysv/linux/mips/mips64/shmctl.c | 17 +-
> sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 12 --
> sysdeps/unix/sysv/linux/msgctl.c | 45 ++--
> sysdeps/unix/sysv/linux/msgget.c | 11 +-
> sysdeps/unix/sysv/linux/msgrcv.c | 26 +--
> sysdeps/unix/sysv/linux/msgsnd.c | 11 +-
> sysdeps/unix/sysv/linux/powerpc/ipc_priv.h | 23 +--
> sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/s390/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 14 --
> sysdeps/unix/sysv/linux/s390/semtimedop.c | 12 +-
> sysdeps/unix/sysv/linux/semctl.c | 58 +++---
> sysdeps/unix/sysv/linux/semget.c | 11 +-
> sysdeps/unix/sysv/linux/semop.c | 10 +-
> sysdeps/unix/sysv/linux/semtimedop.c | 13 +-
> sysdeps/unix/sysv/linux/sh/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/shmat.c | 17 +-
> sysdeps/unix/sysv/linux/shmctl.c | 59 +++---
> sysdeps/unix/sysv/linux/shmdt.c | 12 +-
> sysdeps/unix/sysv/linux/shmget.c | 13 +-
> sysdeps/unix/sysv/linux/sparc/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h | 41 ++++
> sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c | 32 ---
> sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c | 54 -----
> sysdeps/unix/sysv/linux/x86_64/ipc_priv.h | 32 +++
> sysdeps/unix/sysv/linux/x86_64/syscalls.list | 12 --
> sysvipc/Makefile | 2 +
> sysvipc/test-sysvmsg.c | 128 ++++++++++++
> sysvipc/test-sysvsem.c | 116 +++++++++++
> sysvipc/test-sysvshm.c | 130 ++++++++++++
> test-skeleton.c | 2 +
> 62 files changed, 1010 insertions(+), 643 deletions(-)
> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ipc_priv.h
> delete mode 100644 sysdeps/unix/sysv/linux/alpha/msgctl.c
> delete mode 100644 sysdeps/unix/sysv/linux/alpha/semctl.c
> delete mode 100644 sysdeps/unix/sysv/linux/alpha/shmctl.c
> delete mode 100644 sysdeps/unix/sysv/linux/arm/msgctl.c
> delete mode 100644 sysdeps/unix/sysv/linux/arm/semctl.c
> delete mode 100644 sysdeps/unix/sysv/linux/arm/shmctl.c
> create mode 100644 sysdeps/unix/sysv/linux/ipc_ops.h
> delete mode 100644 sysdeps/unix/sysv/linux/m68k/semtimedop.S
> delete mode 100644 sysdeps/unix/sysv/linux/microblaze/msgctl.c
> delete mode 100644 sysdeps/unix/sysv/linux/microblaze/semctl.c
> delete mode 100644 sysdeps/unix/sysv/linux/microblaze/shmctl.c
> delete mode 100644 sysdeps/unix/sysv/linux/mips/ipc_priv.h
> create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
> create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
> delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
> delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
> create mode 100644 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
> create mode 100644 sysvipc/test-sysvmsg.c
> create mode 100644 sysvipc/test-sysvsem.c
> create mode 100644 sysvipc/test-sysvshm.c
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 00/17] Consolidate Linux sysvipc implementation
2016-11-25 14:02 ` Adhemerval Zanella
@ 2016-12-07 19:14 ` Adhemerval Zanella
2016-12-09 18:31 ` Steve Ellcey
0 siblings, 1 reply; 31+ messages in thread
From: Adhemerval Zanella @ 2016-12-07 19:14 UTC (permalink / raw)
To: libc-alpha
Ping x2.
On 25/11/2016 12:02, Adhemerval Zanella wrote:
> Ping (with Andreas comments fixed).
>
> On 08/11/2016 18:29, Adhemerval Zanella wrote:
>> Changes from previous version:
>>
>> - Refactor ipc_priv.h header to have working definition for all
>> architectures. The header basically contains Linux specific
>> ABI definitions for the architecture to correctly use default
>> implementation, including old ipc_perm definition, calling
>> convention, and __IPC_64 value.
>>
>> - Set all architectures to use the default implementation. It
>> leaded to some code changes to accomodate all the architectures
>> calling convention (with ipc_priv.h change) and some fixes
>> on new default implementation.
>>
>> - Change mips64 implementation way to use the default one.
>>
>> - Some tests changes (name typos).
>>
>> --
>>
>> This patchset is a continuation of my Linux syscall consolidation
>> implementation and aimed for SySV IPC (message queue, semaphore,
>> and shared memory).
>>
>> Current Linux default implementation only defines the old ipc
>> syscall method. Architectures need to either to imply the generic
>> syscalls.list or reimplement the syscall definition. To simplify
>> and allow to remove some old arch-specific implementation, I added
>> the direct syscall method for all supported IPC mechanisms.
>>
>> Other changes are simple code reorganization to simplify and all
>> compatibility required for various ports.
>>
>> The patchset also adds 3 simple tests that aims to check for correct
>> argument passing on syscall. The idea is not to be an extensive
>> testing of all supported IPC.
>>
>> Checked on x86_64, i686, armhf, aarch64, and powerpc64le.
>>
>> Adhemerval Zanella (17):
>> Add __ASSUME_SYSVIPC_SYSCALL for Linux
>> Refactor Linux ipc_priv header
>> Consolidate Linux msgctl implementation
>> Consolidate Linux msgrcv implementation
>> Use msgsnd syscall for Linux implementation
>> Use msgget syscall for Linux implementation
>> Add SYSV message queue test
>> Consolidate Linux semctl implementation
>> Use semget syscall for Linux implementation
>> Use semop syscall for Linux implementation
>> Consolidate Linux semtimedop implementation
>> Add SYSV semaphore test
>> Use shmat syscall for Linux implementation
>> Consolidate Linux shmctl implementation
>> Use shmdt syscall for linux implementation
>> Use shmget syscall for linux implementation
>> Add SYSV shared memory test
>>
>> ChangeLog | 229 +++++++++++++++++++++
>> sysdeps/unix/sysv/linux/aarch64/ipc_priv.h | 32 +++
>> sysdeps/unix/sysv/linux/alpha/Makefile | 3 -
>> sysdeps/unix/sysv/linux/alpha/ipc_priv.h | 33 ++-
>> sysdeps/unix/sysv/linux/alpha/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/alpha/msgctl.c | 1 -
>> sysdeps/unix/sysv/linux/alpha/semctl.c | 1 -
>> sysdeps/unix/sysv/linux/alpha/shmctl.c | 1 -
>> sysdeps/unix/sysv/linux/alpha/syscalls.list | 13 --
>> sysdeps/unix/sysv/linux/arm/msgctl.c | 33 ---
>> sysdeps/unix/sysv/linux/arm/semctl.c | 54 -----
>> sysdeps/unix/sysv/linux/arm/shmctl.c | 34 ---
>> sysdeps/unix/sysv/linux/arm/syscalls.list | 12 --
>> sysdeps/unix/sysv/linux/generic/syscalls.list | 14 --
>> sysdeps/unix/sysv/linux/hppa/syscalls.list | 14 --
>> sysdeps/unix/sysv/linux/i386/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/ia64/syscalls.list | 14 --
>> sysdeps/unix/sysv/linux/ipc_ops.h | 30 +++
>> sysdeps/unix/sysv/linux/ipc_priv.h | 23 +--
>> sysdeps/unix/sysv/linux/kernel-features.h | 4 +
>> sysdeps/unix/sysv/linux/m68k/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/m68k/semtimedop.S | 69 -------
>> sysdeps/unix/sysv/linux/microblaze/msgctl.c | 1 -
>> sysdeps/unix/sysv/linux/microblaze/semctl.c | 1 -
>> sysdeps/unix/sysv/linux/microblaze/shmctl.c | 1 -
>> sysdeps/unix/sysv/linux/microblaze/syscalls.list | 12 --
>> sysdeps/unix/sysv/linux/mips/ipc_priv.h | 1 -
>> sysdeps/unix/sysv/linux/mips/kernel-features.h | 2 +
>> sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h | 32 +++
>> sysdeps/unix/sysv/linux/mips/mips64/msgctl.c | 17 +-
>> sysdeps/unix/sysv/linux/mips/mips64/semctl.c | 38 +---
>> sysdeps/unix/sysv/linux/mips/mips64/shmctl.c | 17 +-
>> sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 12 --
>> sysdeps/unix/sysv/linux/msgctl.c | 45 ++--
>> sysdeps/unix/sysv/linux/msgget.c | 11 +-
>> sysdeps/unix/sysv/linux/msgrcv.c | 26 +--
>> sysdeps/unix/sysv/linux/msgsnd.c | 11 +-
>> sysdeps/unix/sysv/linux/powerpc/ipc_priv.h | 23 +--
>> sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/s390/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 14 --
>> sysdeps/unix/sysv/linux/s390/semtimedop.c | 12 +-
>> sysdeps/unix/sysv/linux/semctl.c | 58 +++---
>> sysdeps/unix/sysv/linux/semget.c | 11 +-
>> sysdeps/unix/sysv/linux/semop.c | 10 +-
>> sysdeps/unix/sysv/linux/semtimedop.c | 13 +-
>> sysdeps/unix/sysv/linux/sh/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/shmat.c | 17 +-
>> sysdeps/unix/sysv/linux/shmctl.c | 59 +++---
>> sysdeps/unix/sysv/linux/shmdt.c | 12 +-
>> sysdeps/unix/sysv/linux/shmget.c | 13 +-
>> sysdeps/unix/sysv/linux/sparc/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h | 41 ++++
>> sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c | 32 ---
>> sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c | 54 -----
>> sysdeps/unix/sysv/linux/x86_64/ipc_priv.h | 32 +++
>> sysdeps/unix/sysv/linux/x86_64/syscalls.list | 12 --
>> sysvipc/Makefile | 2 +
>> sysvipc/test-sysvmsg.c | 128 ++++++++++++
>> sysvipc/test-sysvsem.c | 116 +++++++++++
>> sysvipc/test-sysvshm.c | 130 ++++++++++++
>> test-skeleton.c | 2 +
>> 62 files changed, 1010 insertions(+), 643 deletions(-)
>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ipc_priv.h
>> delete mode 100644 sysdeps/unix/sysv/linux/alpha/msgctl.c
>> delete mode 100644 sysdeps/unix/sysv/linux/alpha/semctl.c
>> delete mode 100644 sysdeps/unix/sysv/linux/alpha/shmctl.c
>> delete mode 100644 sysdeps/unix/sysv/linux/arm/msgctl.c
>> delete mode 100644 sysdeps/unix/sysv/linux/arm/semctl.c
>> delete mode 100644 sysdeps/unix/sysv/linux/arm/shmctl.c
>> create mode 100644 sysdeps/unix/sysv/linux/ipc_ops.h
>> delete mode 100644 sysdeps/unix/sysv/linux/m68k/semtimedop.S
>> delete mode 100644 sysdeps/unix/sysv/linux/microblaze/msgctl.c
>> delete mode 100644 sysdeps/unix/sysv/linux/microblaze/semctl.c
>> delete mode 100644 sysdeps/unix/sysv/linux/microblaze/shmctl.c
>> delete mode 100644 sysdeps/unix/sysv/linux/mips/ipc_priv.h
>> create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
>> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
>> create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
>> delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
>> delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
>> create mode 100644 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
>> create mode 100644 sysvipc/test-sysvmsg.c
>> create mode 100644 sysvipc/test-sysvsem.c
>> create mode 100644 sysvipc/test-sysvshm.c
>>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 00/17] Consolidate Linux sysvipc implementation
2016-12-07 19:14 ` Adhemerval Zanella
@ 2016-12-09 18:31 ` Steve Ellcey
2016-12-09 20:04 ` Arnd Bergmann
2016-12-09 20:18 ` Adhemerval Zanella
0 siblings, 2 replies; 31+ messages in thread
From: Steve Ellcey @ 2016-12-09 18:31 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Wed, 2016-12-07 at 17:13 -0200, Adhemerval Zanella wrote:
> Ping x2.
>
> > On 08/11/2016 18:29, Adhemerval Zanella wrote:
> > >
> > > Changes from previous version:
> > >
> > > Â - Refactor ipc_priv.h header to have working definition for all
> > >     architectures.  The header basically contains Linux specific
> > > Â Â Â Â ABI definitions for the architecture to correctly use default
> > > Â Â Â Â implementation, including old ipc_perm definition, calling
> > > Â Â Â Â convention, and __IPC_64 value.
> > >
> > >  - Set all architectures to use the default implementation.  It
> > > Â Â Â Â leaded to some code changes to accomodate all the
> > > architectures
> > > Â Â Â Â calling convention (with ipc_priv.h change) and some fixes
> > > Â Â Â Â on new default implementation.
> > >
> > > Â - Change mips64 implementation way to use the default one.
> > >
> > > Â - Some tests changes (name typos).
> > >
> > > --
Adhemerval,
It looks like you may have to tweek your change to test-skeleton.c in
this patch.  The FAIL_EXIT macro was moved from test-skeleton.c
to support/check.h so I assume your new FAIL_UNSUPPORTED macro should
be moved there as well.
I have been doing aarch64 and x86 builds here with your patch and have
not had any problems except with my new aarch64 ILP32 code. Â There I
had to change the definition of __IPC_64 in the new header
file sysdeps/unix/sysv/linux/aarch64/ipc_priv.h from:
#define __IPC_64Â Â Â Â Â 0x0
to:
#ifdef __LP64__
# define __IPC_64Â Â Â Â Â 0x0
#else /* __ILP32Â Â */
# define __IPC_64Â Â Â Â Â 0x100
#endif
I don't know if that is something that you want to incorporate into
your patch or if I should leave it as part of my overall aarch64 ILP32
patch. Â Right now it is hard to include it in my patch since that
header file isn't in the official sources yet (being a new file in your
patch).
Hopefully someone will approve your patch soon and then I can just
build my patch on ToT instead of having to also include your patch.
I don't see any other problems with your patch myself but I am not that
familiar with this part of glibc so I would like to see someone else
review/approve this patch before you check it in but I would also like
to see it checked in soon so that I can move ahead with my aarch64
ILP32 patches before we get too close to the GLIBC 2.25 cutoff date.
Steve Ellcey
sellcey@caviumnetworks.com
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 00/17] Consolidate Linux sysvipc implementation
2016-12-09 18:31 ` Steve Ellcey
@ 2016-12-09 20:04 ` Arnd Bergmann
2017-01-05 20:57 ` Yury Norov
2016-12-09 20:18 ` Adhemerval Zanella
1 sibling, 1 reply; 31+ messages in thread
From: Arnd Bergmann @ 2016-12-09 20:04 UTC (permalink / raw)
To: libc-alpha; +Cc: Steve Ellcey, Adhemerval Zanella
On Friday, December 9, 2016 10:30:53 AM CET Steve Ellcey wrote:
>
> Adhemerval,
>
> It looks like you may have to tweek your change to test-skeleton.c in
> this patch. The FAIL_EXIT macro was moved from test-skeleton.c
> to support/check.h so I assume your new FAIL_UNSUPPORTED macro should
> be moved there as well.
>
> I have been doing aarch64 and x86 builds here with your patch and have
> not had any problems except with my new aarch64 ILP32 code. There I
> had to change the definition of __IPC_64 in the new header
> file sysdeps/unix/sysv/linux/aarch64/ipc_priv.h from:
>
> #define __IPC_64 0x0
>
> to:
>
> #ifdef __LP64__
> # define __IPC_64 0x0
> #else /* __ILP32 */
> # define __IPC_64 0x100
> #endif
Huh?
I would hope that this is not really needed, it looks like
a kernel bug. The old style IPC has been deprecated for so
long that nothing should need to pass the 0x100 flag, unless
it dates back to the last century.
Do we need to override the version parsing in the kernel?
Arnd
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 00/17] Consolidate Linux sysvipc implementation
2016-12-09 18:31 ` Steve Ellcey
2016-12-09 20:04 ` Arnd Bergmann
@ 2016-12-09 20:18 ` Adhemerval Zanella
1 sibling, 0 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2016-12-09 20:18 UTC (permalink / raw)
To: Steve Ellcey, libc-alpha
On 09/12/2016 16:30, Steve Ellcey wrote:
> On Wed, 2016-12-07 at 17:13 -0200, Adhemerval Zanella wrote:
>> Ping x2.
>>
>>> On 08/11/2016 18:29, Adhemerval Zanella wrote:
>>>>
>>>> Changes from previous version:
>>>>
>>>> - Refactor ipc_priv.h header to have working definition for all
>>>> architectures. The header basically contains Linux specific
>>>> ABI definitions for the architecture to correctly use default
>>>> implementation, including old ipc_perm definition, calling
>>>> convention, and __IPC_64 value.
>>>>
>>>> - Set all architectures to use the default implementation. It
>>>> leaded to some code changes to accomodate all the
>>>> architectures
>>>> calling convention (with ipc_priv.h change) and some fixes
>>>> on new default implementation.
>>>>
>>>> - Change mips64 implementation way to use the default one.
>>>>
>>>> - Some tests changes (name typos).
>>>>
>>>> --
>
> Adhemerval,
>
> It looks like you may have to tweek your change to test-skeleton.c in
> this patch. The FAIL_EXIT macro was moved from test-skeleton.c
> to support/check.h so I assume your new FAIL_UNSUPPORTED macro should
> be moved there as well.
Yes, I did not rebase against new source changes and looks like I will
need to do so. And it is worth a v4, so I will send it a new set for
review.
>
> I have been doing aarch64 and x86 builds here with your patch and have
> not had any problems except with my new aarch64 ILP32 code. There I
> had to change the definition of __IPC_64 in the new header
> file sysdeps/unix/sysv/linux/aarch64/ipc_priv.h from:
>
> #define __IPC_64 0x0
>
> to:
>
> #ifdef __LP64__
> # define __IPC_64 0x0
> #else /* __ILP32 */
> # define __IPC_64 0x100
> #endif
>
> I don't know if that is something that you want to incorporate into
> your patch or if I should leave it as part of my overall aarch64 ILP32
> patch. Right now it is hard to include it in my patch since that
> header file isn't in the official sources yet (being a new file in your
> patch).
If this is the correct value for ILP32 I will add, but from Arnd reply
it might an issue with your kernel config.
>
> Hopefully someone will approve your patch soon and then I can just
> build my patch on ToT instead of having to also include your patch.
> I don't see any other problems with your patch myself but I am not that
> familiar with this part of glibc so I would like to see someone else
> review/approve this patch before you check it in but I would also like
> to see it checked in soon so that I can move ahead with my aarch64
> ILP32 patches before we get too close to the GLIBC 2.25 cutoff date.
My idea is to push this next week to avoid issues with cutoff date.
>
> Steve Ellcey
> sellcey@caviumnetworks.com
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 00/17] Consolidate Linux sysvipc implementation
2016-12-09 20:04 ` Arnd Bergmann
@ 2017-01-05 20:57 ` Yury Norov
0 siblings, 0 replies; 31+ messages in thread
From: Yury Norov @ 2017-01-05 20:57 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: libc-alpha, Steve Ellcey, Adhemerval Zanella
On Fri, Dec 09, 2016 at 09:04:18PM +0100, Arnd Bergmann wrote:
> On Friday, December 9, 2016 10:30:53 AM CET Steve Ellcey wrote:
> >
> > Adhemerval,
> >
> > It looks like you may have to tweek your change to test-skeleton.c in
> > this patch. The FAIL_EXIT macro was moved from test-skeleton.c
> > to support/check.h so I assume your new FAIL_UNSUPPORTED macro should
> > be moved there as well.
> >
> > I have been doing aarch64 and x86 builds here with your patch and have
> > not had any problems except with my new aarch64 ILP32 code. There I
> > had to change the definition of __IPC_64 in the new header
> > file sysdeps/unix/sysv/linux/aarch64/ipc_priv.h from:
> >
> > #define __IPC_64 0x0
> >
> > to:
> >
> > #ifdef __LP64__
> > # define __IPC_64 0x0
> > #else /* __ILP32 */
> > # define __IPC_64 0x100
> > #endif
>
> Huh?
>
> I would hope that this is not really needed, it looks like
> a kernel bug. The old style IPC has been deprecated for so
> long that nothing should need to pass the 0x100 flag, unless
> it dates back to the last century.
>
> Do we need to override the version parsing in the kernel?
Hi Arnd,
It's not completely clear what you do mean here. I think you mean that
function that parses flags should be changed, but Steve noticed that
it may also mean that you want to replace compat sys_msg{ctl,rcv,snd}
in generic unistd,h with non-compat versions. If so, it should be
probably done before taking aarch64/ilp32.
Yury
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2017-01-05 20:57 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 20:30 [PATCH v3 00/17] Consolidate Linux sysvipc implementation Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 03/17] Consolidate Linux msgctl implementation Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 11/17] Consolidate Linux semtimedop implementation Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 10/17] Use semop syscall for Linux implementation Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 04/17] Consolidate Linux msgrcv implementation Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 15/17] Use shmdt syscall for linux implementation Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 12/17] Add SYSV semaphore test Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 01/17] Add __ASSUME_SYSVIPC_SYSCALL for Linux Adhemerval Zanella
2016-11-08 21:19 ` Andreas Schwab
2016-11-09 13:23 ` Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 13/17] Use shmat syscall for Linux implementation Adhemerval Zanella
2016-11-08 20:30 ` [PATCH v3 02/17] Refactor Linux ipc_priv header Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 14/17] Consolidate Linux shmctl implementation Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 06/17] Use msgget syscall for Linux implementation Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 16/17] Use shmget syscall for linux implementation Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 17/17] Add SYSV shared memory test Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 05/17] Use msgsnd syscall for Linux implementation Adhemerval Zanella
2016-11-08 21:13 ` Andreas Schwab
2016-11-09 13:23 ` Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 07/17] Add SYSV message queue test Adhemerval Zanella
2016-11-08 21:23 ` Andreas Schwab
2016-11-09 13:28 ` Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 09/17] Use semget syscall for Linux implementation Adhemerval Zanella
2016-11-08 20:31 ` [PATCH v3 08/17] Consolidate Linux semctl implementation Adhemerval Zanella
2016-11-09 13:57 ` [PATCH v3 00/17] Consolidate Linux sysvipc implementation Yury Norov
2016-11-25 14:02 ` Adhemerval Zanella
2016-12-07 19:14 ` Adhemerval Zanella
2016-12-09 18:31 ` Steve Ellcey
2016-12-09 20:04 ` Arnd Bergmann
2017-01-05 20:57 ` Yury Norov
2016-12-09 20:18 ` 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).