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: 80358 Delivered-To: patch@linaro.org Received: by 10.80.142.83 with SMTP id 19csp677930edx; Tue, 1 Nov 2016 07:26:48 -0700 (PDT) X-Received: by 10.98.102.84 with SMTP id a81mr59626533pfc.176.1478010407906; Tue, 01 Nov 2016 07:26:47 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id m21si9370132pgc.29.2016.11.01.07.26.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 07:26:47 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-74261-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-74261-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-74261-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org 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=QtL1wE6C2KQNdy3VcP/qOKakoQyGanD 29pmJF2lhu5iAAO1tloXDfPzyfykPcz+CkZ+DKKfDhN7fKKJ3P+7xarPgQh/5eGV 576lTz1fYIM++dJcj4gOi7RQwsvdgWD9hr5RNqgx3YJ5k+OcPn2zv9qOPch3RW6G E60I0QZD+7fU= 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=JyxfB YQvp5CVZM6oVhmqpz5ud+cyf3kH4/dQ9OIuOlJGZM91FTyhAGfiGA8WnDW539JF/ HV6yiTLdXBkz4H878mUmdZ3l7XyOzh2ZQ1BIDj2yn7rxXBfRGiCX7vsCLJG7iOOY 8MoIbSyU2khB9fR5C0fRk398OHBWlvFtALr2bA= 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 -- 2.7.4 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);