From patchwork Tue Nov 1 14:25:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 80359 Delivered-To: patch@linaro.org Received: by 10.80.142.83 with SMTP id 19csp677982edx; Tue, 1 Nov 2016 07:26:55 -0700 (PDT) X-Received: by 10.99.48.69 with SMTP id w66mr50449049pgw.109.1478010415258; Tue, 01 Nov 2016 07:26:55 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id o20si30728216pfi.241.2016.11.01.07.26.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 07:26:55 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-74262-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-74262-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-74262-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=FXbFbAv2d3Eyikr5gO8U97XKRK675Qr X74s+AKxh+k7tFo4mdyBH7b4VBOxJEmVpeRc83VGxyDiiyNZraCyRCA86sXtM9pE hElij18Wc5z5coc6RE048SQ1tZSZq5OxEcbfMz8i+qgGmxkWuwf++iBfv2eKVzZ8 URHbLSPNio9I= 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=vYvITQP6jj4/L6E1DFRyg9ZbOPI=; b=vRuvw gSrZ03pCsyT2F8hU9lEmTivzq5asxiomTLLCGxhp5i+IUfKsV/D/0H0dSltIqSqE 5qTGKVAhAEbd74UbHmCPXJA3UCbKwCSqQ36GwLDeh1QY8FEVDpAMd1oFKyEIJdL7 X2ERGqULumV8SvtDIRPozVUx3twMvojYDKAZDE= Received: (qmail 36740 invoked by alias); 1 Nov 2016 14:25:46 -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 36412 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=ssize_t, lesser, five 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=/NabPCBYEHOUxKS/tiV7xpeYdl/bar/csecnTRP+s0s=; b=JiyGKH362T5fD4rZumaCB54Uo8dUo7SRyNVHl+s1MNuRH0/iKUDlyz1BgRScHTKQag vs/VDTIrfb0l1hQdhRixYZhZVoN1R6SxCLwAvo64IzxfffHauWYkwykfwVt7qTsiq9Do 4fFZrKni66hfGjWgZOCqt4XNpn6Lds8hO7AXXQmboX3pJTLU4NQ5Jmahr3Tb2QDBjaTR FVG62x7HOb8eyNXvjk1dTM+fBe0I8pXsDJ7OEDTKDyYZMiU9jIFA/ES9oTkDldTrJKbj j7Gd/Ye12IEloEY0DGEirtzsMSRdnVe/nQ+ZReZx6H6BSlQ0H49bVxyRZwd6UYq6T10W 16Gg== X-Gm-Message-State: ABUngvdajzlzLNGioEjvVONympdZL2TPUW+2x90fgud3OJzKxINhIai26ocI1DIQM8j1tZv0 X-Received: by 10.31.227.129 with SMTP id a123mr5278742vkh.65.1478010332842; Tue, 01 Nov 2016 07:25:32 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 02/15] Consolidate Linux msgrcv implementation Date: Tue, 1 Nov 2016 12:25:10 -0200 Message-Id: <1478010323-13076-3-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 msgrcv Linux implementation in only one default file, sysdeps/unix/sysv/linux/msgrcv.c. If tries to use the direct syscall if it is defined, otherwise will use the old ipc multiplex mechanism. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/msgrcv.c (__libc_msgrcv): Use msgrcv syscall if defined. * sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c: Remove file. --- ChangeLog | 4 ++++ sysdeps/unix/sysv/linux/msgrcv.c | 25 ++++++++------------ sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c | 32 -------------------------- 3 files changed, 13 insertions(+), 48 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c index c4dd219..53e6332 100644 --- a/sysdeps/unix/sysv/linux/msgrcv.c +++ b/sysdeps/unix/sysv/linux/msgrcv.c @@ -16,33 +16,26 @@ License along with the GNU C Library; if not, see . */ -#include #include #include - #include -#include - -/* Kludge to work around Linux' restriction of only up to five - arguments to a system call. */ -struct ipc_kludge - { - void *msgp; - long int msgtyp; - }; - ssize_t __libc_msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg) { +#ifdef __NR_msgrcv + return SYSCALL_CANCEL (msgrc, msqid, msgp, msgsz, msgtyp, msgflg); +#else /* The problem here is that Linux' calling convention only allows up to fives parameters to a system call. */ - struct ipc_kludge tmp; - - tmp.msgp = msgp; - tmp.msgtyp = msgtyp; + struct + { + void *msgp; + long int msgtyp; + } tmp = { msgp, msgtyp }; return SYSCALL_CANCEL (ipc, IPCOP_msgrcv, msqid, msgsz, msgflg, &tmp); +#endif } weak_alias (__libc_msgrcv, msgrcv) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c b/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c deleted file mode 100644 index ccaa4ee..0000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2010-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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 - -ssize_t -__libc_msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, - int msgflg) -{ - return SYSCALL_CANCEL (ipc, IPCOP_msgrcv, msqid, msgsz, msgflg, - msgp, msgtyp); -} -weak_alias (__libc_msgrcv, msgrcv)