From patchwork Thu Aug 3 13:11:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 109334 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp764125qge; Thu, 3 Aug 2017 06:13:30 -0700 (PDT) X-Received: by 10.99.49.142 with SMTP id x136mr1622942pgx.184.1501766010371; Thu, 03 Aug 2017 06:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501766010; cv=none; d=google.com; s=arc-20160816; b=m8MPzO7Fzhvj9pLrDd67E34Y8s2S1aAIC07K2xBVYO/jrMain03Z8kLrZ1ty+hs8C8 Qj79gUifKM/OeoQ7cZ6CTQZAv67Jjd/y/3WGM1eCekkNXX5FWDQ8SwCD0DqvdlJyYRNa Y4pD62C2i4dRSJQVuraXFABB79191G1xC3i29ADKaDOTuUZdtzssSYegHRgTGXvVrJQA 5eEIPJgGUeaRjnvI/xRLVy4dvt5qe1mDd9hR2vuXgfMwRH+KY7Y07O/LeXsN+6+rwtVD O9RBTCwRTyA/rnWB0aHcIKhhkTCgYW9ugJpkN2CNheF3PGus6lZKBuX43jZFXA+MJhy8 h/5A== 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=gloGDBM7L47bfNGKXB5DFjcSG+uiUChWdLo8AgSDw5c=; b=V9d17jpWXhUegGOUePvqGFCYKr+ZavVDdNNYilQ14+1NVuNTCFrvlk4RsJxLp3BHOE MQTAGfAxIIoLU+0EyjsFrR/c+KoB60aU/8oCG8ggXaGzV36/dCCDeLO+2YmA4fS68Gh3 GnZv6RebL7WVE8kbxoej/8sR/Cc2/xy3rN+rRhDP3zvAPEaks7W6sxay3TEfLCD6k8ri eFxwc1+JGWgNelXgMWJS/7q5glfJTfwbbo/YJAORoIXOa6WFZEGxHhBMpC+3FhJz4QiM 5yseYnETk8SRZedvAFo2lsWWJrvlncsom17SlnUeQ5Isd4D6fjm1rzZyCgI+tqBuRoDD krvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.b=V08NfIZ6; spf=pass (google.com: domain of libc-alpha-return-82688-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-82688-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 j186si21284567pfb.221.2017.08.03.06.13.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Aug 2017 06:13:30 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-82688-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=V08NfIZ6; spf=pass (google.com: domain of libc-alpha-return-82688-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-82688-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=igp5jX6EA1T8i5QnGa9YsGv5lsWbKn1 vnn0wtPESlD75Trh9an/d+H+qkd5zahArIQljeGyeLTw/MCwL8l1iq7gqJ1Em+Sw xYCrngjovFcSIeCYjm1Q6pAimAbE5Yo7Yp/1aAI7xSxqv/t0tgGadt8SY1uRPdGX aXZi5GW7htGI= 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=TCYdc6PxbHp7ONTFdupMjMg1eeA=; b=V08Nf IZ6y9C1WJgugmPaDrYWIU2EPotGOqRd5VPzca2nSVnc8XtTJLcadzZYsA8tBWH8H SB7wJnUmXWkZ/NxMGT4UTud++7RmN2hWoauF+grNLDQaBe8U5lVAOVQTnI3I14Un vUTAgjlP3wz9x6dvVCTo11Hs+lqraSnIuHfHYI= Received: (qmail 61934 invoked by alias); 3 Aug 2017 13:11:56 -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 61861 invoked by uid 89); 3 Aug 2017 13:11:55 -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-qt0-f172.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=gloGDBM7L47bfNGKXB5DFjcSG+uiUChWdLo8AgSDw5c=; b=GT0BDIPFZja62PAjebEgIHiSMkhCVcc/W/kxnVUEVTUdcmr23hm+T2JmA3vRildtlH 0CXVp8rINM3iMqRIZNSA/7+gihYjwJFMSsLvr73bQAICjnCR0/GkMdSt8YIC9ieBw82d DtJOGeBe7W0pV+xr8S2tQfoeV568eNQqedjmJ0wIZL7CUVYEnRAPeuOEdksScwdcI+IB fAjpWkZrxxgDNGEUy2tsox9oGOsIPbJ/nXl+24nY6qiNVDuqs+o/7Q3at9Vpy+5Q5z9z PNoyNzkBP9GoyOP0snDW7h2mTAOMymXfu7xyt6AhExSEryHFnRqoatqGuSSTIVS/ugBl qIdg== X-Gm-Message-State: AIVw112eIqTskcaO7xLx1CktbISICDdkokHCuNvRQ0GzJqBWWyCuEXKm CX6ZmgK5Df2N07oAZ1ZmOw== X-Received: by 10.200.8.12 with SMTP id u12mr2244683qth.328.1501765911008; Thu, 03 Aug 2017 06:11:51 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 10/14] Consolidate non cancellable nanosleep call Date: Thu, 3 Aug 2017 10:11:10 -0300 Message-Id: <1501765874-6201-11-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1501765874-6201-1-git-send-email-adhemerval.zanella@linaro.org> References: <1501765874-6201-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/ChangeLog b/ChangeLog index 877c5d9..bf9bd57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2017-08-02 Adhemerval Zanella + * 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. + * nptl/pthread_mutex_lock.c (__pthread_mutex_lock_full): Replace pause_not_cancel with __pause_nocancel. * sysdeps/generic/not-cancel.h (pause_not_cancel): Remove macro. diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c index d5ec314..45f3454 100644 --- a/nptl/pthread_mutex_timedlock.c +++ b/nptl/pthread_mutex_timedlock.c @@ -432,7 +432,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 f2140c2..e4a8584 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 89c1f46..07f07f6 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) \