From patchwork Thu Mar 28 23:24:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Rawat X-Patchwork-Id: 51873 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5AF5E3572; Fri, 29 Mar 2019 00:25:03 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 00F5623D for ; Fri, 29 Mar 2019 00:24:54 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2019 16:24:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,282,1549958400"; d="scan'208";a="311303594" Received: from anandraw-devbx.amr.corp.intel.com ([10.19.242.57]) by orsmga005.jf.intel.com with ESMTP; 28 Mar 2019 16:24:52 -0700 From: Anand Rawat To: dev@dpdk.org Cc: anand.rawat@intel.com, pallavi.kadam@intel.com, ranjit.menon@intel.com, jeffrey.b.shaw@intel.com, bruce.richardson@intel.com, thomas@monjalon.net Date: Thu, 28 Mar 2019 16:24:45 -0700 Message-Id: <20190328232451.16988-3-anand.rawat@intel.com> X-Mailer: git-send-email 2.17.1.windows.2 In-Reply-To: <20190328232451.16988-1-anand.rawat@intel.com> References: <20190306041634.12976-1-anand.rawat@intel.com> <20190328232451.16988-1-anand.rawat@intel.com> Subject: [dpdk-dev] [PATCH v7 2/8] eal: add header files to support os specifics X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Added rte_os.h files to support os specific functionality. Updated rte_common.h to include rte_os.h. Updated lib/meson.build to inject rte_os.h in every library. Signed-off-by: Anand Rawat Signed-off-by: Pallavi Kadam Reviewed-by: Jeff Shaw Reviewed-by: Ranjit Menon --- lib/librte_eal/common/include/rte_common.h | 5 +++- .../common/include/rte_string_fns.h | 4 ++- .../freebsd/eal/include/exec-env/rte_os.h | 10 +++++++ .../linux/eal/include/exec-env/rte_os.h | 8 +++++ .../windows/eal/include/exec-env/rte_os.h | 30 +++++++++++++++++++ meson.build | 6 ++-- 6 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h create mode 100644 lib/librte_eal/linux/eal/include/exec-env/rte_os.h create mode 100644 lib/librte_eal/windows/eal/include/exec-env/rte_os.h diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index bcf8afd39..3e4768f4a 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2014 Intel Corporation + * Copyright(c) 2010-2019 Intel Corporation */ #ifndef _RTE_COMMON_H_ @@ -24,6 +24,9 @@ extern "C" { #include +/* os specific include */ +#include + #ifndef typeof #define typeof __typeof__ #endif diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h index 85bfe6c9a..8bac8243c 100644 --- a/lib/librte_eal/common/include/rte_string_fns.h +++ b/lib/librte_eal/common/include/rte_string_fns.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2014 Intel Corporation + * Copyright(c) 2010-2019 Intel Corporation */ /** @@ -18,6 +18,8 @@ extern "C" { #include #include +#include + /** * Takes string "string" parameter and splits it at character "delim" * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like diff --git a/lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h b/lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h new file mode 100644 index 000000000..bda0c2d92 --- /dev/null +++ b/lib/librte_eal/freebsd/eal/include/exec-env/rte_os.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _RTE_OS_H_ +#define _RTE_OS_H_ + +/* stub file for os specific logic */ + +#endif /* _RTE_OS_H_ */ diff --git a/lib/librte_eal/linux/eal/include/exec-env/rte_os.h b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h new file mode 100644 index 000000000..c43ec6da5 --- /dev/null +++ b/lib/librte_eal/linux/eal/include/exec-env/rte_os.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _RTE_OS_H_ +#define _RTE_OS_H_ + +#endif /* _RTE_OS_H_ */ diff --git a/lib/librte_eal/windows/eal/include/exec-env/rte_os.h b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h new file mode 100644 index 000000000..65230cae9 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/exec-env/rte_os.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _RTE_OS_H_ +#define _RTE_OS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* macro substitution for windows supported strerror_r */ +#define strerror_r(a, b, c) strerror_s(b, c, a) + +/* macro substitution for windows supported strdup */ +#define strdup(str) _strdup(str) + +/* macro substitution for windows supported ssize_t type */ +typedef SSIZE_T ssize_t; + +/* macro substitution for windows supported strtok_r */ +#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr) + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_OS_H_ */ diff --git a/meson.build b/meson.build index fa6bf3d07..62eb6b8cf 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation +# Copyright(c) 2017-2019 Intel Corporation project('DPDK', 'C', # Get version number from file. @@ -23,7 +23,9 @@ dpdk_app_link_libraries = [] # configure the build, and make sure configs here and in config folder are # able to be included in any file. We also store a global array of include dirs # for passing to pmdinfogen scripts -global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include') +global_inc = include_directories('.', 'config', + 'lib/librte_eal/common/include', + 'lib/librte_eal/@0@/eal/include/exec-env'.format(host_machine.system())) subdir('config') # build libs and drivers