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 Netto X-Patchwork-Id: 689922 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 3t7YT80L6lz9t2G for ; Wed, 2 Nov 2016 01:26:51 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=G5khCYYL; 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=RrBNyQpYBiuWPInOomgYABM6lueXZza zrTMt3IEg+UZhQwb7v42JDpO7lH5RdEilY1CmapatYCJAVmnjZNiMbMYzpnHl0YE F4FjuYvd+trQo4x5Zu6/YjL9nUXz9WyJvTMn9pm3znLkTChbLnA2Uo5gXvW9BDoD jENOyPO6Khr8= 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=G5khC YYLVSYcs7lEcr8+L1PPAFyV3lm+5JAhzZhZJvpCfnL6Eom5V6Q6OE/ShqhrUbBgX YW3zOhrlXXjSFN6KesBvfmcVa47ujKYtBDf1/N9XwMn964FEVq5++Gdytblc98i9 DqZjP13dBAy/t+Fs2jtfkvEpy5MMiMZycwTliw= 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 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)