From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anand Rawat Subject: [PATCH v7 2/8] eal: add header files to support os specifics Date: Thu, 28 Mar 2019 16:24:45 -0700 Message-ID: <20190328232451.16988-3-anand.rawat@intel.com> References: <20190306041634.12976-1-anand.rawat@intel.com> <20190328232451.16988-1-anand.rawat@intel.com> 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 To: dev@dpdk.org Return-path: 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) In-Reply-To: <20190328232451.16988-1-anand.rawat@intel.com> 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 -- 2.17.1.windows.2