From patchwork Tue Nov 1 14:25:17 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: 80363 Delivered-To: patch@linaro.org Received: by 10.80.142.83 with SMTP id 19csp678310edx; Tue, 1 Nov 2016 07:27:41 -0700 (PDT) X-Received: by 10.98.101.71 with SMTP id z68mr59834032pfb.13.1478010461438; Tue, 01 Nov 2016 07:27:41 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id k5si17562233pfg.218.2016.11.01.07.27.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 07:27:41 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-74266-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-74266-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-74266-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=E6VM1Xb/f1ACivRrqSvL4N87qM5SMiX 4Std9ic5E9v0HbyUXgGzsEY205etcjtVOzDZ05FTK9b8WmmijiXw8staYQpcvA9T n0wVbPQSmzGC/XKWl93RssUcfmYN/ctrBWDcltAuwxcbRex8Ef8bsiZ7OJNgfCjP LqGq7txXpJO0= 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=K1+E+vgAZ6hJVVguYx42luqb1VE=; b=v636N vy+xlbtCMaA6ZJR26DF86OjGEjKWRNyuCU2kA4AMU6j3Zxx11RWgb/eKwl/h8P8r Aa1kiK+G6wMjqPEi6PNr6tpVuWzF7+dKIL1riQR+3LS1ZR3u/hl1hzBpP1tFDx+n IjgbXujY+H3RBYjoIo/W9bJ+Rxfu2gec/k8ZNM= Received: (qmail 37841 invoked by alias); 1 Nov 2016 14:25:54 -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 37784 invoked by uid 89); 1 Nov 2016 14:25:53 -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=sops, TIMEOUT, Successful, lesser X-HELO: mail-vk0-f50.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=zPtbD87kK33YgnQAZawOwxgXerC+nvLw41y13w2Q3Cw=; b=J40gAuZ1HP+gla/D2DVSMiuNrGuSEHE1dlvDOey1YX31cF9ChTEyFSS9bYuwZ/LXZm f2WDbBVBvXXSTxB8UZRzfr/Yax7O/Vg3CyFMnUO4Rt6EA53e3cPtz5XMpZKBrd/MdVQN PBtxpoKztOeuPh8OTe0QkkWYkgjrqZ9wquX2MYkMfcuJw+y4ijeK6TN4vhOR89blUkz2 JruyUz/kQmMVwU+iwuILB87IQoQ4yzUlY5AVCG/ykX70kwl9p1bUtYHFqsMoDavwhaIQ LDKEziQwAToOuYlKFUIBTrKewKUkIQypH6NrxgF8o5Dwvqw0Wi/Vrv6pEUP2ehsAiyPF Db9w== X-Gm-Message-State: ABUngvfUPN2GETT24Qr1BU7dQoH87VZL+Dcmv500c3TN89/5FZPXATOc7VA1HLPIO+dZhNb7 X-Received: by 10.31.10.137 with SMTP id 131mr27626192vkk.5.1478010341339; Tue, 01 Nov 2016 07:25:41 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 09/15] Consolidate Linux semtimedop implementation Date: Tue, 1 Nov 2016 12:25:17 -0200 Message-Id: <1478010323-13076-10-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 semtimedop Linux implementation in only one default file, sysdeps/unix/sysv/linux/semtimedop.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/m68k/semtimedop.S: Remove file. * sysdeps/unix/sysv/linux/s390/semtimedop.c: Reorganize headers and add a comment about s390 syscall difference from default one. * sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use semtimedop syscall if it is defined. --- ChangeLog | 6 +++ sysdeps/unix/sysv/linux/m68k/semtimedop.S | 69 ------------------------------- sysdeps/unix/sysv/linux/s390/semtimedop.c | 12 +++--- sysdeps/unix/sysv/linux/semtimedop.c | 13 +++--- 4 files changed, 20 insertions(+), 80 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/m68k/semtimedop.S -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/m68k/semtimedop.S b/sysdeps/unix/sysv/linux/m68k/semtimedop.S deleted file mode 100644 index b291070..0000000 --- a/sysdeps/unix/sysv/linux/m68k/semtimedop.S +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (C) 2003-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Schwab , 2003. - - 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 - -#define SYSOP_semtimedop 4 - -#define SVRSP 8 /* saved register space */ -#define PARMS 4+SVRSP /* space for 3 saved regs */ -#define SEMID PARMS -#define SOPS SEMID+4 -#define NSOPS SOPS+4 -#define TIMEOUT NSOPS+4 - - .text -ENTRY (semtimedop) - - /* Save registers. */ - move.l %d2, %a1 - move.l %d3, -(%sp) - cfi_adjust_cfa_offset (4) - move.l %d5, -(%sp) - cfi_adjust_cfa_offset (4) - cfi_register (%d2, %a1) - cfi_rel_offset (%d3, 0) - cfi_rel_offset (%d5, 4) - - move.l #SYSOP_semtimedop, %d1 - move.l SEMID(%sp), %d2 - move.l NSOPS(%sp), %d3 - move.l SOPS(%sp), %d5 - move.l TIMEOUT(%sp), %a0 - move.l #SYS_ify (ipc), %d0 - - trap #0 - - /* Restore registers. */ - move.l (%sp)+, %d5 - cfi_adjust_cfa_offset (-4) - cfi_restore (%d5) - move.l (%sp)+, %d3 - cfi_adjust_cfa_offset (-4) - cfi_restore (%d3) - move.l %a1, %d2 - cfi_restore (%d2) - - /* Check for error. */ - tst.l %d0 - jmi SYSCALL_ERROR_LABEL - - /* Successful; return the syscall's value. */ - ret - -PSEUDO_END (semtimedop) diff --git a/sysdeps/unix/sysv/linux/s390/semtimedop.c b/sysdeps/unix/sysv/linux/s390/semtimedop.c index f226953..db43f00 100644 --- a/sysdeps/unix/sysv/linux/s390/semtimedop.c +++ b/sysdeps/unix/sysv/linux/s390/semtimedop.c @@ -16,12 +16,10 @@ License along with the GNU C Library; if not, see . */ -#include #include #include - #include -#include +#include /* Perform user-defined atomical operation of array of semaphores. */ @@ -29,6 +27,10 @@ int semtimedop (int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout) { - return INLINE_SYSCALL (ipc, 5, IPCOP_semtimedop, - semid, (int) nsops, timeout, sops); + /* The s390 sys_ipc variant has only five parameters instead of six + (as for default variant) and the only difference is the handling of + SEMTIMEDOP where on s390 the third parameter is used as a pointer + to a struct timespec where the generic variant uses fifth parameter. */ + return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid, nsops, timeout, + sops); } diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c index 30ee7fe..9a6d010 100644 --- a/sysdeps/unix/sysv/linux/semtimedop.c +++ b/sysdeps/unix/sysv/linux/semtimedop.c @@ -16,12 +16,10 @@ License along with the GNU C Library; if not, see . */ -#include #include #include - #include -#include +#include /* Perform user-defined atomical operation of array of semaphores. */ @@ -29,7 +27,10 @@ int semtimedop (int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout) { - return INLINE_SYSCALL (ipc, 6, IPCOP_semtimedop, - semid, (int) nsops, 0, sops, - timeout); +#ifdef __NR_semtimedop + return INLINE_SYSCALL_CALL (semtimedop, semid, nsops, sops, timeout); +#else + return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid, nsops, 0, sops, + timeout); +#endif }