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 81FEE41EBE; Fri, 17 Mar 2023 17:21:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 746FA42FCC; Fri, 17 Mar 2023 17:21:02 +0100 (CET) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mails.dpdk.org (Postfix) with ESMTP id AB87A42FC8 for ; Fri, 17 Mar 2023 17:21:00 +0100 (CET) Received: by mail-wm1-f47.google.com with SMTP id m18-20020a05600c3b1200b003ed2a3d635eso3717555wms.4 for ; Fri, 17 Mar 2023 09:21:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; t=1679070060; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ybC99T6nUELkQRhess/PjUSmkrx1qIRx2bi9c+rDt+c=; b=PRUFfnRmEdk7daQvL03OfQqtJk4BN8hd+gJ+dAphqkIHII69ccwpRKYoOnHzpXyxN1 NIIwb8A1VZDIFIo2lbx8UlhGQFlZ34If4rKY7UdPhBDL55COBniY5KrC2ZMplRfHZcvm kQVWNY5Jm6Jb6T+TpWdGIyMqH9/3FpwU4IoW/jk2iEUjjBIGbP9lWdgjH8ryeRW355Zf rKXqhZ+cRO1E+5o5/JUAab4lR/DNWcuaAYNCnUCJ3KVupbLz7CSOqtezIFazkmwquGPA WOY1B+7LWHCUxQvEDFMUERPe5aaKdXvivin5GcjzdX9fzsbTla+YIPfYdi2czqCJZWYh R89w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679070060; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ybC99T6nUELkQRhess/PjUSmkrx1qIRx2bi9c+rDt+c=; b=fXEju3JcUYbqkZcAkyRj6xACN2NPm4eecd2mwlzse8rPlxABlfGmWtsBn8FksMsI71 dFfpgAJv1XXBlCa4zZpO1EfGcb5mPjbMvHGR8bETyYX2CrhuGQkw/GlJTg2jy3qZ5Z2F RFwbARNhYiBtLv28uQ2QRfBp9D27K9I4ICoXShvj/TQ/OWs6GLhPrqcUYuPwdCwUjJLF FauDR/jV14wGA5du3ruiOqxbzhcobCCM7m/eXMrM31Y+9wQZQURACz111WZeA7U9mSam niqK9Z6MwDNzEkgNtzMsxplPsN+gYctQPhxRZ5xA5XNlBMKmAvoYkI0v+nd1fCUYrB7s 1LvA== X-Gm-Message-State: AO0yUKVXzipcMfGfMdlfePMUxHd3OwazWgx4vCvDjlUUJou/JaIrT1DZ y2IqvbERs24qQIQ9a8i94ANQQA== X-Google-Smtp-Source: AK7set98pAEzz+rPjI1FVS3W+uX3I4QcjzNfheyfEb8T82oWCsQnNSjPcTr0ywkQlryMj2IwsJaZyw== X-Received: by 2002:a05:600c:4709:b0:3eb:3998:36f1 with SMTP id v9-20020a05600c470900b003eb399836f1mr26448940wmo.41.1679070060381; Fri, 17 Mar 2023 09:21:00 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id i4-20020a05600c354400b003ed6ea156absm3678084wmq.0.2023.03.17.09.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Mar 2023 09:20:59 -0700 (PDT) Date: Fri, 17 Mar 2023 17:20:59 +0100 From: Olivier Matz To: Stephen Hemminger Cc: dev@dpdk.org Subject: Re: [PATCH v4 2/2] testpmd: enable interrupt in interactive mode Message-ID: References: <20230313171905.67720-1-stephen@networkplumber.org> <20230315173132.4044-1-stephen@networkplumber.org> <20230315173132.4044-3-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230315173132.4044-3-stephen@networkplumber.org> 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 Wed, Mar 15, 2023 at 10:31:32AM -0700, Stephen Hemminger wrote: > The setting in terminal handling for both Unix style and > Windows was not ensuring that Ctrl-C character would > cause interrupt. > > This is a first release bug. Testpmd interactive mode has > always disabled control-c handling on Linux. This was a design choice, not a bug. This design choice is discussable today (at that time, dpdk was also running in baremetal without signals or interrupt). The idea was to behave like a shell, i.e. ctrl-c just clears the current line. We may want to change this behavior (I remember an old discussion where Bruce stated that he would prefer ctrl-c to kill the program), but it will have an impact on all cmdline users, so to me it has to be announced. > > Fixes: af75078fece3 ("first public release") > Signed-off-by: Stephen Hemminger > --- > lib/cmdline/cmdline_os_unix.c | 3 ++- > lib/cmdline/cmdline_os_windows.c | 4 ++-- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/lib/cmdline/cmdline_os_unix.c b/lib/cmdline/cmdline_os_unix.c > index 5f9839a15f98..356c5b3f3ca2 100644 > --- a/lib/cmdline/cmdline_os_unix.c > +++ b/lib/cmdline/cmdline_os_unix.c > @@ -16,7 +16,8 @@ terminal_adjust(struct cmdline *cl) > tcgetattr(0, &cl->oldterm); > > memcpy(&term, &cl->oldterm, sizeof(term)); > - term.c_lflag &= ~(ICANON | ECHO | ISIG); > + term.c_lflag &= ~(ICANON | ECHO); > + term.c_lflag |= ISIG; > tcsetattr(0, TCSANOW, &term); > > setbuf(stdin, NULL); > diff --git a/lib/cmdline/cmdline_os_windows.c b/lib/cmdline/cmdline_os_windows.c > index 80863bfc8a00..8cff3b175747 100644 > --- a/lib/cmdline/cmdline_os_windows.c > +++ b/lib/cmdline/cmdline_os_windows.c > @@ -32,10 +32,10 @@ terminal_adjust(struct cmdline *cl) > mode &= ~( > ENABLE_LINE_INPUT | /* no line buffering */ > ENABLE_ECHO_INPUT | /* no echo */ > - ENABLE_PROCESSED_INPUT | /* pass Ctrl+C to program */ > ENABLE_MOUSE_INPUT | /* no mouse events */ > ENABLE_WINDOW_INPUT); /* no window resize events */ > - mode |= ENABLE_VIRTUAL_TERMINAL_INPUT; > + mode |= ENABLE_VIRTUAL_TERMINAL_INPUT | > + ENABLE_PROCESSED_INPUT; /* Ctrl C processed by the system */ > SetConsoleMode(handle, mode); > } > > -- > 2.39.2 >