From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36606 invoked by alias); 1 Nov 2016 14:25:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 36391 invoked by uid 89); 1 Nov 2016 14:25:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=19952016, 1995-2016, 1617, 1518 X-HELO: mail-vk0-f42.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=QUsdXX0vO/4cQnQ4NxcPAKTBqMbLPflZUA7FqCLzins=; b=Fty/gQrmmPoeodteuGXKZHbP3TqFDNzcYbYS70T+MzyqureqUHZMWtzPmwuoQj1PWI dUtVsW8tOG30h5E9/9q/RxA4375slot+/wQVxwUM7VEDx5Mitq/zO37mYXM7PIECbq0P /MnR5ZS8pqy4Ti3a63rxP/AIXisqFfMEWfXurcJqKV2Bogk/2C9f0SVG1oJyYdLOq6rA 7gRm6H+n/13ZuLf+Y7wJkJMprLFD/pLn1I9cOl6LgVKjrHYrMbJM2D0gaiTXdn4s7ndh YA1HpvC/ODIxMwpADvj89tyGPANl+pehacSWWwiKXJrW4NjG+EZFoC2qz3aDC6lTV6h2 KOPQ== X-Gm-Message-State: ABUngvcVXvd/D1rAsTU1pXG3mN8k1qdkH1u0qarQU7vNOHQn5rjdcl8nEr8bXHOwUOIs5uX7 X-Received: by 10.31.53.75 with SMTP id c72mr27900899vka.111.1478010331699; Tue, 01 Nov 2016 07:25:31 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 01/15] Consolidate Linux msgctl implementation Date: Tue, 01 Nov 2016 14:25:00 -0000 Message-Id: <1478010323-13076-2-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1478010323-13076-1-git-send-email-adhemerval.zanella@linaro.org> References: <1478010323-13076-1-git-send-email-adhemerval.zanella@linaro.org> X-SW-Source: 2016-11/txt/msg00023.txt.bz2 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 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 , 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 - . */ - -#include -#include -#include -#include -#include - - -int -__new_msgctl (int msqid, int cmd, struct msqid_ds *buf) -{ - return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, buf); -} - -#include -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 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 . */ -#include -#include -#include -#include - -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 -versioned_symbol (libc, __msgctl, msgctl, GLIBC_2_0); +#define DEFAULT_VERSION GLIBC_2_0 +#include 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 . */ -#include #include #include - #include -#include -#include #include +#include + +#ifndef DEFAULT_VERSION +# define DEFAULT_VERSION GLIBC_2_2 +#endif -#include +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