From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84337 invoked by alias); 22 Aug 2017 13:07:31 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 84189 invoked by uid 89); 22 Aug 2017 13:07:29 -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-f170.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cVqIFO/bzST6uu2LdsB+PDUCBCCgwf4vm7yaaBILjy4=; b=VouHIPVv7lr1Mv+whbgkzLvtOrXnI5BEoLL7cet0Jsjgm4FNKAiU66bDGygg9HYW6g ykOa6S9Y2H5LO87mKMDKMZOq7ZUrr8kSm/BuLXncHBQFW3yZtzWFKRAp6KzuNM5euXcl t29ehHKNAZ7UJ6jH0cZ4AUjOZwqAoXD82Ta+KZg6ltXeZdngRZ4gH76NfrA+dyzou7hC BYdq6/wiWfuXInXj4MZdIVoDV6BJW+iCm2TtCoVH6cMvo5zaVe0jmYsA54Nbk5/XRWOM b1PQt+Ar7ekr/YjaET7vyTEO6v65pu2Jvcty964BDyDEUqmPWTXFxL5spHwDeH3lsFP/ 7kCg== X-Gm-Message-State: AHYfb5jF5bAJrXpr/G8AoUDi0k13g6Nze9omeUZScUAx29xTfZOwYyFV PdasEZjqyO0tOlcGE5aEOA== X-Received: by 10.200.35.215 with SMTP id r23mr805817qtr.117.1503407241106; Tue, 22 Aug 2017 06:07:21 -0700 (PDT) Subject: Re: [PATCH 10/14] Consolidate non cancellable nanosleep call From: Adhemerval Zanella To: libc-alpha@sourceware.org References: <1501765874-6201-1-git-send-email-adhemerval.zanella@linaro.org> <1501765874-6201-11-git-send-email-adhemerval.zanella@linaro.org> Message-ID: Date: Tue, 22 Aug 2017 13:07:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1501765874-6201-11-git-send-email-adhemerval.zanella@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-08/txt/msg01054.txt.bz2 Since this is a refactor, if no one opposes I will commit it shortly. On 03/08/2017 10:11, Adhemerval Zanella wrote: > 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(-) > > 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) \ >