From patchwork Mon Feb 10 01:05:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1235585 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-109340-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=tswwO8pp; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48G7572wRDz9sRR for ; Mon, 10 Feb 2020 12:06:03 +1100 (AEDT) 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:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=xvl0zFujr9FRkLwyywz/x7Nc+to+IUDqKb+dJkYDMufR+tvkXDDe8 rLHgW+dTAnI1ooBiez8Z0gtX55sYYocbWbmSH1m84b+Yx6uIDWZMonwSU6fprVwe mq4cnL1wDmZH8o9Q4iQZrb7O3zpEvv5+WbtXmHmxbfxW8LGy8cuodw= 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:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=xSWOtm/bQGIqr5Syg6Enp5+A2/c=; b=tswwO8ppyPhk4errjMsMCmmeLp7s cuFjxh9X9p1+p5oC5sJ0tc1pX/GQj2CUn3MRheQwAgJcsviB0WxWZjBrKFZKv/tp Q+6uE5aFfIAQ8lU+scf2e0KBaJihegs19BciKMfTekVihpzDuTc6G7pVyy7BDyJY EVDlDou33KIV/2c= Received: (qmail 96473 invoked by alias); 10 Feb 2020 01:05:22 -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 96388 invoked by uid 89); 10 Feb 2020 01:05:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: hera.aquilenet.fr From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 03/10] hurd: Make nanosleep a cancellation point Date: Mon, 10 Feb 2020 02:05:01 +0100 Message-Id: <20200210010508.428251-3-samuel.thibault@ens-lyon.org> In-Reply-To: <20200210010508.428251-1-samuel.thibault@ens-lyon.org> References: <20200210010508.428251-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 --- sysdeps/mach/clock_nanosleep.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sysdeps/mach/clock_nanosleep.c b/sysdeps/mach/clock_nanosleep.c index ae9335cb2b..23ebc15274 100644 --- a/sysdeps/mach/clock_nanosleep.c +++ b/sysdeps/mach/clock_nanosleep.c @@ -22,6 +22,7 @@ #include #include #include +#include static int nanosleep_call (const struct timespec *req, struct timespec *rem) @@ -39,9 +40,13 @@ nanosleep_call (const struct timespec *req, struct timespec *rem) if (rem != NULL) __clock_gettime (CLOCK_REALTIME, &before); + int cancel_oldtype = LIBC_CANCEL_ASYNC(); err = __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT, 0, 0, recv, ms, MACH_PORT_NULL); + LIBC_CANCEL_RESET (cancel_oldtype); + __mach_port_destroy (mach_task_self (), recv); + if (err == EMACH_RCV_INTERRUPTED) { if (rem != NULL)