[v6,2/8] eal: add header files to support os specifics
Checks
Commit Message
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 <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
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 +++++++++++++++++++
lib/meson.build | 7 ++++-
6 files changed, 61 insertions(+), 3 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
Comments
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Wednesday, March 27, 2019 7:21 PM
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
Subject: [dpdk-dev] [PATCH v6 2/8] eal: add header files to support os specifics
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 <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
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 +++++++++++++++++++
lib/meson.build | 7 ++++-
6 files changed, 61 insertions(+), 3 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 <rte_config.h>
+/* os specific include */
+#include <rte_os.h>
+
#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 <stdio.h>
#include <string.h>
+#include <rte_common.h>
+
/**
* 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 <BaseTsd.h>
+
+/* 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/lib/meson.build b/lib/meson.build index 99957ba7d..a81faf0ed 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
# process all libraries equally, as far as possible @@ -64,6 +64,11 @@ foreach l:libraries
dir_name = 'librte_' + l
subdir(dir_name)
+ if host_machine.system() == 'windows'
+ # injecting rte_os.h in every library in windows
+ includes += include_directories('librte_eal/windows/eal/include/exec-env')
+ endif
+
if build
enabled_libs += name
dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
--
2.17.1.windows.2
@@ -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 <rte_config.h>
+/* os specific include */
+#include <rte_os.h>
+
#ifndef typeof
#define typeof __typeof__
#endif
@@ -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 <stdio.h>
#include <string.h>
+#include <rte_common.h>
+
/**
* Takes string "string" parameter and splits it at character "delim"
* up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like
new file mode 100644
@@ -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_ */
new file mode 100644
@@ -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_ */
new file mode 100644
@@ -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 <BaseTsd.h>
+
+/* 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_ */
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
# process all libraries equally, as far as possible
@@ -64,6 +64,11 @@ foreach l:libraries
dir_name = 'librte_' + l
subdir(dir_name)
+ if host_machine.system() == 'windows'
+ # injecting rte_os.h in every library in windows
+ includes += include_directories('librte_eal/windows/eal/include/exec-env')
+ endif
+
if build
enabled_libs += name
dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)