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 X-Patchwork-Id: 80536 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp291561qge; Wed, 2 Nov 2016 12:28:38 -0700 (PDT) X-Received: by 10.99.94.196 with SMTP id s187mr8135774pgb.107.1478114918441; Wed, 02 Nov 2016 12:28:38 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id sn2si1605001pac.336.2016.11.02.12.28.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Nov 2016 12:28:38 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-74322-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-74322-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-74322-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=m5bupkBspt9O2NGZ43gdvYcq6wY+B4t r1xcKkalcwO9Ao/s4olQHAIHzLHtzOUtsmW3LDyxkLW3q6au7XNXmvrVWoHXkhcN L7MElYECzJHIoQX5SyuNicY5XrCGBlzT1yQBjGEFjtyfDsEmJQKgzx320sjUodw8 +ogzFjD9bcmw= 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=qwOsH sjTGY4vGSzpQl35VIkrKKkElrG7fMa+0mP52PNIpd44j8G4mYk2xUbPcppvQDHuj bJWVp7UUVAASz0ezdf0FNhUT0g3B8O97JYeS8Zof8v8orxOwe5frzvRG2TxV+LvJ Pl3tE3eR0+b3dZ3wIif3GzqnjlJNfIXTDR0kjM= 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 -- 2.7.4 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)