From patchwork Tue Sep 17 08:06:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1163209 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-509077-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="JQlVddgw"; 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 46XbMl2HBCz9sN1 for ; Tue, 17 Sep 2019 18:08:19 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=AoFV7Rz7Rqw4kqDQaHLslxsdzcDmYCdfcbILA8rLEvfBXOViPu +ZBNM2qtufmDAvnxeQcM/3T0hlhrMjQTFkcEC4vyCcFUCM6wWqMv2x9QSy3xiHpJ sANx+c4ZiFbJ+7mg2D88pzV8o8Os6cOM/vzsMbgk1/dhXpSvwoMLusKhk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=40kvWWH3d5aGFD+u+2/x048Z8cM=; b=JQlVddgwe1FsUQJysSHK SGfBgQN7TOQmxdc7pGwZqca9CR0RAC9vZoBQbSbhQkFE0yv7M05zMY5B9y1mf/IN D9Goo8gi9JtPte+76+wVZG5tbV/aAzq0E60nZ4bvd0wjebHyzlel8KpyMXK27Jzm CWW2qTwiWl2Vg9YEEr6gYK8= Received: (qmail 30197 invoked by alias); 17 Sep 2019 08:06:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 30129 invoked by uid 89); 17 Sep 2019 08:06:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1006 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Sep 2019 08:06:39 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 2CDD2117C50; Tue, 17 Sep 2019 04:06:36 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cI6X29QzY4d5; Tue, 17 Sep 2019 04:06:36 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id 9941F117BE2; Tue, 17 Sep 2019 04:06:33 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id 9827C6AD; Tue, 17 Sep 2019 04:06:33 -0400 (EDT) Date: Tue, 17 Sep 2019 04:06:33 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Vadim Godunko Subject: [Ada] GNAT.Expect (Expect_Internal): Try to call 'poll' few times Message-ID: <20190917080633.GA37512@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes 'poll' returns -1 in case of any error (including interruption by a signal), so call need to be repeated few times to avoid false failures. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-17 Vadim Godunko gcc/ada/ * libgnat/g-expect.adb (Expect_Internal): Try to call 'poll' few times. --- gcc/ada/libgnat/g-expect.adb +++ gcc/ada/libgnat/g-expect.adb @@ -679,8 +679,17 @@ package body GNAT.Expect is -- Loop until we match or we have a timeout loop - Num_Descriptors := - Poll (Fds'Address, Fds_Count, Timeout, D'Access, Is_Set'Address); + -- Poll may be interrupted on Linux by a signal and need to be + -- repeated. We don't want to check for errno = EINTER, so just + -- attempt to call Poll a few times. + + for J in 1 .. 3 loop + Num_Descriptors := + Poll + (Fds'Address, Fds_Count, Timeout, D'Access, Is_Set'Address); + + exit when Num_Descriptors /= -1; + end loop; case Num_Descriptors is