public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 13/16] Consolidate Linux shmctl implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (7 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 12/16] Use shmat " Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux Adhemerval Zanella
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/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                                    |  8 ++++
 sysdeps/unix/sysv/linux/alpha/shmctl.c       |  1 -
 sysdeps/unix/sysv/linux/arm/shmctl.c         | 34 -----------------
 sysdeps/unix/sysv/linux/microblaze/shmctl.c  |  1 -
 sysdeps/unix/sysv/linux/mips/mips64/shmctl.c | 17 +--------
 sysdeps/unix/sysv/linux/shmctl.c             | 56 ++++++++++++----------------
 6 files changed, 34 insertions(+), 83 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/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/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/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..8a82697 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c
@@ -15,18 +15,5 @@
    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>
-
-int __shmctl (int shmid, int cmd, struct shmid_ds *buf);
-
-int
-__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, __shmctl, shmctl, GLIBC_2_0);
+#define DEFAULT_VERSION GLIBC_2_0
+#include <./sysdeps/unix/sysv/linux/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
index b2caf75..a411962 100644
--- a/sysdeps/unix/sysv/linux/shmctl.c
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -16,18 +16,35 @@
    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
+
+
+/* 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);
 
-#include <kernel-features.h>
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) \
+    && defined (__NR_ipc)
 struct __old_shmid_ds
 {
   struct __old_ipc_perm shm_perm;	/* operation permission struct */
@@ -43,36 +60,11 @@ 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);
+  return INLINE_SYSCALL_CALL (ipc, IPCOP_shmctl, shmid, cmd, 0, buf);
 }
 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);
-- 
2.7.4

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

* [PATCH v2 16/16] Add SYSV shared memory test
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (2 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 06/16] Add SYSV message queue test Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-03 17:14   ` Yury Norov
  2016-11-02 19:27 ` [PATCH v2 14/16] Use shmdt syscall for linux implementation Adhemerval Zanella
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/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..4f3f22e
--- /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 msgq 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 ("msgget not supported");
+      FAIL_EXIT1 ("msgget 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 ("msgid_ds::msg_perm::key (%d) != %d",
+		(int) shminfo.shm_perm.__key, (int) key);
+  if (shminfo.shm_perm.mode != SHM_MODE)
+    FAIL_EXIT1 ("msgid_ds::shm_perm::mode (%o) != %o",
+		shminfo.shm_perm.mode, SHM_MODE);
+  if (shminfo.shm_segsz != pgsz)
+    FAIL_EXIT1 ("msgid_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] 35+ messages in thread

* [PATCH v2 06/16] Add SYSV message queue test
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 08/16] Use semget syscall for Linux implementation Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 07/16] Consolidate Linux semctl implementation Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-03 17:09   ` Yury Norov
  2016-11-02 19:27 ` [PATCH v2 16/16] Add SYSV shared memory test Adhemerval Zanella
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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 | 123 +++++++++++++++++++++++++++++++++++++++++++++++++
 test-skeleton.c        |   2 +
 4 files changed, 131 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..9393c83
--- /dev/null
+++ b/sysvipc/test-sysvmsg.c
@@ -0,0 +1,123 @@
+/* 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
+{
+  long int type;
+  char text[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, TEXTSIZE, MSGTYPE, IPC_NOWAIT) == -1
+      && errno != ENOMSG)
+    FAIL_EXIT1 ("msgrcv failed (errno=%d)", errno);
+
+  struct msgbuf_t msg2snd = { MSGTYPE, MSGDATA };
+  if (msgsnd (msqid, &msg2snd, TEXTSIZE, 0) == -1)
+    FAIL_EXIT1 ("msgsnd failed (errno=%d)", errno);
+
+  if (msgrcv (msqid, &msg2rcv, TEXTSIZE, MSGTYPE, 0) == -1)
+    FAIL_EXIT1 ("msgrcv failed (errno=%d)", errno);
+
+  int ret = 0;
+  if (strncmp (msg2snd.text, msg2rcv.text, 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 55841fb..f27e3da 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -87,6 +87,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] 35+ messages in thread

* [PATCH v2 05/16] Use msgget syscall for Linux implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (9 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 11/16] Add SYSV semaphore test Adhemerval Zanella
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/msgget.c (msgget): Use msgget syscall if
	define.
---
 ChangeLog                        |  3 +++
 sysdeps/unix/sysv/linux/msgget.c | 11 ++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

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
 }
-- 
2.7.4

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

* [PATCH v2 03/16] Consolidate Linux msgrcv implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (4 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 14/16] Use shmdt syscall for linux implementation Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 04/16] Use msgsnd syscall for Linux implementation Adhemerval Zanella
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/msgrcv.c (__libc_msgrcv): Use msgrcv syscall
	if defined.
	* sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c: Remove file.
---
 ChangeLog                                      |  4 ++++
 sysdeps/unix/sysv/linux/msgrcv.c               | 25 ++++++++------------
 sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c | 32 --------------------------
 3 files changed, 13 insertions(+), 48 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c

diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c
index c4dd219..f4e25ba 100644
--- a/sysdeps/unix/sysv/linux/msgrcv.c
+++ b/sysdeps/unix/sysv/linux/msgrcv.c
@@ -16,33 +16,26 @@
    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)
 {
+#ifdef __ASSUME_SYSVIPC_SYSCALL
+  return SYSCALL_CANCEL (msgrc, msqid, msgp, msgsz, msgtyp, msgflg);
+#else
   /* 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;
+  struct
+  {
+    void *msgp;
+    long int msgtyp;
+  } tmp = { msgp, msgtyp };
 
   return SYSCALL_CANCEL (ipc, IPCOP_msgrcv, msqid, msgsz, msgflg, &tmp);
+#endif
 }
 weak_alias (__libc_msgrcv, msgrcv)
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)
-- 
2.7.4

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

* [PATCH v2 11/16] Add SYSV semaphore test
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (10 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 05/16] Use msgget syscall for Linux implementation Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-03 17:10   ` Yury Norov
  2016-11-02 19:27 ` [PATCH v2 02/16] Consolidate Linux msgctl implementation Adhemerval Zanella
                   ` (3 subsequent siblings)
  15 siblings, 1 reply; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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 | 115 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 119 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..178a424
--- /dev/null
+++ b/sysvipc/test-sysvsem.c
@@ -0,0 +1,115 @@
+/* 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 ("msgget 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 ("msgctl with IPC_STAT failed (errno=%d)", errno);
+
+  if (seminfo.sem_perm.__key != key)
+    FAIL_EXIT1 ("msgid_ds::sem_perm::key (%d) != %d",
+		(int) seminfo.sem_perm.__key, (int) key);
+  if (seminfo.sem_perm.mode != SEM_MODE)
+    FAIL_EXIT1 ("msgid_ds::sem_perm::mode (%o) != %o",
+		seminfo.sem_perm.mode, SEM_MODE);
+  if (seminfo.sem_nsems != 1)
+    FAIL_EXIT1 ("msgid_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)
+    FAIL_EXIT1 ("semtimedop succeed or returned errno != EAGAIN (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] 35+ messages in thread

* [PATCH v2 12/16] Use shmat syscall for Linux implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (6 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 04/16] Use msgsnd syscall for Linux implementation Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-07 11:02   ` Arnd Bergmann
  2016-11-02 19:27 ` [PATCH v2 13/16] Consolidate Linux shmctl implementation Adhemerval Zanella
                   ` (7 subsequent siblings)
  15 siblings, 1 reply; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/shmat.c (shmat): Use shmat syscall if it is
	defined.
---
 ChangeLog                       |  3 +++
 sysdeps/unix/sysv/linux/shmat.c | 17 ++++++++---------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c
index 5afc93c..97a15c2 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 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
 }
-- 
2.7.4

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

* [PATCH v2 15/16] Use shmget syscall for linux implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (14 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 10/16] Consolidate Linux semtimedop implementation Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  15 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/shmget.c (shmget): Use shmget syscall if it
	is defined.
---
 ChangeLog                        |  3 +++
 sysdeps/unix/sysv/linux/shmget.c | 13 +++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

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
 }
-- 
2.7.4

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

* [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (8 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 13/16] Consolidate Linux shmctl implementation Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-02 21:10   ` Joseph Myers
                     ` (2 more replies)
  2016-11-02 19:27 ` [PATCH v2 05/16] Use msgget syscall for Linux implementation Adhemerval Zanella
                   ` (5 subsequent siblings)
  15 siblings, 3 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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..8fd7853 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 c5240fa..cb09603 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -49,3 +49,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] 35+ messages in thread

* [PATCH v2 14/16] Use shmdt syscall for linux implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (3 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 16/16] Add SYSV shared memory test Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 03/16] Consolidate Linux msgrcv implementation Adhemerval Zanella
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/shmdt.c (shmdt): Use shmdt syscall if it is
	defined.
---
 ChangeLog                       |  3 +++
 sysdeps/unix/sysv/linux/shmdt.c | 12 +++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/shmdt.c b/sysdeps/unix/sysv/linux/shmdt.c
index 7224d6f..2f5b316 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, 0, 0, 0, shmaddr);
+#else
+  return INLINE_SYSCALL_CALL (ipc, IPCOP_shmdt, 0, 0, 0, shmaddr);
+#endif
 }
-- 
2.7.4

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

* [PATCH v2 10/16] Consolidate Linux semtimedop implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (13 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 09/16] Use semop syscall for Linux implementation Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 15/16] Use shmget syscall for linux implementation Adhemerval Zanella
  15 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/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                                 |  6 +++
 sysdeps/unix/sysv/linux/m68k/semtimedop.S | 69 -------------------------------
 sysdeps/unix/sysv/linux/s390/semtimedop.c | 12 +++---
 sysdeps/unix/sysv/linux/semtimedop.c      | 13 +++---
 4 files changed, 20 insertions(+), 80 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/m68k/semtimedop.S

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/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..d9249d2 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, nsops, sops, timeout);
+#else
+  return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid, nsops, 0, sops,
+			      timeout);
+#endif
 }
-- 
2.7.4

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

* [PATCH v2 07/16] Consolidate Linux semctl implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 08/16] Use semget syscall for Linux implementation Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 06/16] Add SYSV message queue test Adhemerval Zanella
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/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.
---
 ChangeLog                                      |  9 +++++
 sysdeps/unix/sysv/linux/alpha/semctl.c         |  1 -
 sysdeps/unix/sysv/linux/arm/semctl.c           | 54 --------------------------
 sysdeps/unix/sysv/linux/microblaze/semctl.c    |  1 -
 sysdeps/unix/sysv/linux/mips/mips64/semctl.c   | 38 +-----------------
 sysdeps/unix/sysv/linux/semctl.c               | 54 +++++++++++++-------------
 sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c | 54 --------------------------
 7 files changed, 37 insertions(+), 174 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

--- 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/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/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..61ba985 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/semctl.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/semctl.c
@@ -15,39 +15,5 @@
    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);
-
-  va_end (ap);
-
-  return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd | __IPC_64,
-			 arg.array);
-}
-
-#include <shlib-compat.h>
-versioned_symbol (libc, __semctl, semctl, GLIBC_2_0);
+#define DEFAULT_VERSION GLIBC_2_0
+#include <sysdeps/unix/sysv/linux/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index ee84a1e..f116e5d 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,
+			      &arg);
 #endif
+}
+versioned_symbol (libc, __new_semctl, semctl, DEFAULT_VERSION);
+
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) \
+    && defined (__NR_ipc)
+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,8 @@ __new_semctl (int semid, int semnum, int cmd, ...)
       break;
     }
 
-  return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
-			 &arg);
+  return INLINE_SYSCALL_CALL (ipc, IPCOP_semctl, semid, semnum, cmd,
+			      &arg);
 }
-
-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);
-}
-- 
2.7.4

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

* [PATCH v2 04/16] Use msgsnd syscall for Linux implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (5 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 03/16] Consolidate Linux msgrcv implementation Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-03 14:15   ` Yury Norov
  2016-11-02 19:27 ` [PATCH v2 12/16] Use shmat " Adhemerval Zanella
                   ` (8 subsequent siblings)
  15 siblings, 1 reply; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/msgsnd.c (__libc_msgsnd): Use msgsnd syscall
	if defined.
---
 ChangeLog                        | 3 +++
 sysdeps/unix/sysv/linux/msgsnd.c | 7 ++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
index 1457e43..4ed3a64 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 <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);
+#endif
 }
 weak_alias (__libc_msgsnd, msgsnd)
-- 
2.7.4

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

* [PATCH v2 08/16] Use semget syscall for Linux implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 07/16] Consolidate Linux semctl implementation Adhemerval Zanella
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/semget.c (semget): Use semget syscall
	if it is defined.
---
 ChangeLog                        |  3 +++
 sysdeps/unix/sysv/linux/semget.c | 11 ++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

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
 }
-- 
2.7.4

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

* [PATCH v2 09/16] Use semop syscall for Linux implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (12 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 02/16] Consolidate Linux msgctl implementation Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 10/16] Consolidate Linux semtimedop implementation Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 15/16] Use shmget syscall for linux implementation Adhemerval Zanella
  15 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/semop.c (semop): Use semop syscall if it is
	defined.
---
 ChangeLog                       |  3 +++
 sysdeps/unix/sysv/linux/semop.c | 10 ++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

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
 }
-- 
2.7.4

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

* [PATCH v2 02/16] Consolidate Linux msgctl implementation
  2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (11 preceding siblings ...)
  2016-11-02 19:27 ` [PATCH v2 11/16] Add SYSV semaphore test Adhemerval Zanella
@ 2016-11-02 19:27 ` Adhemerval Zanella
  2016-11-04 15:33   ` Yury Norov
  2016-11-02 19:27 ` [PATCH v2 09/16] Use semop syscall for Linux implementation Adhemerval Zanella
                   ` (2 subsequent siblings)
  15 siblings, 1 reply; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
    wired syscall or the ipc one.

--

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/msgctl.c: Remove file.
	* sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/msgctl.c: 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                                    |  8 ++++++
 sysdeps/unix/sysv/linux/alpha/msgctl.c       |  1 -
 sysdeps/unix/sysv/linux/arm/msgctl.c         | 33 ----------------------
 sysdeps/unix/sysv/linux/microblaze/msgctl.c  |  1 -
 sysdeps/unix/sysv/linux/mips/mips64/msgctl.c | 17 ++---------
 sysdeps/unix/sysv/linux/msgctl.c             | 42 +++++++++++++---------------
 6 files changed, 30 insertions(+), 72 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/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/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/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..f43479f 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
@@ -15,18 +15,5 @@
    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>
-
-int __msgctl (int msqid, int cmd, struct msqid_ds *buf);
-
-int
-__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, __msgctl, msgctl, GLIBC_2_0);
+#define DEFAULT_VERSION 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..3316670 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -16,17 +16,31 @@
    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
 
-#include <kernel-features.h>
+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);
 
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) \
+    && defined (__NR_ipc)
 struct __old_msqid_ds
 {
   struct __old_ipc_perm msg_perm;	/* structure describing operation permission */
@@ -44,27 +58,11 @@ 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);
+  return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf);
 }
 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);
-- 
2.7.4

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

* [PATCH v2 00/16] Consolidate Linux sysvipc implementation
@ 2016-11-02 19:27 Adhemerval Zanella
  2016-11-02 19:27 ` [PATCH v2 08/16] Use semget syscall for Linux implementation Adhemerval Zanella
                   ` (15 more replies)
  0 siblings, 16 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 19:27 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

  - Add __ASSUME_SYSVIPC_SYSCALL define on default linux kernel
    features headers and undefine it on architectures that do not
    support wired sysvipc syscalls.

  - Use __ASSUME_SYSVIPC_SYSCALL to define where to use wired
    syscalls.

--

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 (16):
  Add __ASSUME_SYSVIPC_SYSCALL for Linux
  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                                         |  85 ++++++++++++++
 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/arm/msgctl.c              |  33 ------
 sysdeps/unix/sysv/linux/arm/semctl.c              |  54 ---------
 sysdeps/unix/sysv/linux/arm/shmctl.c              |  34 ------
 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/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/mips/kernel-features.h    |   2 +
 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/msgctl.c                  |  42 ++++---
 sysdeps/unix/sysv/linux/msgget.c                  |  11 +-
 sysdeps/unix/sysv/linux/msgrcv.c                  |  25 ++---
 sysdeps/unix/sysv/linux/msgsnd.c                  |   7 +-
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h |   3 +
 sysdeps/unix/sysv/linux/s390/kernel-features.h    |   3 +
 sysdeps/unix/sysv/linux/s390/semtimedop.c         |  12 +-
 sysdeps/unix/sysv/linux/semctl.c                  |  54 +++++----
 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                  |  56 ++++------
 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/msgrcv.c    |  32 ------
 sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c    |  54 ---------
 sysvipc/Makefile                                  |   2 +
 sysvipc/test-sysvmsg.c                            | 123 ++++++++++++++++++++
 sysvipc/test-sysvsem.c                            | 115 +++++++++++++++++++
 sysvipc/test-sysvshm.c                            | 130 ++++++++++++++++++++++
 test-skeleton.c                                   |   2 +
 42 files changed, 624 insertions(+), 494 deletions(-)
 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
 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/sparc/sparc64/msgrcv.c
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
 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] 35+ messages in thread

* Re: [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux
  2016-11-02 19:27 ` [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux Adhemerval Zanella
@ 2016-11-02 21:10   ` Joseph Myers
  2016-11-02 22:27     ` Adhemerval Zanella
  2016-11-03 17:07   ` Yury Norov
  2016-11-07 11:28   ` Arnd Bergmann
  2 siblings, 1 reply; 35+ messages in thread
From: Joseph Myers @ 2016-11-02 21:10 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Wed, 2 Nov 2016, Adhemerval Zanella wrote:

> 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.

You list microblaze in this list, but I don't see a corresponding 
kernel-features.h #undef for it.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux
  2016-11-02 21:10   ` Joseph Myers
@ 2016-11-02 22:27     ` Adhemerval Zanella
  2016-11-02 22:34       ` Adhemerval Zanella
  0 siblings, 1 reply; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 22:27 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha



On 02/11/2016 19:10, Joseph Myers wrote:
> On Wed, 2 Nov 2016, Adhemerval Zanella wrote:
> 
>> 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.
> 
> You list microblaze in this list, but I don't see a corresponding 
> kernel-features.h #undef for it.
> 

It is indeed a mistake from the script I used to check various kernel
syscall table list.  On 3.2, microblaze code [1] in fact defines
the old ipc syscall as 'sys_ni_syscall', so the architecture only
supports wire ones.

I am rechecking all architectures to see I missed something related.

[1] arch/microblaze/kernel/syscall_table.S

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

* Re: [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux
  2016-11-02 22:27     ` Adhemerval Zanella
@ 2016-11-02 22:34       ` Adhemerval Zanella
  0 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-02 22:34 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha



On 02/11/2016 20:27, Adhemerval Zanella wrote:
> 
> 
> On 02/11/2016 19:10, Joseph Myers wrote:
>> On Wed, 2 Nov 2016, Adhemerval Zanella wrote:
>>
>>> 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.
>>
>> You list microblaze in this list, but I don't see a corresponding 
>> kernel-features.h #undef for it.
>>
> 
> It is indeed a mistake from the script I used to check various kernel
> syscall table list.  On 3.2, microblaze code [1] in fact defines
> the old ipc syscall as 'sys_ni_syscall', so the architecture only
> supports wire ones.
> 
> I am rechecking all architectures to see I missed something related.

Microblaze seems the only one that I got a wrong result (basically
my script was grepping a comment about sys_ipc without checking if
it was defined as sys_ni_syscall).
 

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

* Re: [PATCH v2 04/16] Use msgsnd syscall for Linux implementation
  2016-11-02 19:27 ` [PATCH v2 04/16] Use msgsnd syscall for Linux implementation Adhemerval Zanella
@ 2016-11-03 14:15   ` Yury Norov
  2016-11-03 20:27     ` Adhemerval Zanella
  0 siblings, 1 reply; 35+ messages in thread
From: Yury Norov @ 2016-11-03 14:15 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

Hi Adhemerval,

On Wed, Nov 02, 2016 at 05:26:41PM -0200, Adhemerval Zanella wrote:
> Changes from previous version:
> 
>   - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
>     wired syscall or the ipc one.
> 
> --
> 
> 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.

Typo?

> 
> 	* sysdeps/unix/sysv/linux/msgsnd.c (__libc_msgsnd): Use msgsnd syscall
> 	if defined.
> ---
>  ChangeLog                        | 3 +++
>  sysdeps/unix/sysv/linux/msgsnd.c | 7 ++++---
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
> index 1457e43..4ed3a64 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 <ipc_priv.h>
> -
>  #include <sysdep-cancel.h>
> -#include <sys/syscall.h>

IIUC, ipc_priv.h is only needed if__ASSUME_SYSVIPC_SYSCALL is not
defined.

Is sys/msg.h needed for __ASSUME_SYSVIPC_SYSCALL only? If so, it's
better to #include kernel-features.h instead.

The same for other patches of series.

Yury.

>  
>  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);
> +#endif
>  }
>  weak_alias (__libc_msgsnd, msgsnd)
> -- 
> 2.7.4

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

* Re: [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux
  2016-11-02 19:27 ` [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux Adhemerval Zanella
  2016-11-02 21:10   ` Joseph Myers
@ 2016-11-03 17:07   ` Yury Norov
  2016-11-03 20:13     ` Adhemerval Zanella
  2016-11-07 11:28   ` Arnd Bergmann
  2 siblings, 1 reply; 35+ messages in thread
From: Yury Norov @ 2016-11-03 17:07 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Wed, Nov 02, 2016 at 05:26:38PM -0200, Adhemerval Zanella wrote:
> Changes from previous version:
> 
>   - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
>     wired syscall or the ipc one.
> 
> --
> 
> 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..8fd7853 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
> + 

Trailing whitespace

> +/* 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 c5240fa..cb09603 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -49,3 +49,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] 35+ messages in thread

* Re: [PATCH v2 06/16] Add SYSV message queue test
  2016-11-02 19:27 ` [PATCH v2 06/16] Add SYSV message queue test Adhemerval Zanella
@ 2016-11-03 17:09   ` Yury Norov
  2016-11-03 20:12     ` Adhemerval Zanella
  0 siblings, 1 reply; 35+ messages in thread
From: Yury Norov @ 2016-11-03 17:09 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Wed, Nov 02, 2016 at 05:26:43PM -0200, Adhemerval Zanella wrote:
> Changes from previous version:
> 
>   - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
>     wired syscall or the ipc one.
> 
> --
> 
> 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 | 123 +++++++++++++++++++++++++++++++++++++++++++++++++
>  test-skeleton.c        |   2 +
>  4 files changed, 131 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..9393c83
> --- /dev/null
> +++ b/sysvipc/test-sysvmsg.c
> @@ -0,0 +1,123 @@
> +/* 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
> +{
> +  long int type;
> +  char text[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.  

Trailing whitespace

> +     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, TEXTSIZE, MSGTYPE, IPC_NOWAIT) == -1
> +      && errno != ENOMSG)
> +    FAIL_EXIT1 ("msgrcv failed (errno=%d)", errno);
> +
> +  struct msgbuf_t msg2snd = { MSGTYPE, MSGDATA };
> +  if (msgsnd (msqid, &msg2snd, TEXTSIZE, 0) == -1)
> +    FAIL_EXIT1 ("msgsnd failed (errno=%d)", errno);
> +
> +  if (msgrcv (msqid, &msg2rcv, TEXTSIZE, MSGTYPE, 0) == -1)
> +    FAIL_EXIT1 ("msgrcv failed (errno=%d)", errno);
> +
> +  int ret = 0;
> +  if (strncmp (msg2snd.text, msg2rcv.text, 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 55841fb..f27e3da 100644
> --- a/test-skeleton.c
> +++ b/test-skeleton.c
> @@ -87,6 +87,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] 35+ messages in thread

* Re: [PATCH v2 11/16] Add SYSV semaphore test
  2016-11-02 19:27 ` [PATCH v2 11/16] Add SYSV semaphore test Adhemerval Zanella
@ 2016-11-03 17:10   ` Yury Norov
  2016-11-03 20:11     ` Adhemerval Zanella
  0 siblings, 1 reply; 35+ messages in thread
From: Yury Norov @ 2016-11-03 17:10 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Wed, Nov 02, 2016 at 05:26:48PM -0200, Adhemerval Zanella wrote:
> Changes from previous version:
> 
>   - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
>     wired syscall or the ipc one.
> 
> --
> 
> 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 | 115 +++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 119 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..178a424
> --- /dev/null
> +++ b/sysvipc/test-sysvsem.c
> @@ -0,0 +1,115 @@
> +/* 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.  

Trailing whitespace

> +     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 ("msgget 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 ("msgctl with IPC_STAT failed (errno=%d)", errno);
> +
> +  if (seminfo.sem_perm.__key != key)
> +    FAIL_EXIT1 ("msgid_ds::sem_perm::key (%d) != %d",
> +		(int) seminfo.sem_perm.__key, (int) key);
> +  if (seminfo.sem_perm.mode != SEM_MODE)
> +    FAIL_EXIT1 ("msgid_ds::sem_perm::mode (%o) != %o",
> +		seminfo.sem_perm.mode, SEM_MODE);
> +  if (seminfo.sem_nsems != 1)
> +    FAIL_EXIT1 ("msgid_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)
> +    FAIL_EXIT1 ("semtimedop succeed or returned errno != EAGAIN (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] 35+ messages in thread

* Re: [PATCH v2 16/16] Add SYSV shared memory test
  2016-11-02 19:27 ` [PATCH v2 16/16] Add SYSV shared memory test Adhemerval Zanella
@ 2016-11-03 17:14   ` Yury Norov
  0 siblings, 0 replies; 35+ messages in thread
From: Yury Norov @ 2016-11-03 17:14 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Wed, Nov 02, 2016 at 05:26:53PM -0200, Adhemerval Zanella wrote:
> Changes from previous version:
> 
>   - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
>     wired syscall or the ipc one.
> 
> --
> 
> 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/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..4f3f22e
> --- /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.  

Trailing whitespace

> +     Ignore error since the msgq 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 ("msgget not supported");
> +      FAIL_EXIT1 ("msgget 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 ("msgid_ds::msg_perm::key (%d) != %d",
> +		(int) shminfo.shm_perm.__key, (int) key);
> +  if (shminfo.shm_perm.mode != SHM_MODE)
> +    FAIL_EXIT1 ("msgid_ds::shm_perm::mode (%o) != %o",
> +		shminfo.shm_perm.mode, SHM_MODE);
> +  if (shminfo.shm_segsz != pgsz)
> +    FAIL_EXIT1 ("msgid_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;
> +  

And here

> +  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);
> +  

And here

> +  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] 35+ messages in thread

* Re: [PATCH v2 11/16] Add SYSV semaphore test
  2016-11-03 17:10   ` Yury Norov
@ 2016-11-03 20:11     ` Adhemerval Zanella
  0 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-03 20:11 UTC (permalink / raw)
  To: Yury Norov; +Cc: libc-alpha



On 03/11/2016 15:10, Yury Norov wrote:
>> diff --git a/sysvipc/test-sysvsem.c b/sysvipc/test-sysvsem.c
>> new file mode 100644
>> index 0000000..178a424
>> --- /dev/null
>> +++ b/sysvipc/test-sysvsem.c
>> @@ -0,0 +1,115 @@
>> +/* 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.  
> 
> Trailing whitespace

Ack, I fixed in my local branch.

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

* Re: [PATCH v2 06/16] Add SYSV message queue test
  2016-11-03 17:09   ` Yury Norov
@ 2016-11-03 20:12     ` Adhemerval Zanella
  0 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-03 20:12 UTC (permalink / raw)
  To: Yury Norov; +Cc: libc-alpha



On 03/11/2016 15:08, Yury Norov wrote:
>> new file mode 100644
>> index 0000000..9393c83
>> --- /dev/null
>> +++ b/sysvipc/test-sysvmsg.c
>> @@ -0,0 +1,123 @@
>> +/* 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
>> +{
>> +  long int type;
>> +  char text[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.  
> 
> Trailing whitespace

Ack, I fixed it on my local branch.

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

* Re: [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux
  2016-11-03 17:07   ` Yury Norov
@ 2016-11-03 20:13     ` Adhemerval Zanella
  0 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-03 20:13 UTC (permalink / raw)
  To: Yury Norov; +Cc: libc-alpha



On 03/11/2016 15:06, Yury Norov wrote:
>> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
>> index b3edee4..8fd7853 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
>> + 
> 
> Trailing whitespace

Ack, I fixed it in my local branch.

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

* Re: [PATCH v2 04/16] Use msgsnd syscall for Linux implementation
  2016-11-03 14:15   ` Yury Norov
@ 2016-11-03 20:27     ` Adhemerval Zanella
  0 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-03 20:27 UTC (permalink / raw)
  To: Yury Norov; +Cc: libc-alpha



On 03/11/2016 12:14, Yury Norov wrote:
> Hi Adhemerval,
> 
> On Wed, Nov 02, 2016 at 05:26:41PM -0200, Adhemerval Zanella wrote:
>> Changes from previous version:
>>
>>   - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
>>     wired syscall or the ipc one.
>>
>> --
>>
>> 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.
> 
> Typo?

Yeap, it is suppose to be 'Checked'.

> 
>>
>> 	* sysdeps/unix/sysv/linux/msgsnd.c (__libc_msgsnd): Use msgsnd syscall
>> 	if defined.
>> ---
>>  ChangeLog                        | 3 +++
>>  sysdeps/unix/sysv/linux/msgsnd.c | 7 ++++---
>>  2 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
>> index 1457e43..4ed3a64 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 <ipc_priv.h>
>> -
>>  #include <sysdep-cancel.h>
>> -#include <sys/syscall.h>
> 
> IIUC, ipc_priv.h is only needed if__ASSUME_SYSVIPC_SYSCALL is not
> defined.
> 
> Is sys/msg.h needed for __ASSUME_SYSVIPC_SYSCALL only? If so, it's
> better to #include kernel-features.h instead.
> 
> The same for other patches of series.

I see it would be simpler and usual to just include 'ipc_priv.h' 
regardless instead of adding inside the if '__ASSUME_SYSVIPC_SYSCALL'
brackets.

And although 'sys/msg.h' is not really required for this specific
file (since we are defining __libc_msgsnd and adding an alias), I
also think it is better to add the header for consistency.

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

* Re: [PATCH v2 02/16] Consolidate Linux msgctl implementation
  2016-11-02 19:27 ` [PATCH v2 02/16] Consolidate Linux msgctl implementation Adhemerval Zanella
@ 2016-11-04 15:33   ` Yury Norov
  2016-11-04 17:03     ` Adhemerval Zanella
  0 siblings, 1 reply; 35+ messages in thread
From: Yury Norov @ 2016-11-04 15:33 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Wed, Nov 02, 2016 at 05:26:39PM -0200, Adhemerval Zanella wrote:
> Changes from previous version:
> 
>   - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
>     wired syscall or the ipc one.
> 
> --
> 
> 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/msgctl.c: Remove file.
> 	* sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise.
> 	* sysdeps/unix/sysv/linux/microblaze/msgctl.c: 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                                    |  8 ++++++
>  sysdeps/unix/sysv/linux/alpha/msgctl.c       |  1 -
>  sysdeps/unix/sysv/linux/arm/msgctl.c         | 33 ----------------------
>  sysdeps/unix/sysv/linux/microblaze/msgctl.c  |  1 -
>  sysdeps/unix/sysv/linux/mips/mips64/msgctl.c | 17 ++---------
>  sysdeps/unix/sysv/linux/msgctl.c             | 42 +++++++++++++---------------
>  6 files changed, 30 insertions(+), 72 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

Hi Adhemerval, 

I'm testing your series with aarch64/ilp32 + LTP, and see regressions:
msgctl01                       FAIL       1
msgctl06                       FAIL       1
msgsnd01                       FAIL       1
semctl01                       FAIL       1
semctl07                       FAIL       1
semget01                       FAIL       1
shmat01                        FAIL       1
shmctl01                       FAIL       1
shmget01                       FAIL       1

Regarding msgctl. objdump for libc.so shows that syscall is generated
from stub in sysdeps/unix/sysv/linux/generic/syscalls.list.
000d0e80 <msgctl>:
#else

/* This is a "normal" system call stub: if there is an error,
   it returns -1 and sets errno.  */

T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
  d0e80:       d2801768        mov     x8, #0xbb
  // #187
  d0e84:       d4000001        svc     #0x0
  d0e88:       b13ffc1f        cmn     x0, #0xfff
  d0e8c:       54000042        b.cs    d0e94
<msgctl+0x14>
        ret
  d0e90:       d65f03c0        ret
T_PSEUDO_END (SYSCALL_SYMBOL)
  d0e94:       17fd194b        b
  173c0 <__GI___syscall_error>
  d0e98:       d503201f        nop
  d0e9c:       d503201f        nop

For aarch64/ilp32 to drop custom implementation, we need 
to force __IPC_64, and so remove stubs for msgctl, semctl and shmctl
to let glibc find proper implementation under sysv/linux.

The minimal fix for my regression is below. Though, I'm not sure that it's
complete, and that it will not affect other ports. BTW, grepping for
msgctl in syscalls.list files shows that they has outdated comment
which should be fixed in this series too - in arm, microblaze and mips64 ports.

# Semaphore and shm system calls.  msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).

Yury.

diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 5993ab4..459892d 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,15 +2,12 @@
 
 # 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
-semctl		-	semctl		i:iiii	__semctl	semctl
 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
 shmdt		-	shmdt		i:s	__shmdt		shmdt
 

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

* Re: [PATCH v2 02/16] Consolidate Linux msgctl implementation
  2016-11-04 15:33   ` Yury Norov
@ 2016-11-04 17:03     ` Adhemerval Zanella
  0 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-04 17:03 UTC (permalink / raw)
  To: Yury Norov; +Cc: libc-alpha



On 04/11/2016 13:33, Yury Norov wrote:
> On Wed, Nov 02, 2016 at 05:26:39PM -0200, Adhemerval Zanella wrote:
>> Changes from previous version:
>>
>>   - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
>>     wired syscall or the ipc one.
>>
>> --
>>
>> 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/msgctl.c: Remove file.
>> 	* sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise.
>> 	* sysdeps/unix/sysv/linux/microblaze/msgctl.c: 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                                    |  8 ++++++
>>  sysdeps/unix/sysv/linux/alpha/msgctl.c       |  1 -
>>  sysdeps/unix/sysv/linux/arm/msgctl.c         | 33 ----------------------
>>  sysdeps/unix/sysv/linux/microblaze/msgctl.c  |  1 -
>>  sysdeps/unix/sysv/linux/mips/mips64/msgctl.c | 17 ++---------
>>  sysdeps/unix/sysv/linux/msgctl.c             | 42 +++++++++++++---------------
>>  6 files changed, 30 insertions(+), 72 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
> 
> Hi Adhemerval, 
> 
> I'm testing your series with aarch64/ilp32 + LTP, and see regressions:
> msgctl01                       FAIL       1
> msgctl06                       FAIL       1
> msgsnd01                       FAIL       1
> semctl01                       FAIL       1
> semctl07                       FAIL       1
> semget01                       FAIL       1
> shmat01                        FAIL       1
> shmctl01                       FAIL       1
> shmget01                       FAIL       1
> 
> Regarding msgctl. objdump for libc.so shows that syscall is generated
> from stub in sysdeps/unix/sysv/linux/generic/syscalls.list.
> 000d0e80 <msgctl>:
> #else
> 
> /* This is a "normal" system call stub: if there is an error,
>    it returns -1 and sets errno.  */
> 
> T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
>   d0e80:       d2801768        mov     x8, #0xbb
>   // #187
>   d0e84:       d4000001        svc     #0x0
>   d0e88:       b13ffc1f        cmn     x0, #0xfff
>   d0e8c:       54000042        b.cs    d0e94
> <msgctl+0x14>
>         ret
>   d0e90:       d65f03c0        ret
> T_PSEUDO_END (SYSCALL_SYMBOL)
>   d0e94:       17fd194b        b
>   173c0 <__GI___syscall_error>
>   d0e98:       d503201f        nop
>   d0e9c:       d503201f        nop
> 
> For aarch64/ilp32 to drop custom implementation, we need 
> to force __IPC_64, and so remove stubs for msgctl, semctl and shmctl
> to let glibc find proper implementation under sysv/linux.
> 
> The minimal fix for my regression is below. Though, I'm not sure that it's
> complete, and that it will not affect other ports. BTW, grepping for
> msgctl in syscalls.list files shows that they has outdated comment
> which should be fixed in this series too - in arm, microblaze and mips64 ports.
> 
> # Semaphore and shm system calls.  msgctl, shmctl, and semctl have C
> # wrappers (to set __IPC_64).
> 
> Yury.
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
> index 5993ab4..459892d 100644
> --- a/sysdeps/unix/sysv/linux/generic/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
> @@ -2,15 +2,12 @@
>  
>  # 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
> -semctl		-	semctl		i:iiii	__semctl	semctl
>  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
>  shmdt		-	shmdt		i:s	__shmdt		shmdt

Yes, auto-generation syscall won't add the __IPC_64 required for
some architectures.  And that's why I have added in default 
implementation, since kernel will just ignore for architecture
that do not require it.

And I think by removing them from generic syscalls.list seems
reasonable, since for some architecture. I will change my
local branch accordingly.

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

* Re: [PATCH v2 12/16] Use shmat syscall for Linux implementation
  2016-11-02 19:27 ` [PATCH v2 12/16] Use shmat " Adhemerval Zanella
@ 2016-11-07 11:02   ` Arnd Bergmann
  2016-11-07 13:10     ` Adhemerval Zanella
  0 siblings, 1 reply; 35+ messages in thread
From: Arnd Bergmann @ 2016-11-07 11:02 UTC (permalink / raw)
  To: libc-alpha; +Cc: Adhemerval Zanella

On Wednesday, November 2, 2016 5:26:49 PM CET Adhemerval Zanella wrote:
> @@ -31,17 +28,19 @@
>  void *
>  shmat (int shmid, const void *shmaddr, int shmflg)
>  {
> +#ifdef __ASSUME_SYSVIPC_SYSCALL
> +  return INLINE_SYSCALL_CALL (shmat, shmid, shmaddr, shmflg);
> +#else
>    INTERNAL_SYSCALL_DECL(err);
>    unsigned long resultvar;
>    void *raddr;
> 

I looked at the cross-reference for system call tables and found
that alpha does not define __NR_shmat but instead has __NR_osf_shmat

Will that get handled correctly by your code?

	Arnd

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

* Re: [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux
  2016-11-02 19:27 ` [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux Adhemerval Zanella
  2016-11-02 21:10   ` Joseph Myers
  2016-11-03 17:07   ` Yury Norov
@ 2016-11-07 11:28   ` Arnd Bergmann
  2016-11-07 13:17     ` Adhemerval Zanella
  2 siblings, 1 reply; 35+ messages in thread
From: Arnd Bergmann @ 2016-11-07 11:28 UTC (permalink / raw)
  To: libc-alpha; +Cc: Adhemerval Zanella

On Wednesday, November 2, 2016 5:26:38 PM CET Adhemerval Zanella wrote:

> 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.

If you want to mention the architectures not supported by glibc, this
also includes

cris, frv, m32r, and mn10300

> And the architectures that only supports wired syscalls are:
>   - aarch64, alpha, hppa, ia64, mips64, mips64n32, nios2, tile
>     (tilepro, tilegx, and tilegx64), and x86_64

similarly, this also includes

arc, avr32, blackfin, c6x, h8300, hexagon, metag, openrisc, score,
unicore32, and xtensa
 
> Also arm is the only one that supports both wire syscalls and the
> ipc, although the ipc one is deprecated.

AFAICT, ipc syscall on ARM is only defined for OABI, which glibc
no longer has.

From the kernel sources, I also see sh64 and microblaze define
both __NR_ipc and the individual numbers, although microblaze
returns -ENOSYS for ipc().

> 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.

We might add the individual syscalls on all architectures at some point
in the kernel, including the ones that currently use the combined
ipc call. A patch series for this has been discussed in the past,
but I think we never fully resolved the handling of the IPC_64
flag, so it did not get merged so far.

With your current approach, this won't cause problems as architectures
that don't have the individual calls with old kernel versions will
still use the ipc() wrapper in the kernel.


	Arnd

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

* Re: [PATCH v2 12/16] Use shmat syscall for Linux implementation
  2016-11-07 11:02   ` Arnd Bergmann
@ 2016-11-07 13:10     ` Adhemerval Zanella
  0 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-07 13:10 UTC (permalink / raw)
  To: Arnd Bergmann, libc-alpha

On 07/11/2016 09:02, Arnd Bergmann wrote:
> On Wednesday, November 2, 2016 5:26:49 PM CET Adhemerval Zanella wrote:
>> @@ -31,17 +28,19 @@
>>  void *
>>  shmat (int shmid, const void *shmaddr, int shmflg)
>>  {
>> +#ifdef __ASSUME_SYSVIPC_SYSCALL
>> +  return INLINE_SYSCALL_CALL (shmat, shmid, shmaddr, shmflg);
>> +#else
>>    INTERNAL_SYSCALL_DECL(err);
>>    unsigned long resultvar;
>>    void *raddr;
>>
> 
> I looked at the cross-reference for system call tables and found
> that alpha does not define __NR_shmat but instead has __NR_osf_shmat
> 
> Will that get handled correctly by your code?
> 
> 	Arnd

No, but at least it does not prevent alpha build since it uses
the syscalls.list instead.  However adjusting it should be simple,
it would be something like __NR_fadvise64_64 for arm (where it
should be __NR_arm_fadvise64_64 and it is handled on
kernel-features.h).

I tried to avoid remove the syscalls.list usage for architecture
that is already using it, but thinking twice for consolidation idea
it would be better to have all architecture to use only a simple
syscall generation mechanism for a syscall. I will add it on the
patch and send a v3.

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

* Re: [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux
  2016-11-07 11:28   ` Arnd Bergmann
@ 2016-11-07 13:17     ` Adhemerval Zanella
  0 siblings, 0 replies; 35+ messages in thread
From: Adhemerval Zanella @ 2016-11-07 13:17 UTC (permalink / raw)
  To: Arnd Bergmann, libc-alpha



On 07/11/2016 09:28, Arnd Bergmann wrote:
> On Wednesday, November 2, 2016 5:26:38 PM CET Adhemerval Zanella wrote:
> 
>> 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.
> 
> If you want to mention the architectures not supported by glibc, this
> also includes
> 
> cris, frv, m32r, and mn10300
> 

I think for commit/code comment mentioning only the supported archs
should be suffice.

>> And the architectures that only supports wired syscalls are:
>>   - aarch64, alpha, hppa, ia64, mips64, mips64n32, nios2, tile
>>     (tilepro, tilegx, and tilegx64), and x86_64
> 
> similarly, this also includes
> 
> arc, avr32, blackfin, c6x, h8300, hexagon, metag, openrisc, score,
> unicore32, and xtensa
>  
>> Also arm is the only one that supports both wire syscalls and the
>> ipc, although the ipc one is deprecated.
> 
> AFAICT, ipc syscall on ARM is only defined for OABI, which glibc
> no longer has.

Indeed, I think I should note that glibc's supported arm eabi should
use wire syscalls (although for a source standpoint it will still
see __NR_ipc defined).

> 
> From the kernel sources, I also see sh64 and microblaze define
> both __NR_ipc and the individual numbers, although microblaze
> returns -ENOSYS for ipc().

Indeed, in my first analysis I did not filter 'sys_ni_syscall' while
checking the syscall table in kernel files.  With this checked 
microblaze should that ipc is defined as 'sys_ni_syscall'.

> 
>> 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.
> 
> We might add the individual syscalls on all architectures at some point
> in the kernel, including the ones that currently use the combined
> ipc call. A patch series for this has been discussed in the past,
> but I think we never fully resolved the handling of the IPC_64
> flag, so it did not get merged so far.
> 
> With your current approach, this won't cause problems as architectures
> that don't have the individual calls with old kernel versions will
> still use the ipc() wrapper in the kernel.
> 

That's the idea and if a architecture eventually adds wire ipc support
it just need to correct undefine __ASSUME_SYSVIPC_SYSCALL within correct
kernel header version.

> 
> 	Arnd
> 

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

end of thread, other threads:[~2016-11-07 13:17 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-02 19:27 [PATCH v2 00/16] Consolidate Linux sysvipc implementation Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 08/16] Use semget syscall for Linux implementation Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 07/16] Consolidate Linux semctl implementation Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 06/16] Add SYSV message queue test Adhemerval Zanella
2016-11-03 17:09   ` Yury Norov
2016-11-03 20:12     ` Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 16/16] Add SYSV shared memory test Adhemerval Zanella
2016-11-03 17:14   ` Yury Norov
2016-11-02 19:27 ` [PATCH v2 14/16] Use shmdt syscall for linux implementation Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 03/16] Consolidate Linux msgrcv implementation Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 04/16] Use msgsnd syscall for Linux implementation Adhemerval Zanella
2016-11-03 14:15   ` Yury Norov
2016-11-03 20:27     ` Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 12/16] Use shmat " Adhemerval Zanella
2016-11-07 11:02   ` Arnd Bergmann
2016-11-07 13:10     ` Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 13/16] Consolidate Linux shmctl implementation Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 01/16] Add __ASSUME_SYSVIPC_SYSCALL for Linux Adhemerval Zanella
2016-11-02 21:10   ` Joseph Myers
2016-11-02 22:27     ` Adhemerval Zanella
2016-11-02 22:34       ` Adhemerval Zanella
2016-11-03 17:07   ` Yury Norov
2016-11-03 20:13     ` Adhemerval Zanella
2016-11-07 11:28   ` Arnd Bergmann
2016-11-07 13:17     ` Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 05/16] Use msgget syscall for Linux implementation Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 11/16] Add SYSV semaphore test Adhemerval Zanella
2016-11-03 17:10   ` Yury Norov
2016-11-03 20:11     ` Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 02/16] Consolidate Linux msgctl implementation Adhemerval Zanella
2016-11-04 15:33   ` Yury Norov
2016-11-04 17:03     ` Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 09/16] Use semop syscall for Linux implementation Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 10/16] Consolidate Linux semtimedop implementation Adhemerval Zanella
2016-11-02 19:27 ` [PATCH v2 15/16] Use shmget syscall for linux implementation 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).