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 A7CD3A0A0B for ; Tue, 26 Jan 2021 07:33:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98C14141269; Tue, 26 Jan 2021 07:33:13 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 4393114125D; Tue, 26 Jan 2021 07:33:07 +0100 (CET) IronPort-SDR: //0+3WkPfhA+lRwkLGFyS9aj0GZWL7fv5b5N+njsSKJb4Q+3IhxE96E4akGZf2j8SrUOr5E9k/ 8oNGX9KnacMg== X-IronPort-AV: E=McAfee;i="6000,8403,9875"; a="159032832" X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="159032832" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2021 22:33:07 -0800 IronPort-SDR: WxnQuS6mTeXpUUO6KqbzVeLMCXICJ1BGA8ZAXOBhqM46suvJl1GeCDLFtQvkFGdbtlCExo5yG/ XOf4SWoUw5eA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="406597980" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga002.fm.intel.com with ESMTP; 25 Jan 2021 22:33:06 -0800 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 25 Jan 2021 22:33:06 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 25 Jan 2021 22:33:06 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.174) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Mon, 25 Jan 2021 22:33:06 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TAjXgAO3tzaoL0YBU5b/cq0ewWIKCbEe4SAaV72Z5VSkfzCtnQKSdUJx5Die2q3XyWsdLuJ09ZYAgtJDKHAjb9ftzhKZjjaLs/RQO0XARmSwONpPTg+G9YwD/NfdUlm723gxwcxBp/IdfP2A1OdQM+EYm/XbqQ/vIhsJm4uTNjnIDW0agnoL6FYA9yZnV90Fh/3NvBwA9CNm51csNYeQqr5HbymBHlg5dNTfFHJT72Brddd/YvNMeYjETqC3PUautj7HilYPwXBiHmOdxys/DA7OcaQoSwy2gWDz3ZfVZto7Ut9VGX/h1wP18/4BzwhEVG0pOnSwsR7SYYxXxKF/wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zFzMr9ZDbcChEnZ+NIQFeHQ0OEuBapiCOs60zZEiAD0=; b=VyrBQtmN0eMJ+pe9Gut7dEJCFbMkS/tAbeJJquMVwVBNcFzlfcbIzC8wz1xwJFzq+yJxUX6OY1Iudpk2KDgo6EOV3Ad5dsqIn4bySfF9rEMmRBoH3Il/WDnh9uk+brkBSbn0Ehy9CESku0s+adQ9lzUJBXpVN2R1oxmQxKjJ+Whyd7oJvsXGyksRikFD5U5OcT3yD4BmfaaPmBlkv4+0ksHxPuB0ADM5c+wJpttW5qDv/nYnRFF+gmFN2k8HSygC153d1UJReDxKy2svZ2FR+63T/ROTjjM6RE/pm8zQ4+UpZ+mrqRkMVsw/eA/O6yF6ZX/2LaGn8jcZ63ExnLfq3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zFzMr9ZDbcChEnZ+NIQFeHQ0OEuBapiCOs60zZEiAD0=; b=tG0+hjk6+ERt610K+UocZEiXlZf9k5R0TVmzh8Hwa5OsfLQvsVhMlbyvGvLWDIw/5Y6oRSkmmYzGef7FPtPxYgnhtvNNSIumc6pvdaZcGrzWFD7QqkkCte15nqeu6KcSwkOpPMc1lVh7YIDkz4Tbz64b4C0MHZADPgfJKPyyMNw= Received: from CY4PR11MB1750.namprd11.prod.outlook.com (2603:10b6:903:126::8) by CY4PR11MB1928.namprd11.prod.outlook.com (2603:10b6:903:11e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.16; Tue, 26 Jan 2021 06:33:02 +0000 Received: from CY4PR11MB1750.namprd11.prod.outlook.com ([fe80::8fd:c082:f2bc:f6ae]) by CY4PR11MB1750.namprd11.prod.outlook.com ([fe80::8fd:c082:f2bc:f6ae%12]) with mapi id 15.20.3784.016; Tue, 26 Jan 2021 06:33:02 +0000 From: "Li, Xiaoyun" To: "Yu, DapengX" , "Xing, Beilei" , "Lu, Wenzhuo" , "Iremonger, Bernard" , "stephen@networkplumber.org" CC: "dev@dpdk.org" , "Yu, DapengX" , "stable@dpdk.org" Thread-Topic: [PATCH v2] app/testpmd: avoid exit without terminal restore Thread-Index: AQHW8spt/LayJIQFn06t5OmjJENWpao5c7zA Date: Tue, 26 Jan 2021 06:33:02 +0000 Message-ID: References: <20201224035748.67012-1-dapengx.yu@intel.com> <20210125032953.430840-1-dapengx.yu@intel.com> In-Reply-To: <20210125032953.430840-1-dapengx.yu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.37] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1d22499f-eda3-4fde-95a8-08d8c1c43b72 x-ms-traffictypediagnostic: CY4PR11MB1928: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2512; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bIt2tx/cjWWPlgYzd02ubxCDibXtDKGbkLP/24K+uoqDnCtV/oPc/98VdMCrs8EFNQXGh0W7CEJGyxdlKmoEe4P3qQppKuiQMiBhpQJtyumw9XtvTFflTJraBQ+9tHomgX3znTo0dgd2bXlHj3NesJVPjjjCCTba1cZ7yI23dXg5cBwOyPrTLvnh/g0HIoBj28aLmCY8pSvoI77kQOHRWeEarR+j5K+bYUFdLXceCdRAX3a9y8mmh3EGIDfcALL9dNsx1uJBn1JF9KtSt9c2RjCuvLOanBIeupP2E7ul6dwmLb/hwmAnDLC0pSEbrg5v3HMCn8mr+m6/Y54uWBer9/v7qt9W6vOSc963DFCiys8i8viJ8qrLs1yFtljh6YRsa1aKcTE9kITRGiOvg5tck8CVqKrZjdOs7NMhNE7WTR/Z65HZPqa12TB0K5r+Ars/gmW19K+XmHCvEBqc7oVP5ZFGDzA/M06H6emkZN30m+MC4qICGr4Mk6XDJn8NX8HYC0bgxnQlESrLnLn8v0a85w== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB1750.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(136003)(366004)(39860400002)(346002)(396003)(26005)(2906002)(8936002)(76116006)(86362001)(110136005)(53546011)(7696005)(52536014)(33656002)(186003)(9686003)(478600001)(6506007)(66946007)(54906003)(71200400001)(5660300002)(8676002)(64756008)(66556008)(316002)(66476007)(66446008)(4326008)(83380400001)(55016002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?7fRDK5tZrMWUuaXRQt+3QQcep6gZw7IsOl4Wc13M+FbTLAcAjmqk35okh7Jy?= =?us-ascii?Q?NB996K8GYWw/s0Nu8uL4nCKF/Y35b92gtohElxFzzOyaOS9RwaC1PmNRtMoX?= =?us-ascii?Q?Ud2u507eGdFQcb6LAZyR0JBxyBdmxjq4PusZfCofK3g1Y04VMqSdU3vOqcf8?= =?us-ascii?Q?Gy6tXW3io0m24E74vnTSmDVkLjibaDO3QdqDFBeJy6+Ualzb/lFUhhD3kQv8?= =?us-ascii?Q?gSQ6mB5yacE1mcdEeLpHzJFFOdIcgdYm3hArv8Qhj5X8B2cSbHdToXpudP43?= =?us-ascii?Q?CDFs4vMSr2h7rwk9fmH5o8YlZL8lOI6w0FSBAAEAOrmxCuL8VXwKBgOPQbXk?= =?us-ascii?Q?p6aqgcRB5AUYi+u2pImXqu8+INuIV3nlAYbICYUEBkJ8jEzVvcJ5UYEKe12/?= =?us-ascii?Q?tZiPny+1AMuuI7XqTXzlN6SziNFyEg5EeRMJRDuLw+ZlcbW2KHBLVqTQky3m?= =?us-ascii?Q?KFWOVTypIKalYvxuEYvFv6NIYgUVz2uWBps5U2xkogzCw6s/2gq7kV0cguFD?= =?us-ascii?Q?t6iR74Wr4789gDH78my73zLKH5zGtEk4fvz9A/TQPEPIRzFpYB7PFvYEjgDs?= =?us-ascii?Q?t1EM1ixlXKqt1FAq2wvc8T3wM6BAR6gHFTLRYILaF9uqts4ZJ4wVP1jF5TLs?= =?us-ascii?Q?/apM3kgDehISFmivJCuZuPID8sgzSD6WX3XKR4dm31/nVV4JYGOYJ3+FzVza?= =?us-ascii?Q?+2RYy1vgPDTgIMALJ9rJta4C6vTQdsZJIXz6AisYzQdQR6yk3jNY1PYpldBu?= =?us-ascii?Q?YhNaItCucDInLX5cIbWbQ/fiFH7NiGGXtY3cWOTJJCzkZeqZ/ywstp7BLaRC?= =?us-ascii?Q?K70cHkSJPSys/s2CZulFhcmfbpaByO+pBmLesEUsexbY262ohodcP5hmPh0E?= =?us-ascii?Q?K/e2xtVGnL+HQS8tuuAScwJpE41Up2orSqILLzQgVqjwHm5cM5NnrQ486/V6?= =?us-ascii?Q?zJ8rIThqLEykpsiCImbvgKQX0qs+WfkN3eDNE+1DdseBeDESwoce8TpQDRsF?= =?us-ascii?Q?yG7PPJPTok2jUrFNiQHeQd3jYbfS2wNJ33Wryd/LR2Z4429TK9sqUxmNJ1nP?= =?us-ascii?Q?sYzFX4gr?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1750.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d22499f-eda3-4fde-95a8-08d8c1c43b72 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2021 06:33:02.6971 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ArWl8URT6h1rcKV+KXEO3LxeZOYoG0MpOiEPPBlL92bsCg9QVYfQMCPDPNaeqNjcLaJTzbvDpci0jjTVG1nJVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1928 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [PATCH v2] app/testpmd: avoid exit without terminal restore X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi > -----Original Message----- > From: dapengx.yu@intel.com > Sent: Monday, January 25, 2021 11:30 > To: Xing, Beilei ; Li, Xiaoyun ; Lu, > Wenzhuo ; Iremonger, Bernard > ; stephen@networkplumber.org > Cc: dev@dpdk.org; Yu, DapengX ; stable@dpdk.org > Subject: [PATCH v2] app/testpmd: avoid exit without terminal restore >=20 > From: Dapeng Yu >=20 > In interactive mode, if testpmd exit by calling rte_exit without restore = terminal > attributes, terminal will not echo keyboard input. >=20 > register a function with atexit() in prompt(), when exit() in > rte_exit() is called, the registered function restores terminal attribute= s. >=20 > Fixes: 5a8fb55c48ab ("app/testpmd: support unidirectional configuration") > Cc: stable@dpdk.org >=20 > Signed-off-by: Dapeng Yu > --- > app/test-pmd/cmdline.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) >=20 > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > 89034c8b7..f7e18ba3d 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -17116,6 +17116,7 @@ cmdline_read_from_file(const char *filename) > void > prompt(void) > { > + int ret; > /* initialize non-constant commands */ > cmd_set_fwd_mode_init(); > cmd_set_fwd_retry_mode_init(); > @@ -17123,15 +17124,23 @@ prompt(void) > testpmd_cl =3D cmdline_stdin_new(main_ctx, "testpmd> "); > if (testpmd_cl =3D=3D NULL) > return; > + > + ret =3D atexit(prompt_exit); > + if (ret !=3D 0) > + printf("Cannot set exit function for cmdline\n"); > + > cmdline_interact(testpmd_cl); > - cmdline_stdin_exit(testpmd_cl); > + if (ret !=3D 0) Why do you need to check ret here? Even if registers prompt_exit failed, when users type "quit" and then break= from cmdline_interact(), cmdline_stdin_exit() should be called to restore = terminal settings. > + cmdline_stdin_exit(testpmd_cl); > } >=20 > void > prompt_exit(void) > { > - if (testpmd_cl !=3D NULL) > + if (testpmd_cl !=3D NULL) { > cmdline_quit(testpmd_cl); > + cmdline_stdin_exit(testpmd_cl); > + } > } >=20 > static void > -- > 2.27.0