From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <anand.rawat@intel.com>
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by dpdk.org (Postfix) with ESMTP id 0C3425B12
 for <dev@dpdk.org>; Thu, 28 Mar 2019 03:21:16 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga006.fm.intel.com ([10.253.24.20])
 by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 27 Mar 2019 19:21:16 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,278,1549958400"; d="scan'208";a="331369609"
Received: from anandraw-devbx.amr.corp.intel.com ([10.19.242.57])
 by fmsmga006.fm.intel.com with ESMTP; 27 Mar 2019 19:21:15 -0700
From: Anand Rawat <anand.rawat@intel.com>
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: Wed, 27 Mar 2019 19:21:09 -0700
Message-Id: <20190328022115.4660-3-anand.rawat@intel.com>
X-Mailer: git-send-email 2.17.1.windows.2
In-Reply-To: <20190328022115.4660-1-anand.rawat@intel.com>
References: <20190306041634.12976-1-anand.rawat@intel.com>
 <20190328022115.4660-1-anand.rawat@intel.com>
Subject: [dpdk-dev] [PATCH v6 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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 28 Mar 2019 02:21:17 -0000

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

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 38DB2A05D3
	for <public@inbox.dpdk.org>; Thu, 28 Mar 2019 03:21:18 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 095BD5B3C;
	Thu, 28 Mar 2019 03:21:18 +0100 (CET)
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by dpdk.org (Postfix) with ESMTP id 0C3425B12
 for <dev@dpdk.org>; Thu, 28 Mar 2019 03:21:16 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga006.fm.intel.com ([10.253.24.20])
 by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 27 Mar 2019 19:21:16 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,278,1549958400"; d="scan'208";a="331369609"
Received: from anandraw-devbx.amr.corp.intel.com ([10.19.242.57])
 by fmsmga006.fm.intel.com with ESMTP; 27 Mar 2019 19:21:15 -0700
From: Anand Rawat <anand.rawat@intel.com>
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: Wed, 27 Mar 2019 19:21:09 -0700
Message-Id: <20190328022115.4660-3-anand.rawat@intel.com>
X-Mailer: git-send-email 2.17.1.windows.2
In-Reply-To: <20190328022115.4660-1-anand.rawat@intel.com>
References: <20190306041634.12976-1-anand.rawat@intel.com>
 <20190328022115.4660-1-anand.rawat@intel.com>
Subject: [dpdk-dev] [PATCH v6 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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <20190328022109.guiD2C13czFQiVUubCa6cGgikrn4hxpOGJA4m8LGIaA@z>

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