From patchwork Tue Jul 4 19:53:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 107020 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1361798qge; Tue, 4 Jul 2017 12:55:48 -0700 (PDT) X-Received: by 10.99.7.129 with SMTP id 123mr17420128pgh.171.1499198148419; Tue, 04 Jul 2017 12:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499198148; cv=none; d=google.com; s=arc-20160816; b=A6TnAVfaJ7dnb/n45p2pnfbvbFBXJNPw09BXYL9RRfDADQX3GCyDd7hIjQUBBesEyV QRca+PaSvTXFXbZKjmmVrce18uPZAcr1uVMELU0EwjRFUO4h+hKb2gbfZQhcEGFhbvPZ lVI6MRaJXD/JEFFfJa7GcgXEDq8B9ao8EZyZx+wcNbLtqOKJzoUlh8z+zReb/nQztTi1 Z5qVQxGjBQvhkRLKmKyvmPtVZRiyvzndtWLdzDC9k1U0vytVHoaRKSGMqVAkGYKWFlXk 5Rg9NgLi+YDLFZTwrlh1vJfQWgUc4C7L8VbngUniDaavDX6TFDCTMl+eRWuWs8IShwF1 i9YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=pJZC9Kc/3cOtXC3tgxv5TKdLW28mHJrKi5uU5XSkm0I=; b=nT6rw58Ost3k+e7G/4XowPdzq6X/SyOj+WVksj1MysK8IZaE23ax6L95kqoQQYoVNc p7nKR27vj/xCv+89dPWo0Ws0aBozTDhsrU73LJGeRACYogOVsYGJWPTpHwkWq6Yz4vjs AuOC0FKD4SCN2P4yxx8O87zk6SiMN0Ul9+a2Jv9CCBMFl0gpirfAPlPv0d87gmK13Adb 34SbSG2Hw/uvRaul2xrfjzV/zvS9bJxEBe9ssFtGu+UMUv6eBzCuLn7PHhQaLbEcWuGL xZ7Z9fFBh6mwXh7054P15mm3VFgqvAKevoBO5aXdH/so6tMcdytosizHB6sk4brnFGjA /SDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.b=ZHgiOhKC; spf=pass (google.com: domain of libc-alpha-return-81669-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-81669-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id n34si16329653pld.288.2017.07.04.12.55.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 12:55:48 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-81669-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 header.b=ZHgiOhKC; spf=pass (google.com: domain of libc-alpha-return-81669-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-81669-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=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=wKMJO0ZUD3MvU2W3uXHwFee3CDljlsX EfcyKQDOy/fds7LjS8jT6VYvzM8gtGoczCNbDNbc1AQI9qjhcZPCWAmOarfgzcvr eD9/lItThdUE1r8TQ6JjLMyjZoTch/rvfSe5tgbcFgXizP2fE6TuDYG/tqn8zuAR vAw5GJt3W3qA= 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=+cYrZmsnwxQxgYNrtIzAK/2IvVQ=; b=ZHgiO hKCvpRwlOWWuozOV7+1ryD5pAQSxo7Co5Pi6HuelBSd4Z/C9n2aLgZuQ1FCSnCEI ThA3o5/XC+5sGDvcrwIvaECZhSrvU+brwGYLK6DAMiCVT0PR6NpqgzKlsLL2pvFQ oKyKOaX7p69I89gaPQ6PVQs9mrQfnRWNzVJm2k= Received: (qmail 74764 invoked by alias); 4 Jul 2017 19:54:24 -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 74288 invoked by uid 89); 4 Jul 2017 19:54:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qk0-f169.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=pJZC9Kc/3cOtXC3tgxv5TKdLW28mHJrKi5uU5XSkm0I=; b=j8hy+ix2LCxr7qTCuy9YppwRIVbQuS1Yuz97YzZWbMYikQSQaSiidZeoe1riQj1S92 7yTx6diAfGfHnvBlLc/vezM46P5TJj45lr8tFP84MXToz2vXdR2jCZC/DTWpfYoLzHZO IepjvNpnUQcTCWEnQSijv0xCXyqdRPqgoo5qWNZtWlW1XIpclixyjWSlM1D7G4Zk2Odt /nOKisaiZQ0IsW27zc6yyqznWEDylvNpuAx61kzvYONIVf2u1iEFNNFIh6c4Oqu3qTMx ZyA5s1K+Svd8q+fBKQKGxAPJ24glvAcmeEnm6nSIg0ib40o/whON1PTZNCDIBy5VAd3F EuBA== X-Gm-Message-State: AKS2vOx2UARezvMClVEdXIX1JtDL4GbwHtSS5tpuJeGBnADy4QUFaVT2 fXN5quvByrkBmobLz0+QQw== X-Received: by 10.55.27.136 with SMTP id m8mr46721573qkh.196.1499198056341; Tue, 04 Jul 2017 12:54:16 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 10/14] Consolidate non cancellable nanosleep call Date: Tue, 4 Jul 2017 16:53:50 -0300 Message-Id: <1499198034-5837-11-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1499198034-5837-1-git-send-email-adhemerval.zanella@linaro.org> References: <1499198034-5837-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates all the non cancellable nanosleep calls to use the __nanosleep_nocancel identifier. For non cancellable targets it will be just a macro to call the default respective symbol while on Linux will be a internal one. Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu. * nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Replace nanosleep_not_cancel with __nanosleep_nocancel. * sysdeps/generic/not-cancel.h (nanosleep_not_cancel): Remove macro. (__nanosleep_nocancel): New macro. * sysdeps/unix/sysv/linux/nanosleep.c (__nanosleep_nocancel): New function. * sysdeps/unix/sysv/linux/not-cancel.h (nanosleep_not_cancel): Remove macro. (__nanosleep_nocancel): New prototype. --- ChangeLog | 10 ++++++++++ nptl/pthread_mutex_timedlock.c | 2 +- sysdeps/generic/not-cancel.h | 2 +- sysdeps/unix/sysv/linux/nanosleep.c | 9 +++++++++ sysdeps/unix/sysv/linux/not-cancel.h | 5 +++-- 5 files changed, 24 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c index be53381..c522abe 100644 --- a/nptl/pthread_mutex_timedlock.c +++ b/nptl/pthread_mutex_timedlock.c @@ -429,7 +429,7 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex, --reltime.tv_sec; } if (reltime.tv_sec >= 0) - while (nanosleep_not_cancel (&reltime, &reltime) != 0) + while (__nanosleep_nocancel (&reltime, &reltime) != 0) continue; return ETIMEDOUT; diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h index e80b89a..8eb2995 100644 --- a/sysdeps/generic/not-cancel.h +++ b/sysdeps/generic/not-cancel.h @@ -40,7 +40,7 @@ __waitpid (pid, stat_loc, options) #define __pause_nocancel() \ __pause () -#define nanosleep_not_cancel(requested_time, remaining) \ +#define __nanosleep_nocancel(requested_time, remaining) \ __nanosleep (requested_time, remaining) #define sigsuspend_not_cancel(set) \ __sigsuspend (set) diff --git a/sysdeps/unix/sysv/linux/nanosleep.c b/sysdeps/unix/sysv/linux/nanosleep.c index 2d15328..e7ac2c0 100644 --- a/sysdeps/unix/sysv/linux/nanosleep.c +++ b/sysdeps/unix/sysv/linux/nanosleep.c @@ -18,6 +18,7 @@ #include #include +#include /* Pause execution for a number of nanoseconds. */ int @@ -28,3 +29,11 @@ __nanosleep (const struct timespec *requested_time, } hidden_def (__nanosleep) weak_alias (__nanosleep, nanosleep) + +int +__nanosleep_nocancel (const struct timespec *requested_time, + struct timespec *remaining) +{ + return INLINE_SYSCALL_CALL (nanosleep, requested_time, remaining); +} +hidden_def (__nanosleep_nocancel) diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index 00070fd..9aaa781 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -26,6 +26,7 @@ #include #include #include +#include /* Non cancellable open syscall. */ __typeof (open) __open_nocancel; @@ -82,8 +83,8 @@ __typeof (pause) __pause_nocancel; libc_hidden_proto (__pause_nocancel) /* Uncancelable nanosleep. */ -#define nanosleep_not_cancel(requested_time, remaining) \ - INLINE_SYSCALL (nanosleep, 2, requested_time, remaining) +__typeof (__nanosleep) __nanosleep_nocancel; +hidden_proto (__nanosleep_nocancel) /* Uncancelable sigsuspend. */ #define sigsuspend_not_cancel(set) \