From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CED52A0543; Thu, 10 Nov 2022 23:06:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4F1540143; Thu, 10 Nov 2022 23:06:59 +0100 (CET) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id 944C2400EF for ; Thu, 10 Nov 2022 23:06:58 +0100 (CET) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 3A51D1C957 for ; Thu, 10 Nov 2022 23:06:58 +0100 (CET) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 391CB1CA31; Thu, 10 Nov 2022 23:06:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=ALL_TRUSTED, AWL, NICE_REPLY_A autolearn=disabled version=3.4.6 X-Spam-Score: -1.5 Received: from [192.168.1.59] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id EA8D01CC0E; Thu, 10 Nov 2022 23:06:55 +0100 (CET) Message-ID: Date: Thu, 10 Nov 2022 23:06:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v4] testpmd: cleanup cleanly from signal Content-Language: en-US To: Stephen Hemminger Cc: dev@dpdk.org, phil.yang@arm.com References: <20221014172328.185219-2-stephen@networkplumber.org> <20221109041046.199840-1-stephen@networkplumber.org> <097a2759-f958-84ed-0ddf-4b23eb1eee04@lysator.liu.se> <20221109145323.7ac2a1b4@hermes.local> <20221110081412.707599b2@hermes.local> From: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= In-Reply-To: <20221110081412.707599b2@hermes.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 2022-11-10 17:14, Stephen Hemminger wrote: > On Thu, 10 Nov 2022 08:50:40 +0100 > Mattias Rönnblom wrote: > >>>> >>>> Why is select() needed? Wouldn't a blocking read suffice? Or getchar(). >>> >>> On Linux, signal set SA_RESTART so a simple read is not interrupted. >>> One option was to use sigaction() which allows controlling flags, but that >>> won't work on Windows. Using select() works on both. >>> >> >> OK, so select() is used because a signal might interrupt read() on Windows? >> >> while (read(0, &c, 1) == -1 && errno == EINTR) >> ; >> >> Would that work? > > Try it. On Linux the read never gets interrupted. I had no doubts about that, but I misunderstood the code and thought that was the required behavior.