From patchwork Tue Nov 1 14:25:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 689921 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3t7YT06S7wz9t2T for ; Wed, 2 Nov 2016 01:26:44 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=s2JJVZ7C; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=y342qfmZw+Occh4AKNbB87qkqEk1QPk PqBbfKEcfhhabL/4QuM6w4Y6HPb6AEsLKJsvievt6XcxUMil4FUb/YgVRNJblIP9 8lujG/8ySHlJOT1qjHnOpwWHv/kX4HB4enDn2dh7Q2TKdVzNESfcwVNt2ahY8qW5 VGUkdc6kQy18= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=GXQGhgWt3DT4Of79GqwkQnsp98Y=; b=s2JJV Z7C5SvOIRcL85NGd2ZDFyDSYyFzjE8JZHKX9ZbVk+rKvw2Iut9S3ajmOICo/edHU 530QxloXWZHDa5aGGz5ePyOZ4SOz0w/1Vnf4dwZ/XpP5xN62E0dl51gWp2p5IKWA ea6LkRbH/3bh8Ja3qOvnoYijxfmIzK2ZK5XewY= 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-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@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, 1 Nov 2016 12:25:09 -0200 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> 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);