From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 4E55E58CB for ; Tue, 2 Apr 2019 05:55:03 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Apr 2019 20:55:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,298,1549958400"; d="scan'208";a="287910269" Received: from anandraw-devbx.amr.corp.intel.com ([10.19.242.57]) by orsmga004.jf.intel.com with ESMTP; 01 Apr 2019 20:55:00 -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: Mon, 1 Apr 2019 20:54:55 -0700 Message-Id: <20190402035458.14664-8-anand.rawat@intel.com> X-Mailer: git-send-email 2.17.1.windows.2 In-Reply-To: <20190402035458.14664-1-anand.rawat@intel.com> References: <20190306041634.12976-1-anand.rawat@intel.com> <20190402035458.14664-1-anand.rawat@intel.com> Subject: [dpdk-dev] [PATCH v8 07/10] eal: add headers for compatibility with windows 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: , X-List-Received-Date: Tue, 02 Apr 2019 03:55:04 -0000 Added headers to support windows environment for common source. These headers will have windows specific implementions of the system library apis provided in linux and freebsd. Signed-off-by: Anand Rawat Signed-off-by: Pallavi Kadam Reviewed-by: Jeff Shaw Reviewed-by: Ranjit Menon --- lib/librte_eal/windows/eal/include/fnmatch.h | 48 +++++++++++ lib/librte_eal/windows/eal/include/pthread.h | 27 ++++++ lib/librte_eal/windows/eal/include/regex.h | 88 ++++++++++++++++++++ lib/librte_eal/windows/eal/include/sched.h | 46 ++++++++++ lib/librte_eal/windows/eal/include/unistd.h | 12 +++ 5 files changed, 221 insertions(+) create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h create mode 100644 lib/librte_eal/windows/eal/include/pthread.h create mode 100644 lib/librte_eal/windows/eal/include/regex.h create mode 100644 lib/librte_eal/windows/eal/include/sched.h create mode 100644 lib/librte_eal/windows/eal/include/unistd.h diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h new file mode 100644 index 000000000..41b574312 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/fnmatch.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _FNMATCH_H_ +#define _FNMATCH_H_ + +/** + * This file is required to support the common code in eal_common_log.c + * as Microsoft libc does not contain fnmatch.h. This may be removed in + * future releases. + */ +#ifdef __cplusplus +extern "C" { +#endif + +#define FNM_NOMATCH 1 + +/** + * This function is used for searhing a given string source + * with the given regular expression pattern. + * + * @param pattern + * regular expression notation decribing the pattern to match + * + * @param string + * source string to searcg for the pattern + * + * @param flag + * containing information about the pattern + * + * @return + * if the pattern is found then return 0 or else FNM_NOMATCH + */ +static inline int fnmatch(__rte_unused const char *pattern, + __rte_unused const char *string, + __rte_unused int flags) +{ + /* TODO */ + /* This is a stub, not the expected result */ + return FNM_NOMATCH; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _FNMATCH_H_ */ diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h new file mode 100644 index 000000000..503329266 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/pthread.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _PTHREAD_H_ +#define _PTHREAD_H_ + +/** + * This file is required to support the common code in eal_common_proc.c, + * eal_common_thread.c and common\include\rte_per_lcore.h as Microsoft libc + * does not contain pthread.h. This may be removed in future releases. + */ +#ifdef __cplusplus +extern "C" { +#endif + +/* defining pthread_t type on Windows since there is no in Microsoft libc*/ +typedef uintptr_t pthread_t; + +/* defining pthread_attr_t type on Windows since there is no in Microsoft libc*/ +typedef void *pthread_attr_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _PTHREAD_H_ */ diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h new file mode 100644 index 000000000..c335120e1 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/regex.h @@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _REGEX_H_ +#define _REGEX_H_ + +/** + * This file is required to support the common code in eal_common_log.c + * as Microsoft libc does not contain regex.h. This may be removed in + * future releases. + */ +#ifdef __cplusplus +extern "C" { +#endif + +#define REG_NOMATCH 1 +#define REG_ESPACE 12 + +/* defining regex_t for Windows */ +typedef void *regex_t; +/* defining regmatch_t for Windows */ +typedef void *regmatch_t; + +/** + * The regcomp() function will compile the regular expression + * contained in the string pointed to by the pattern argument + * and place the results in the structure pointed to by preg. + * The cflags argument is the bitwise inclusive OR of zero or + * more of the flags + */ +static inline int regcomp(__rte_unused regex_t *preg, + __rte_unused const char *regex, __rte_unused int cflags) +{ + /* TODO */ + /* This is a stub, not the expected result */ + return REG_ESPACE; +} + +/** + * The regexec() function compares the null-terminated string + * specified by string with the compiled regular expression + * preg initialised by a previous call to regcomp(). If it finds + * a match, regexec() returns 0; otherwise it returns non-zero + * indicating either no match or an error. The eflags argument + * is the bitwise inclusive OR of zero or more of the flags. + */ +static inline int regexec(__rte_unused const regex_t *preg, + __rte_unused const char *string, __rte_unused size_t nmatch, + __rte_unused regmatch_t pmatch[], __rte_unused int eflags) +{ + /* TODO */ + /* This is a stub, not the expected result */ + return REG_NOMATCH; +} + +/** + * The regerror() function provides a mapping from error codes + * returned by regcomp() and regexec() to unspecified printable strings. + */ +static inline size_t regerror(__rte_unused int errcode, + __rte_unused const regex_t *preg, char *errbuf, + __rte_unused size_t errbuf_size) +{ + /* TODO */ + /* This is a stub, not the expected result */ + if (errbuf) { + *errbuf = '\0'; + return 1; + } + return 0; +} + +/** + * The regfree() function frees any memory allocated by regcomp() + * associated with preg. + */ +static inline void regfree(__rte_unused regex_t *preg) +{ + /* TODO */ + /* This is a stub, not the expected result */ +} + +#ifdef __cplusplus +} +#endif + +#endif /* _REGEX_H_ */ diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h new file mode 100644 index 000000000..257060594 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/sched.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _SCHED_H_ +#define _SCHED_H_ + +/** + * This file is added to support the common code in eal_common_thread.c + * as Microsoft libc does not contain sched.h. This may be removed + * in future releases. + */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CPU_SET_SIZE +#define CPU_SET_SIZE RTE_MAX_LCORE +#endif + +#define _BITS_PER_SET (sizeof(long long) * 8) +#define _BIT_SET_MASK (_BITS_PER_SET - 1) + +#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET) +#define _WHICH_SET(b) ((b) / _BITS_PER_SET) +#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1)) + +typedef struct _rte_cpuset_s { + long long _bits[_NUM_SETS(CPU_SET_SIZE)]; +} rte_cpuset_t; + +#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b))) + +#define CPU_ZERO(s) \ + do { \ + unsigned int _i; \ + \ + for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++) \ + (s)->_bits[_i] = 0LL; \ + } while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* _SCHED_H_ */ diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h new file mode 100644 index 000000000..757b7f3c5 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/unistd.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _UNISTD_H_ +#define _UNISTD_H_ +/** + * This file is added to support common code in eal_common_lcore.c + * as Microsoft libc does not contain unistd.h. This may be removed + * in future releases. + */ +#endif /* _UNISTD_H_ */ -- 2.17.1.windows.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id AB192A0679 for ; Tue, 2 Apr 2019 05:55:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 140205F34; Tue, 2 Apr 2019 05:55:17 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 4E55E58CB for ; Tue, 2 Apr 2019 05:55:03 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Apr 2019 20:55:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,298,1549958400"; d="scan'208";a="287910269" Received: from anandraw-devbx.amr.corp.intel.com ([10.19.242.57]) by orsmga004.jf.intel.com with ESMTP; 01 Apr 2019 20:55:00 -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: Mon, 1 Apr 2019 20:54:55 -0700 Message-Id: <20190402035458.14664-8-anand.rawat@intel.com> X-Mailer: git-send-email 2.17.1.windows.2 In-Reply-To: <20190402035458.14664-1-anand.rawat@intel.com> References: <20190306041634.12976-1-anand.rawat@intel.com> <20190402035458.14664-1-anand.rawat@intel.com> Subject: [dpdk-dev] [PATCH v8 07/10] eal: add headers for compatibility with windows 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190402035455.fd01o8Ly0mHSFz_pRk0udjoLJpWGKD-gDvT_rtn0I_0@z> Added headers to support windows environment for common source. These headers will have windows specific implementions of the system library apis provided in linux and freebsd. Signed-off-by: Anand Rawat Signed-off-by: Pallavi Kadam Reviewed-by: Jeff Shaw Reviewed-by: Ranjit Menon --- lib/librte_eal/windows/eal/include/fnmatch.h | 48 +++++++++++ lib/librte_eal/windows/eal/include/pthread.h | 27 ++++++ lib/librte_eal/windows/eal/include/regex.h | 88 ++++++++++++++++++++ lib/librte_eal/windows/eal/include/sched.h | 46 ++++++++++ lib/librte_eal/windows/eal/include/unistd.h | 12 +++ 5 files changed, 221 insertions(+) create mode 100644 lib/librte_eal/windows/eal/include/fnmatch.h create mode 100644 lib/librte_eal/windows/eal/include/pthread.h create mode 100644 lib/librte_eal/windows/eal/include/regex.h create mode 100644 lib/librte_eal/windows/eal/include/sched.h create mode 100644 lib/librte_eal/windows/eal/include/unistd.h diff --git a/lib/librte_eal/windows/eal/include/fnmatch.h b/lib/librte_eal/windows/eal/include/fnmatch.h new file mode 100644 index 000000000..41b574312 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/fnmatch.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _FNMATCH_H_ +#define _FNMATCH_H_ + +/** + * This file is required to support the common code in eal_common_log.c + * as Microsoft libc does not contain fnmatch.h. This may be removed in + * future releases. + */ +#ifdef __cplusplus +extern "C" { +#endif + +#define FNM_NOMATCH 1 + +/** + * This function is used for searhing a given string source + * with the given regular expression pattern. + * + * @param pattern + * regular expression notation decribing the pattern to match + * + * @param string + * source string to searcg for the pattern + * + * @param flag + * containing information about the pattern + * + * @return + * if the pattern is found then return 0 or else FNM_NOMATCH + */ +static inline int fnmatch(__rte_unused const char *pattern, + __rte_unused const char *string, + __rte_unused int flags) +{ + /* TODO */ + /* This is a stub, not the expected result */ + return FNM_NOMATCH; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _FNMATCH_H_ */ diff --git a/lib/librte_eal/windows/eal/include/pthread.h b/lib/librte_eal/windows/eal/include/pthread.h new file mode 100644 index 000000000..503329266 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/pthread.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _PTHREAD_H_ +#define _PTHREAD_H_ + +/** + * This file is required to support the common code in eal_common_proc.c, + * eal_common_thread.c and common\include\rte_per_lcore.h as Microsoft libc + * does not contain pthread.h. This may be removed in future releases. + */ +#ifdef __cplusplus +extern "C" { +#endif + +/* defining pthread_t type on Windows since there is no in Microsoft libc*/ +typedef uintptr_t pthread_t; + +/* defining pthread_attr_t type on Windows since there is no in Microsoft libc*/ +typedef void *pthread_attr_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _PTHREAD_H_ */ diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/windows/eal/include/regex.h new file mode 100644 index 000000000..c335120e1 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/regex.h @@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _REGEX_H_ +#define _REGEX_H_ + +/** + * This file is required to support the common code in eal_common_log.c + * as Microsoft libc does not contain regex.h. This may be removed in + * future releases. + */ +#ifdef __cplusplus +extern "C" { +#endif + +#define REG_NOMATCH 1 +#define REG_ESPACE 12 + +/* defining regex_t for Windows */ +typedef void *regex_t; +/* defining regmatch_t for Windows */ +typedef void *regmatch_t; + +/** + * The regcomp() function will compile the regular expression + * contained in the string pointed to by the pattern argument + * and place the results in the structure pointed to by preg. + * The cflags argument is the bitwise inclusive OR of zero or + * more of the flags + */ +static inline int regcomp(__rte_unused regex_t *preg, + __rte_unused const char *regex, __rte_unused int cflags) +{ + /* TODO */ + /* This is a stub, not the expected result */ + return REG_ESPACE; +} + +/** + * The regexec() function compares the null-terminated string + * specified by string with the compiled regular expression + * preg initialised by a previous call to regcomp(). If it finds + * a match, regexec() returns 0; otherwise it returns non-zero + * indicating either no match or an error. The eflags argument + * is the bitwise inclusive OR of zero or more of the flags. + */ +static inline int regexec(__rte_unused const regex_t *preg, + __rte_unused const char *string, __rte_unused size_t nmatch, + __rte_unused regmatch_t pmatch[], __rte_unused int eflags) +{ + /* TODO */ + /* This is a stub, not the expected result */ + return REG_NOMATCH; +} + +/** + * The regerror() function provides a mapping from error codes + * returned by regcomp() and regexec() to unspecified printable strings. + */ +static inline size_t regerror(__rte_unused int errcode, + __rte_unused const regex_t *preg, char *errbuf, + __rte_unused size_t errbuf_size) +{ + /* TODO */ + /* This is a stub, not the expected result */ + if (errbuf) { + *errbuf = '\0'; + return 1; + } + return 0; +} + +/** + * The regfree() function frees any memory allocated by regcomp() + * associated with preg. + */ +static inline void regfree(__rte_unused regex_t *preg) +{ + /* TODO */ + /* This is a stub, not the expected result */ +} + +#ifdef __cplusplus +} +#endif + +#endif /* _REGEX_H_ */ diff --git a/lib/librte_eal/windows/eal/include/sched.h b/lib/librte_eal/windows/eal/include/sched.h new file mode 100644 index 000000000..257060594 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/sched.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _SCHED_H_ +#define _SCHED_H_ + +/** + * This file is added to support the common code in eal_common_thread.c + * as Microsoft libc does not contain sched.h. This may be removed + * in future releases. + */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CPU_SET_SIZE +#define CPU_SET_SIZE RTE_MAX_LCORE +#endif + +#define _BITS_PER_SET (sizeof(long long) * 8) +#define _BIT_SET_MASK (_BITS_PER_SET - 1) + +#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET) +#define _WHICH_SET(b) ((b) / _BITS_PER_SET) +#define _WHICH_BIT(b) ((b) & (_BITS_PER_SET - 1)) + +typedef struct _rte_cpuset_s { + long long _bits[_NUM_SETS(CPU_SET_SIZE)]; +} rte_cpuset_t; + +#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b))) + +#define CPU_ZERO(s) \ + do { \ + unsigned int _i; \ + \ + for (_i = 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++) \ + (s)->_bits[_i] = 0LL; \ + } while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* _SCHED_H_ */ diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/windows/eal/include/unistd.h new file mode 100644 index 000000000..757b7f3c5 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/unistd.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _UNISTD_H_ +#define _UNISTD_H_ +/** + * This file is added to support common code in eal_common_lcore.c + * as Microsoft libc does not contain unistd.h. This may be removed + * in future releases. + */ +#endif /* _UNISTD_H_ */ -- 2.17.1.windows.2