From patchwork Mon Nov 11 13:50:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 35790 Received: (qmail 26440 invoked by alias); 11 Nov 2019 13:50:42 -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 26432 invoked by uid 89); 11 Nov 2019 13:50:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=accordingly, HContent-Transfer-Encoding:8bit X-HELO: mail-qt1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=to:references:from:openpgp:autocrypt:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9f/4C+UuRxH0rGRYXj/BnQOKsw5ms/iDhKmKweao9mY=; b=wBmPbFqVlqNlNL91mmuoNm4h4pBWqn5M1xkgi4zdlnD3M2boxA3hvdK8lhDm1AMPBt 51eaQmPbccTihY8GMfjConkq1d4vC+cIkhWcVGR7Fq2Cqb+NvOlCN4Lh8pcpErtxCkWp RkLtOhOkJsT7oleNdNlSKMmBld+BtOwScq5m3QSo+J6aaZTjD9tp5f6eBv/gzJazON7U tGSBuss4tioznEKg8WRiStXtvDuZsYmPzP1T/yuwzdV+7WEeErk7VYlH9KdTWV1iJtYk FNl1nrlulRBX7B8uHGo6mmo2nahxaULCpKhredPsBc3hj0swjgmC2SmyfozHrxS+IAE8 hEcA== Return-Path: To: libc-alpha@sourceware.org References: <20191108170302.29838-1-alistair.francis@wdc.com> <87r22g3y3p.fsf@hase.home> <87imnroccz.fsf@igel.home> From: Adhemerval Zanella Openpgp: preference=signencrypt Subject: Re: [PATCH v6 1/3] sysdeps/clock_nanosleep: Use clock_nanosleep_time64 if avaliable Message-ID: Date: Mon, 11 Nov 2019 10:50:35 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <87imnroccz.fsf@igel.home> On 10/11/2019 14:44, Andreas Schwab wrote: > On Nov 10 2019, Alistair Francis wrote: > >> On Sun, Nov 10, 2019 at 1:00 AM Andreas Schwab wrote: >>> >>> This breaks rt/tst-timer on i586 and powerpc and armv7l. >> >> I don't understand how. I tested it on ARMv7. Do you have any more >> details on why it is failing? > > I don't know, it just hangs. > >> Also is this on a 5.1+ or earlier kernel/headers? > > All the latest. > > https://build.opensuse.org/package/show/home:Andreas_Schwab:glibc/glibc > > Andreas. > It is because clock_nanosspe requires to handle EINTR as a possible return value and update the remaining argument accordingly: diff --git a/sysdeps/unix/sysv/linux/clock_nanosleep.c b/sysdeps/unix/sysv/linux/clock_nanosleep.c index 60c61ee277..fc47c58ee7 100644 --- a/sysdeps/unix/sysv/linux/clock_nanosleep.c +++ b/sysdeps/unix/sysv/linux/clock_nanosleep.c @@ -52,13 +52,10 @@ __clock_nanosleep_time64 (clockid_t clock_id, int flags, const struct __timespec r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, err, clock_id, flags, req, rem); - if (r == 0 || errno != ENOSYS) - { - return (INTERNAL_SYSCALL_ERROR_P (r, err) - ? INTERNAL_SYSCALL_ERRNO (r, err) : 0); - } + if (r != -ENOSYS) + return (INTERNAL_SYSCALL_ERROR_P (r, err) + ? INTERNAL_SYSCALL_ERRNO (r, err) : 0); # endif /* __NR_clock_nanosleep_time64 */ - struct timespec ts32, tr32; if (! in_time_t_range (req->tv_sec)) { @@ -66,11 +63,12 @@ __clock_nanosleep_time64 (clockid_t clock_id, int flags, const struct __timespec return -1; } - ts32 = valid_timespec64_to_timespec (*req); + struct timespec tr32; + struct timespec ts32 = valid_timespec64_to_timespec (*req); r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep, err, clock_id, flags, &ts32, &tr32); - if (r == 0 && rem != NULL) + if (r == -EINTR && rem != NULL && (flags & TIMER_ABSTIME) == 0) *rem = valid_timespec_to_timespec64 (tr32); #endif /* __ASSUME_TIME64_SYSCALLS */ @@ -89,7 +87,7 @@ __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req, treq64 = valid_timespec_to_timespec64 (*req); r = __clock_nanosleep_time64 (clock_id, flags, &treq64, &trem64); - if (r == 0 && rem != NULL) + if (r == EINTR && rem != NULL && (flags & TIMER_ABSTIME) == 0) *rem = valid_timespec64_to_timespec (trem64); return r;