From patchwork Wed Nov 2 19:26:39 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: 80532 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp291276qge; Wed, 2 Nov 2016 12:27:53 -0700 (PDT) X-Received: by 10.99.156.10 with SMTP id f10mr8097909pge.123.1478114873528; Wed, 02 Nov 2016 12:27:53 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 9si4760555pfw.3.2016.11.02.12.27.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Nov 2016 12:27:53 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-74318-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-74318-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-74318-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=NOpO5siZoFoiBTg3rieArFR3SgFxOM0 0yrLzH7lTMsCaWvZPBAESXo/JcnmjoryKVy1G/6Ry8HG9KtxrQQtCk35zcEey0Dd IK81mug2sDpMnNKScQW0KXd78LS7qBPE4kx9Khti1lsur/QNdqWCa3KUzHuf28ii sISmV2YWfarg= 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=ZzToqkp0i/Q5Lrf27Y9oYHbfdls=; b=blUBf OwXVTg5GGWwI/VbhCrknIYmLJQAXEzgwTol5XHa3NHw530IfVN96d+87m/5wZvjZ Aerdlb/8rrEXtY38aNffTO+eTROUI1Tqp3X+ButpXQJJh5L+8E8W2HlIDXQ90o7m qd5LoXnx1I7vL5WcxE/e3NvK7JTny4lFLmROp8= Received: (qmail 64378 invoked by alias); 2 Nov 2016 19:27:16 -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 64230 invoked by uid 89); 2 Nov 2016 19:27:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=H*MI:sk:1478114 X-HELO: mail-vk0-f54.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=lQEcl+/f/MrSy1TC2mcy9S09zAV2OFVBe8SVGCTQk7U=; b=kVFZIQ9vOMsg4NcoUgx71gQeZvtyxdUNc4372lalxe90u1uq2etsZunlAoBPRfj34I EKezaCgDbbgwQj4reBSlNs6LJ7p5+c+ZjfSGJG3O9/iVJXDb3evOc/w0zjvmWQ//xLJq UMaudSR3xraMqOae8pw5kOK0aqlJzTSRNQz7buKy1kJU2RHDbpy9a5EdRq4OrNUFLDYH PUCdXYBrb74xt0rZpgaZF5xZHggcrdkr41a6DoZDseDKWr6o0laDSaTLdlrDI93Wk5qt 0NI0rxZvzDXzvLiphSqU3t4sYs/4VB4LmaEzkf92dWfZ5Slcqpo6TyDLrjvMyZfqAseR M31g== X-Gm-Message-State: ABUngvddWCjjHMnR1e9BQuJaAm+eIguNoCfUXpEGc4k6EN6A0InEbwWWzGgntZD7siyEk8fC X-Received: by 10.31.97.1 with SMTP id v1mr4269377vkb.108.1478114823734; Wed, 02 Nov 2016 12:27:03 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 02/16] Consolidate Linux msgctl implementation Date: Wed, 2 Nov 2016 17:26:39 -0200 Message-Id: <1478114813-3526-3-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1478114813-3526-1-git-send-email-adhemerval.zanella@linaro.org> References: <1478114813-3526-1-git-send-email-adhemerval.zanella@linaro.org> Changes from previous version: - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the wired syscall or the ipc one. -- 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/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 | 8 ++++++ 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, 30 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..3316670 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 __ASSUME_SYSVIPC_SYSCALL + 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);