From patchwork Wed Nov 6 12:52:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 178680 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp564759ilf; Wed, 6 Nov 2019 04:53:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyw5Ch3DwzdRJNjDHcGifnLS0bnj2oSN0VH8bIlzuPaL70o0zZ6OcRP9aEYKzjBcNt9bxrl X-Received: by 2002:a17:906:2921:: with SMTP id v1mr34449040ejd.236.1573044797809; Wed, 06 Nov 2019 04:53:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573044797; cv=none; d=google.com; s=arc-20160816; b=OKplg0SlBYVwhcRxaY78Ckekm88Wo5xut7SC+Xo1BBhqVeObgmH1W9H36q+jPC38NB ZXimbW9wAXiDz8BtxhSZU8O50XZFpEGJS7VmM8PNdEP25yRUZewPIUuU5tAya2Kxcxdn hCaVXRhA/wgHXxE9I5wHLc41i8brel/xy6+aaM26Aij7ArkGwujny6NNs17ad0l/D4ok bFBCzhjmAwfH+W273m9M4rABk6xjFuVzZGIOlRFrtcsD6TzkGb9XwFsmP+9YqDZbpMp9 PJ1WfIivwyRMuweoKCdHp5CoEdf0lyERIel+GcjRG6sKbmHK7v3naYiG8AWwBpHztblL LPGQ== 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 :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=Lm2bajqT/mICCW4kUqd6sM3NtKsKx7Z8gWerQM2whl8=; b=KSy4aHzRoK2RVHvnP7DZWSmCG0hjh+DH/usUV6jnl0v7cmWatSWjFvfzMcxN0TA/OU /+CICN+xAAYeEIu7xdwEdBtywZsB9OhR+m7ZX3pYlAP+qjF58ZS8BeOHE+xA7W8fDJll 2YxoqFzuysOg6LueXtwrK3Ouir9ZNqIyM0haavYpHJ/Aw2X+bjuY7mLV4MfNExDjt4Ds QpxJ1HfLeQJTdWK18HcSI3AVTpwXmVOb2N3DdyzRIKRphzhOjJ8tx1AtKWm2UD8t4V+1 zzcEIr8tn17BSlwjo7xYS5cCWsYOv4j3oRDWIETgCF6ezMEXcdDpCP5rayL0II5nNM52 CeAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Ge3aySwt; dkim=pass header.i=@linaro.org header.s=google header.b=N297IE9U; spf=pass (google.com: domain of libc-alpha-return-106683-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-106683-patch=linaro.org@sourceware.org"; dmarc=pass (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 o12si15761451ejn.292.2019.11.06.04.53.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Nov 2019 04:53:17 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-106683-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.s=default header.b=Ge3aySwt; dkim=pass header.i=@linaro.org header.s=google header.b=N297IE9U; spf=pass (google.com: domain of libc-alpha-return-106683-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-106683-patch=linaro.org@sourceware.org"; dmarc=pass (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=WqY/qZ2lHTSkzD/tJ7eDu0Ok1hRunPk MAGSwul/DblUI658idWjkb7e5Up+ffb1QZAzLdOiG8RF81fD75NJmCMmDPQubBdI 1ayRurzs2JabBynXYBobVWJpEBQLaCBVZ6r9dNCEiZiHJt8Po+NaYCfKW8ec6QnM vHai+7FRVPdc= 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=XumTox4khTSQbeIPEpt+EI2g/ow=; b=Ge3ay Swt72z9aXr5IEbtmcscBS0/T4rBevNYc2PHIZcBDJgHDY1QuAgREB78Y92T7apjD 4qIEZFKJSXSIU9X7Tbg/GIeBQtkzw4n3twmJ21uivyOcG3GYEBsnNV94qUMhpuA0 9sZcNeA+LXS1Mc6X2TqSvzpPEO6lcTUHCe3HLA= Received: (qmail 56734 invoked by alias); 6 Nov 2019 12:52:57 -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 56702 invoked by uid 89); 6 Nov 2019 12:52:56 -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=HX-Languages-Length:1143, states X-HELO: mail-qt1-f194.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=Lm2bajqT/mICCW4kUqd6sM3NtKsKx7Z8gWerQM2whl8=; b=N297IE9UJ7+4b1Hq0C4/4DkkrWGoYp2IldYbNPzLWJswmvtG9WPYGw2DRcc+UKxe95 kEovXrnjnD9W8DKwFYxibG5ybal6FV5w08JAkrjkW6a4Uj+B3WKcNW6izQABGRb1uQWh H/GRY3zm2LGwjag6k42Z4cyW56NMSgLqyKFGll86DMFOzHnDHD1Nmv3kzkTsV/olR8jN 3ccGmgObmj4uoxhWPRWogs4xZbLb+KAbx5i7rjrabeDuDyH5ztOQj2FuKrxYFJrBtjud qJQ8qVOZpHZwudPHxYPPA6iN18mKqGFMNgMins35+ewbZxskw13dRkcv+V64A+x6ZiwC 4I8A== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 3/3] nptl: Refactor thrd_sleep in terms of clock_nanosleep Date: Wed, 6 Nov 2019 09:52:45 -0300 Message-Id: <20191106125245.28102-3-adhemerval.zanella@linaro.org> In-Reply-To: <20191106125245.28102-1-adhemerval.zanella@linaro.org> References: <20191106125245.28102-1-adhemerval.zanella@linaro.org> Checked on x86_64-linux-gnu and powerpc64le-linux-gnu. --- nptl/thrd_sleep.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/nptl/thrd_sleep.c b/nptl/thrd_sleep.c index 2e185dd748..3f5e307d56 100644 --- a/nptl/thrd_sleep.c +++ b/nptl/thrd_sleep.c @@ -24,16 +24,13 @@ int thrd_sleep (const struct timespec* time_point, struct timespec* remaining) { - INTERNAL_SYSCALL_DECL (err); - int ret = INTERNAL_SYSCALL_CANCEL (nanosleep, err, time_point, remaining); - if (INTERNAL_SYSCALL_ERROR_P (ret, err)) - { - /* C11 states thrd_sleep function returns -1 if it has been interrupted - by a signal, or a negative value if it fails. */ - ret = INTERNAL_SYSCALL_ERRNO (ret, err); - if (ret == EINTR) - return -1; - return -2; - } - return 0; + int ret = __clock_nanosleep (CLOCK_REALTIME, 0, time_point, remaining); + /* C11 states thrd_sleep function returns -1 if it has been interrupted + by a signal, or a negative value if it fails. */ + switch (ret) + { + case 0: return 0; + case EINTR: return -1; + default: return -2; + } }