public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 05/15] Add SYSV message queue test
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (6 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 08/15] Use semop syscall for Linux implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 12/15] Consolidate Linux shmctl implementation Adhemerval Zanella
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

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

* [PATCH 04/15] Use msgget syscall for Linux implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (3 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 15/15] Add SYSV shared memory test Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 06/15] Consolidate Linux semctl implementation Adhemerval Zanella
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

This patch add a direct call to msgget syscall if it is defined by
kernel headers.

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..07da793 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 __NR_msgget
+  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] 21+ messages in thread

* [PATCH 13/15] Use shmdt syscall for linux implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (11 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 10/15] Add SYSV semaphore test Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 07/15] Use semget syscall for Linux implementation Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 03/15] Use msgsnd " Adhemerval Zanella
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

this patch add a direct call to shmdt syscall if it is defined by
kernel headers.

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..da5a881 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 __NR_shmdt
+  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] 21+ messages in thread

* [PATCH 10/15] Add SYSV semaphore test
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (10 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 02/15] Consolidate Linux msgrcv implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 13/15] Use shmdt syscall for linux implementation Adhemerval Zanella
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

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

* [PATCH 01/15] Consolidate Linux msgctl implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 14/15] Use shmget syscall for linux implementation Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 09/15] Consolidate Linux semtimedop implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 15/15] Add SYSV shared memory test Adhemerval Zanella
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

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 defined, 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                                    | 10 +++++++
 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, 32 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..d5be689 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 __NR_msgctl
+  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] 21+ messages in thread

* [PATCH 02/15] Consolidate Linux msgrcv implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (9 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 11/15] Use shmat syscall for Linux implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 10/15] Add SYSV semaphore test Adhemerval Zanella
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

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 defined, 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..53e6332 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 __NR_msgrcv
+  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] 21+ messages in thread

* [PATCH 09/15] Consolidate Linux semtimedop implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 14/15] Use shmget syscall for linux implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 01/15] Consolidate Linux msgctl implementation Adhemerval Zanella
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

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 defined, 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..9a6d010 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 __NR_semtimedop
+  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] 21+ messages in thread

* [PATCH 00/15] Consolidate Linux sysvipc implementation
@ 2016-11-01 14:25 Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 14/15] Use shmget syscall for linux implementation Adhemerval Zanella
                   ` (14 more replies)
  0 siblings, 15 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

Hi all,

Theis 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 (15):
  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                                      |  68 +++++++++++++
 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/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/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/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/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/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 +
 34 files changed, 583 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] 21+ messages in thread

* [PATCH 06/15] Consolidate Linux semctl implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (4 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 04/15] Use msgget syscall for Linux implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 08/15] Use semop syscall for Linux implementation Adhemerval Zanella
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

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 defined, 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

diff --git a/sysdeps/unix/sysv/linux/alpha/semctl.c b/sysdeps/unix/sysv/linux/alpha/semctl.c
deleted file mode 100644
index 4cb834a..0000000
--- a/sysdeps/unix/sysv/linux/alpha/semctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/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..c170681 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 __NR_semctl
+  return INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd, 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] 21+ messages in thread

* [PATCH 03/15] Use msgsnd syscall for Linux implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (13 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 07/15] Use semget syscall for Linux implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

This patch add a direct call to msgsnd syscall if it is defined by
kernel headers.

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..2928493 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 __NR_msgsnd
+  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] 21+ messages in thread

* [PATCH 11/15] Use shmat syscall for Linux implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (8 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 12/15] Consolidate Linux shmctl implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 02/15] Consolidate Linux msgrcv implementation Adhemerval Zanella
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

This patch add a direct call to shmat syscall if it is defined by
kernel headers.

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..b247db9 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 __NR_shmat
+  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] 21+ messages in thread

* [PATCH 07/15] Use semget syscall for Linux implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (12 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 13/15] Use shmdt syscall for linux implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 15:34   ` Andreas Schwab
  2016-11-01 14:25 ` [PATCH 03/15] Use msgsnd " Adhemerval Zanella
  14 siblings, 1 reply; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

This patch add a direct call to semget syscall if it is defined by
kernel headers.

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..739346b 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 __NR_semget
+  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] 21+ messages in thread

* [PATCH 14/15] Use shmget syscall for linux implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 09/15] Consolidate Linux semtimedop implementation Adhemerval Zanella
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

this patch add a direct call to shmget syscall if it is defined by
kernel headers.

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..7024fc4 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 __NR_shmget
+  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] 21+ messages in thread

* [PATCH 08/15] Use semop syscall for Linux implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (5 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 06/15] Consolidate Linux semctl implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 05/15] Add SYSV message queue test Adhemerval Zanella
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

This patch add a direct call to semop syscall if it is defined 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..1c27539 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 __NR_semop
+  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] 21+ messages in thread

* [PATCH 12/15] Consolidate Linux shmctl implementation
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (7 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 05/15] Add SYSV message queue test Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 11/15] Use shmat syscall for Linux implementation Adhemerval Zanella
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

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 defined, 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..43e4075 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 __NR_shmctl
+  return INLINE_SYSCALL_CALL (shmctl, shmid, cmd, 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] 21+ messages in thread

* [PATCH 15/15] Add SYSV shared memory test
  2016-11-01 14:25 [PATCH 00/15] Consolidate Linux sysvipc implementation Adhemerval Zanella
                   ` (2 preceding siblings ...)
  2016-11-01 14:25 ` [PATCH 01/15] Consolidate Linux msgctl implementation Adhemerval Zanella
@ 2016-11-01 14:25 ` Adhemerval Zanella
  2016-11-01 14:25 ` [PATCH 04/15] Use msgget syscall for Linux implementation Adhemerval Zanella
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 14:25 UTC (permalink / raw)
  To: libc-alpha

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

* Re: [PATCH 07/15] Use semget syscall for Linux implementation
  2016-11-01 14:25 ` [PATCH 07/15] Use semget syscall for Linux implementation Adhemerval Zanella
@ 2016-11-01 15:34   ` Andreas Schwab
  2016-11-01 16:41     ` Joseph Myers
  0 siblings, 1 reply; 21+ messages in thread
From: Andreas Schwab @ 2016-11-01 15:34 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Nov 01 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> This patch add a direct call to semget syscall if it is defined by
> kernel headers.

That does not mean that the running kernel provides it.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH 07/15] Use semget syscall for Linux implementation
  2016-11-01 15:34   ` Andreas Schwab
@ 2016-11-01 16:41     ` Joseph Myers
  2016-11-01 17:17       ` Adhemerval Zanella
  0 siblings, 1 reply; 21+ messages in thread
From: Joseph Myers @ 2016-11-01 16:41 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Adhemerval Zanella, libc-alpha

On Tue, 1 Nov 2016, Andreas Schwab wrote:

> On Nov 01 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> 
> > This patch add a direct call to semget syscall if it is defined by
> > kernel headers.
> 
> That does not mean that the running kernel provides it.

Specifically, this sort of patch series needs to be accompanied by an 
analysis of when the relevant syscalls were added for each supported 
architecture (and subarchitecture for cases with multiple syscall tables 
for different ABNs).  If present (in the syscall table as well as in 
asm/unistd.h) in the minimum kernel version, OK, otherwise you need 
appropriate __ASSUME_* conditionals (even if not present in the latest 
kernel, it might be added in future, so you should have those conditionals 
now to avoid breaking things when current glibc is compiled with future 
kernel headers).

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH 07/15] Use semget syscall for Linux implementation
  2016-11-01 16:41     ` Joseph Myers
@ 2016-11-01 17:17       ` Adhemerval Zanella
  2016-11-01 17:28         ` Zack Weinberg
  2016-11-01 17:35         ` Joseph Myers
  0 siblings, 2 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2016-11-01 17:17 UTC (permalink / raw)
  To: Joseph Myers, Andreas Schwab; +Cc: libc-alpha



On 01/11/2016 14:40, Joseph Myers wrote:
> On Tue, 1 Nov 2016, Andreas Schwab wrote:
> 
>> On Nov 01 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
>>
>>> This patch add a direct call to semget syscall if it is defined by
>>> kernel headers.
>>
>> That does not mean that the running kernel provides it.
> 
> Specifically, this sort of patch series needs to be accompanied by an 
> analysis of when the relevant syscalls were added for each supported 
> architecture (and subarchitecture for cases with multiple syscall tables 
> for different ABNs).  If present (in the syscall table as well as in 
> asm/unistd.h) in the minimum kernel version, OK, otherwise you need 
> appropriate __ASSUME_* conditionals (even if not present in the latest 
> kernel, it might be added in future, so you should have those conditionals 
> now to avoid breaking things when current glibc is compiled with future 
> kernel headers).

Indeed, I did not consider the case of latest kernel headers.  Based
on current Linux approach and historical implementation for sysv IPC
I think we can assume that either the kernel only supports the old
'ipc' syscall or all the sysvipc syscall wire-up.  Do you know if we
do require an __ASSUME for each syscall?

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

* Re: [PATCH 07/15] Use semget syscall for Linux implementation
  2016-11-01 17:17       ` Adhemerval Zanella
@ 2016-11-01 17:28         ` Zack Weinberg
  2016-11-01 17:35         ` Joseph Myers
  1 sibling, 0 replies; 21+ messages in thread
From: Zack Weinberg @ 2016-11-01 17:28 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: Joseph Myers, Andreas Schwab, GNU C Library

On Tue, Nov 1, 2016 at 1:16 PM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> On 01/11/2016 14:40, Joseph Myers wrote:
>> On Tue, 1 Nov 2016, Andreas Schwab wrote:
>>
>>> On Nov 01 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
>>>
>>>> This patch add a direct call to semget syscall if it is defined by
>>>> kernel headers.
>>>
>>> That does not mean that the running kernel provides it.
>>
>> Specifically, this sort of patch series needs to be accompanied by an
>> analysis of when the relevant syscalls were added for each supported
>> architecture (and subarchitecture for cases with multiple syscall tables
>> for different ABNs).  If present (in the syscall table as well as in
>> asm/unistd.h) in the minimum kernel version, OK, otherwise you need
>> appropriate __ASSUME_* conditionals (even if not present in the latest
>> kernel, it might be added in future, so you should have those conditionals
>> now to avoid breaking things when current glibc is compiled with future
>> kernel headers).
>
> Indeed, I did not consider the case of latest kernel headers.  Based
> on current Linux approach and historical implementation for sysv IPC
> I think we can assume that either the kernel only supports the old
> 'ipc' syscall or all the sysvipc syscall wire-up.  Do you know if we
> do require an __ASSUME for each syscall?

It wouldn't have made sense to add direct syscalls for some but not
all of the APIs that were multiplexed, so I would think one __ASSUME
is enough.

zw

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

* Re: [PATCH 07/15] Use semget syscall for Linux implementation
  2016-11-01 17:17       ` Adhemerval Zanella
  2016-11-01 17:28         ` Zack Weinberg
@ 2016-11-01 17:35         ` Joseph Myers
  1 sibling, 0 replies; 21+ messages in thread
From: Joseph Myers @ 2016-11-01 17:35 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: Andreas Schwab, libc-alpha

On Tue, 1 Nov 2016, Adhemerval Zanella wrote:

> Indeed, I did not consider the case of latest kernel headers.  Based
> on current Linux approach and historical implementation for sysv IPC
> I think we can assume that either the kernel only supports the old
> 'ipc' syscall or all the sysvipc syscall wire-up.  Do you know if we
> do require an __ASSUME for each syscall?

If your analysis shows that all the syscalls were always wired up (in both 
places, syscall table and asm/unistd.h) at the same time, you can just use 
a single __ASSUME (or if by mistake some architectures were only partially 
wired up, you could still use a single __ASSUME if it's conservatively 
safe).

-- 
Joseph S. Myers
joseph@codesourcery.com

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

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

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