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 CCE62A034F; Tue, 23 Feb 2021 10:45:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B61C14068B; Tue, 23 Feb 2021 10:45:08 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id EA2D240041 for ; Tue, 23 Feb 2021 10:45:07 +0100 (CET) IronPort-SDR: hU2UUb2CbpkfycQ7+/1in88BXU81eZubReCJwvrzvdfdG0xk/ut+M+7hgBwe/TfwWTYyFHExWH qtKQTPg9BivQ== X-IronPort-AV: E=McAfee;i="6000,8403,9903"; a="184862413" X-IronPort-AV: E=Sophos;i="5.81,199,1610438400"; d="scan'208";a="184862413" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 01:45:07 -0800 IronPort-SDR: B09BNRiCZmX1/yWzlkeNe9A5bmgj5sVVpq0XURejgx8v96kds8XsUmNY37pDz1M8skiPgEU40L RIAQBTpxlzrw== X-IronPort-AV: E=Sophos;i="5.81,199,1610438400"; d="scan'208";a="403088198" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.16.220]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 23 Feb 2021 01:45:05 -0800 Date: Tue, 23 Feb 2021 09:45:02 +0000 From: Bruce Richardson To: Dmitry Kozlyuk Cc: Nick Connolly , dev@dpdk.org, Tyler Retzlaff , Jerin Jacob , Sunil Kumar Kori Message-ID: <20210223094502.GB79@bricha3-MOBL.ger.corp.intel.com> References: <20210220232910.772-1-dmitry.kozliuk@gmail.com> <20210221012831.14643-1-dmitry.kozliuk@gmail.com> <20210221012831.14643-2-dmitry.kozliuk@gmail.com> <20210222114743.GA1235@bricha3-MOBL.ger.corp.intel.com> <64c1e6c5-ce80-b550-b8ea-ad2a6bfe7505@mayadata.io> <20210222142625.GA704@bricha3-MOBL.ger.corp.intel.com> <20210223015750.31516c2c@sovereign> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210223015750.31516c2c@sovereign> Subject: Re: [dpdk-dev] [PATCH v2 1/7] eal: add wrappers for POSIX string functions 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 Sender: "dev" On Tue, Feb 23, 2021 at 01:57:50AM +0300, Dmitry Kozlyuk wrote: > 2021-02-22 14:26, Bruce Richardson: > > As you say, though, the main issue will be whether we have instances in > > public header files or not. I would hope that no static inline functions in > > DPDK use any of the functions in question, but I'm not sure. Perhaps if > > there are instances in public headers those could be reworked to not use > > the problematic functions. > > No instances of strdup(), strncasecmp(), or strtok_r() in any DPDK headers. > > > For any functions, such as strdup, which are not in a public header I would > > suggest the following as a possible start point, based off what was done > > for strlcpy. > > > > * In DPDK (probably EAL), define an rte_strdup function for use as a > > fallback. > > * Inside the meson build scripts, use "cc.has_function()" to check if the > > regular strdup function is available. If not, then add "-DRTE_NO_STRDUP" > > to the c_args for DPDK building > > * Inside our DPDK header (rte_string_fns.h in the strdup case), we can add > > a conditional define such as: > > #ifdef RTE_NO_STRDUP > > #define strdup(s) rte_strdup(s) > > #endif > > > > Thoughts on this? > > Looks good to me, I can rework the patchset like so. > > Policy considerations: > 1. The approach only applies to platform-agnostic functions, like str*(). > Functions like sleep() still belong to librte_eal. > 2. Deprecated functions, like index(3p), should be replaced > with alternatives suggested by the standard. > 3. If a standard C11 alternative is available, it should be used. > This mostly applies to types, like u_int32 -> uint32_t > (it's even in DPDK coding style already, isn't it?). > > A nit: RTE_NO_XXX -> RTE_HAS_XXX (for consistency with existing macros)? Sure, thanks.