From patchwork Wed Nov 2 19:26:40 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: 690554 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 3t8J6r0SfCz9t2g for ; Thu, 3 Nov 2016 06:28:35 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=E24GEt1/; 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=l6a76+rTCmAg02hJOuZ/HMS2srPb9Hd g7RKJQ/1Wlq48nlBkHWeuvHYTG2Dthc6ggjHgaLuD7ilqReMEqcwN6ReBlj1UZ9Z OC2cyLc86uB/AGoME3N4Dl/RrW+lggEj0LO5XFenzX1dkqV23EF+J/Hr0SCMqnB2 MEQmFwy1MHR0= 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=CIS2mTtbp7GKgBcBetoRO+PTYRQ=; b=E24GE t1/NJSldVzUhVMIluqF1ypHNFfpDNS7oX9jGw9dKRpXBhZVvuiST39wOCqIsGQPg XNqVKs9Q+KZZ7B8wkdx6eMmqUXCf5osAbQqNREnqT62+eloHBF2c6RdwTLUpxUXy AguK0qg08BWv8OfuatbwjcrBOcl8qP6XCUJs6Y= Received: (qmail 64596 invoked by alias); 2 Nov 2016 19:27:17 -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 64235 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, five X-HELO: mail-ua0-f177.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=v0hdVWjpypSwwUAF3xQBDOwsmhgLxaEfnJmyL/y836s=; b=jOD9YHDcAebN8p6XLTk7gwfCLI7aXPg+pul2RfHFifgEiA0EMK0q3ngfcN3T3qYk0F 2T/wessuYtFhvQ9zqRQ+k4vlPlN2NwegWlPp9YWi5tyXJpM+8KagB18dcjBdyZq1Tm5f NybiJ13ZJqHcc8B1y+CrUx75P8rSnduqaRHAnMsjEAVkundnAgfWRJ5ZaeZvdaH7rl4H QjG82w/m4yFi5jXlvd43NoEYksxf4EfiwpGhQ98zQ6xZMfvVVvANEXVONzmUt1S5yH78 Hql58fpy99v19UqmIKtqZjQ5x7F9jALlF5o7g6+q/K2y16q+Vo84el/gYm53kOt8nuj7 gMUw== X-Gm-Message-State: ABUngvd0OiC0rQ18Z3TlAmbctShZnwP488Zx6Q7kMs24uvKRP5pqTp+Zsmn9w3dWZ/WGxRsl X-Received: by 10.176.1.112 with SMTP id 103mr3679869uak.154.1478114824913; Wed, 02 Nov 2016 12:27:04 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 03/16] Consolidate Linux msgrcv implementation Date: Wed, 2 Nov 2016 17:26:40 -0200 Message-Id: <1478114813-3526-4-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 msgrcv Linux implementation in only one default file, sysdeps/unix/sysv/linux/msgrcv.c. If tries to use the direct syscall if it is supported, 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..f4e25ba 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 __ASSUME_SYSVIPC_SYSCALL + 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)