]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Consolidate Linux msgctl implementation
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 25 Oct 2016 22:38:37 +0000 (20:38 -0200)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 28 Dec 2016 22:28:56 +0000 (20:28 -0200)
This patch consolidates the msgctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/msgctl.c.  If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.

The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.

Checked on x86_64, i686, powerpc64le, aarch64, and armhf.

* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldmsgctl.
* sysdeps/unix/sysv/linux/alpha/msgctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/msgctl.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (oldmsgctl): Remove.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/msgctl.c: Use default
implementation.
* sysdeps/unix/sysv/linux/msgctl.c (__new_msgctl): Use msgctl syscall
if defined.

13 files changed:
ChangeLog
sysdeps/unix/sysv/linux/alpha/Makefile
sysdeps/unix/sysv/linux/alpha/msgctl.c [deleted file]
sysdeps/unix/sysv/linux/alpha/syscalls.list
sysdeps/unix/sysv/linux/arm/msgctl.c [deleted file]
sysdeps/unix/sysv/linux/generic/syscalls.list
sysdeps/unix/sysv/linux/hppa/syscalls.list
sysdeps/unix/sysv/linux/ia64/syscalls.list
sysdeps/unix/sysv/linux/microblaze/msgctl.c [deleted file]
sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
sysdeps/unix/sysv/linux/msgctl.c
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
sysdeps/unix/sysv/linux/x86_64/syscalls.list

index 4ba8fee56a6bcfdc640cc753cba13259741aa49b..99112e9fb8a06b08b797ed5a4c3421976f795bcc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2016-12-28  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+       * sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
+       oldmsgctl.
+       * sysdeps/unix/sysv/linux/alpha/msgctl.c: Remove file.
+       * sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise.
+       * sysdeps/unix/sysv/linux/microblaze/msgctl.c: Likewise.
+       * sysdeps/unix/sysv/linux/alpha/syscalls.list (oldmsgctl): Remove.
+       * sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
+       * sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
+       * sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
+       * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
+       Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise.
+       * sysdeps/unix/sysv/linux/mips/mips64/msgctl.c: Use default
+       implementation.
+       * sysdeps/unix/sysv/linux/msgctl.c (__new_msgctl): Use msgctl syscall
+       if defined.
+
        * sysdeps/unix/sysv/linux/aarch64/ipc_priv.h: New file.
        * sysdeps/unix/sysv/linux/alpha/ipc_priv.h: Avoid included other arch
        definition and define its own.
index 45941b0a3d1a3d1dd3470a912e7d725be19cf0af..c24dc2e900dac117a81ce52b27384b476fa27d24 100644 (file)
@@ -18,7 +18,7 @@ sysdep_routines += osf_select osf_gettimeofday osf_settimeofday \
                   osf_getrusage osf_wait4
 
 # Support old ipc control
-sysdep_routines += oldmsgctl oldsemctl oldshmctl
+sysdep_routines += oldsemctl oldshmctl
 
 CFLAGS-ioperm.c = -Wa,-mev6
 endif
diff --git a/sysdeps/unix/sysv/linux/alpha/msgctl.c b/sysdeps/unix/sysv/linux/alpha/msgctl.c
deleted file mode 100644 (file)
index d65a5b9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/msgctl.c>
index 0c9efcbdf1b774f9b010c27cf3a00ba7cada2211..f82c9da691e4f52f9fc2c17f3d9d398d2495dcff 100644 (file)
@@ -1,6 +1,5 @@
 # File name    Caller  Syscall name    # args  Strong name     Weak names
 
-oldmsgctl      EXTRA   msgctl          i:iip   __old_msgctl    msgctl@GLIBC_2.0
 msgget         -       msgget          i:ii    __msgget        msgget
 msgrcv         -       msgrcv          Ci:ibnii __msgrcv       msgrcv
 msgsnd         -       msgsnd          Ci:ibni __msgsnd        msgsnd
diff --git a/sysdeps/unix/sysv/linux/arm/msgctl.c b/sysdeps/unix/sysv/linux/arm/msgctl.c
deleted file mode 100644 (file)
index 83c6744..0000000
+++ /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);
index 5993ab4a4715977e11b1083f720d871edfa93d73..dea452b606fd53063d0b12d203139c209f9172b1 100644 (file)
@@ -2,7 +2,6 @@
 
 # SysV APIs
 msgget         -       msgget          i:ii    __msgget        msgget
-msgctl         -       msgctl          i:iip   __msgctl        msgctl
 msgrcv         -       msgrcv          Ci:ibnii __msgrcv       msgrcv
 msgsnd         -       msgsnd          Ci:ibni __msgsnd        msgsnd
 semget         -       semget          i:iii   __semget        semget
index a95c3ddf18b6f33ad6e07634f38feec7d15ecb0a..ead0e993f38775dfe05a468cff4feff1a3fc60c5 100644 (file)
@@ -1,7 +1,6 @@
 # File name    Caller  Syscall name    # args  Strong name     Weak names
 
 # semaphore and shm system calls
-msgctl         -       msgctl          i:iip   __msgctl        msgctl
 msgget         -       msgget          i:ii    __msgget        msgget
 msgrcv         -       msgrcv          Ci:ibnii __msgrcv       msgrcv
 msgsnd         -       msgsnd          Ci:ibni __msgsnd        msgsnd
index 68b6c9ab8ae99149f7d5b1b0c0781e61b7bba357..8a66ca95dd3e4023b85f31f8e305c62b6ceb22d7 100644 (file)
@@ -5,7 +5,6 @@ umount2         -       umount          2       __umount2       umount2
 getpriority    -       getpriority     i:ii    __getpriority   getpriority
 
 # semaphore and shm system calls
-msgctl         -       msgctl          i:iip   __msgctl        msgctl
 msgget         -       msgget          i:ii    __msgget        msgget
 msgrcv         -       msgrcv          Ci:ibnii __msgrcv       msgrcv
 msgsnd         -       msgsnd          Ci:ibni __msgsnd        msgsnd
diff --git a/sysdeps/unix/sysv/linux/microblaze/msgctl.c b/sysdeps/unix/sysv/linux/microblaze/msgctl.c
deleted file mode 100644 (file)
index d65a5b9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/msgctl.c>
index c4dc7ff4c8fdcfaa858f3653328dfc899fdfce9c..928c3dc5878b744aa88c44f06df4e2b5bfa823f3 100644 (file)
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <sys/msg.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
+#include <shlib-compat.h>
 
-int __msgctl (int msqid, int cmd, struct msqid_ds *buf);
+#undef SHLIB_COMPAT
+#define SHLIB_COMPAT(a, b, c) 0
 
-int
-__msgctl (int msqid, int cmd, struct msqid_ds *buf)
-{
-  return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, buf);
-}
+#define DEFAULT_VERSION GLIBC_2_0
 
-#include <shlib-compat.h>
-versioned_symbol (libc, __msgctl, msgctl, GLIBC_2_0);
+#include <sysdeps/unix/sysv/linux/msgctl.c>
index e48fbb3d11987af992851cff86df1fedcf6b1432..45bf3500cd95c0c4fe32dbb6c861e85fcf3357cd 100644 (file)
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
 #include <sys/msg.h>
 #include <ipc_priv.h>
-
 #include <sysdep.h>
-#include <string.h>
-#include <sys/syscall.h>
 #include <shlib-compat.h>
+#include <errno.h>
+
+#ifndef DEFAULT_VERSION
+# define DEFAULT_VERSION GLIBC_2_2
+#endif
+
+int
+__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
+{
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+  return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf);
+#else
+  return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd | __IPC_64, 0,
+                             buf);
+#endif
+}
+versioned_symbol (libc, __new_msgctl, msgctl, DEFAULT_VERSION);
 
-#include <kernel-features.h>
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
 struct __old_msqid_ds
 {
   struct __old_ipc_perm msg_perm;      /* structure describing operation permission */
@@ -44,27 +57,15 @@ struct __old_msqid_ds
   __ipc_pid_t msg_lrpid;               /* pid of last msgrcv() */
 };
 
-/* Allows to control internal state and destruction of message queue
-   objects.  */
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
-int __old_msgctl (int, int, struct __old_msqid_ds *);
-#endif
-int __new_msgctl (int, int, struct msqid_ds *);
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
 int
 attribute_compat_text_section
 __old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
 {
-  return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, buf);
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+  return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf);
+#else
+  return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf);
+#endif
 }
 compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
 #endif
-
-int
-__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
-{
-  return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd | __IPC_64, 0, buf);
-}
-
-versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2);
index 9f03d26feadc7608c4737eedb8f0fef1327a44eb..808cbbb6813dc500c683fbb2c06f7a030badf008 100644 (file)
@@ -1,7 +1,6 @@
 # File name    Caller  Syscall name    # args  Strong name     Weak names
 
 # semaphore and shm system calls
-msgctl         -       msgctl          i:iip   __msgctl        msgctl
 msgget         -       msgget          i:ii    __msgget        msgget
 msgrcv         -       msgrcv          Ci:ibnii __msgrcv       msgrcv
 msgsnd         -       msgsnd          Ci:ibni __msgsnd        msgsnd
index 8aed2f4635103cd06c89fc9e4fb3520f20574921..4d19d75b4e736ac1b2220ed08e9472424e5117a5 100644 (file)
@@ -2,7 +2,6 @@
 
 arch_prctl     EXTRA   arch_prctl      i:ii    __arch_prctl    arch_prctl
 modify_ldt     EXTRA   modify_ldt      i:ipi   __modify_ldt    modify_ldt
-msgctl         -       msgctl          i:iip   __msgctl        msgctl
 msgget         -       msgget          i:ii    __msgget        msgget
 msgrcv         -       msgrcv          Ci:ibnii __msgrcv       msgrcv
 msgsnd         -       msgsnd          Ci:ibni __msgsnd        msgsnd