From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730092.outbound.protection.outlook.com [40.107.73.92]) by dpdk.org (Postfix) with ESMTP id 183421B1F5 for ; Tue, 26 Mar 2019 17:33:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z2bktZ8rKZldf+MERQBm50IBTiBD5eDULQgAZA2sTjk=; b=osFfZVpFcOh8Z1YLWAFGTU0tVmvvnpHPeQ/tAl+6U5XIkXQqU1d12jVb0YuBe9u+FDKHs2FB5zux5m7119kitnuFzoid3jxkEsXnkkDuVo4bwo9MgpUbKUJWscbx9Z9C/eMLRgwC4IIe0JhSeFNtrvkAQIHCjpItui8nA2PBZxg= Received: from MWHPR21MB0638.namprd21.prod.outlook.com (10.175.141.139) by MWHPR21MB0176.namprd21.prod.outlook.com (10.173.52.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.3; Tue, 26 Mar 2019 16:33:03 +0000 Received: from MWHPR21MB0638.namprd21.prod.outlook.com ([fe80::c4e7:ece1:887e:b983]) by MWHPR21MB0638.namprd21.prod.outlook.com ([fe80::c4e7:ece1:887e:b983%3]) with mapi id 15.20.1771.002; Tue, 26 Mar 2019 16:33:03 +0000 From: Harini Ramakrishnan To: Anand Rawat , "dev@dpdk.org" CC: "pallavi.kadam@intel.com" , "ranjit.menon@intel.com" , "jeffrey.b.shaw@intel.com" , "bruce.richardson@intel.com" , "thomas@monjalon.net" Thread-Topic: [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment Thread-Index: AQHU45mtRc152FbyQ0+GqulEnV5hhqYeG8gQ Date: Tue, 26 Mar 2019 16:33:03 +0000 Message-ID: References: <20190306041634.12976-1-anand.rawat@intel.com> <20190326060238.9884-1-anand.rawat@intel.com> <20190326060238.9884-6-anand.rawat@intel.com> In-Reply-To: <20190326060238.9884-6-anand.rawat@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=haramakr@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2019-03-26T16:33:01.1508043Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=70b2720c-d66c-4244-9602-525f0527976f; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic x-originating-ip: [131.107.147.44] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bb31225d-c5c4-4e9d-5634-08d6b208b7ff x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:MWHPR21MB0176; x-ms-traffictypediagnostic: MWHPR21MB0176: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Harini.Ramakrishnan@microsoft.com; x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1201; x-forefront-prvs: 09888BC01D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(346002)(376002)(366004)(136003)(13464003)(189003)(199004)(72206003)(102836004)(316002)(8936002)(256004)(478600001)(3846002)(105586002)(76176011)(7696005)(6436002)(74316002)(106356001)(22452003)(7736002)(81166006)(10090500001)(5660300002)(25786009)(4326008)(81156014)(305945005)(2501003)(2906002)(229853002)(8990500004)(6116002)(53936002)(55016002)(6246003)(71190400001)(71200400001)(14454004)(9686003)(68736007)(52536014)(86612001)(446003)(10290500003)(11346002)(86362001)(476003)(26005)(186003)(99286004)(54906003)(110136005)(97736004)(6506007)(66066001)(53546011)(33656002)(486006); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR21MB0176; H:MWHPR21MB0638.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 5yDCU9c44GaU+v651Bt+G3Y+oFXU+yspBGYHszA5+HyIEq3U4caRtYb+QzsnyNlRQM3+fVsCzB6EG8VECuDgBe5W4hf0cDQInvPxmx6e9WchnyMA0gu5OR9bcM3EdFnt5vEKhAt+iVLG4Q1/fdGKrcaFgqd0MowsoNmaHO79jXdTgoqbEs6fRho4XorZfsUkP9yLaYmLJy3HQWbNdFqBiNqsjDC0HlvK6hhnEDihKsXUvbzs8WvikAh1rvc7WeSpVcKkDIyjPuwl1+R5zYWwTxRbDPvXTvcQPBrc1eX2+n01fJN92XYNAnIQFBJVi16C9fb2f9z4MLbuEs7o/Ky8mzN8eURFtFMxqGhziD6Y7Rr+JzJ92t3Ev3/qwcLjLx6AqOYe9jCKpa46Fn65uFfgjMEKhIOqfL2sD8fK/gD3MVQ= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb31225d-c5c4-4e9d-5634-08d6b208b7ff X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Mar 2019 16:33:03.4499 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR21MB0176 Subject: Re: [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment 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, 26 Mar 2019 16:33:05 -0000 -----Original Message----- From: dev On Behalf Of Anand Rawat Sent: Monday, March 25, 2019 11:03 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 v5 5/8] eal: add headers for compatibility with = windows environment Added headers to support windows environment for common source. These headers will have windows specific implementions of the system librar= y apis provided in linux and freebsd. Signed-off-by: Anand Rawat Signed-off-by: Pallavi Kadam Reviewed-by: Jeff Shaw Reviewed-by: Ranjit Menon Acked-by: Harini Ramakrishnan --- lib/librte_eal/windows/eal/include/fnmatch.h | 43 ++++++++++ lib/librte_e= al/windows/eal/include/pthread.h | 22 ++++++ lib/librte_eal/windows/eal/include/regex.h | 83 ++++++++++++++++++++ lib/librte_eal/windows/eal/include/sched.h | 41 ++++++++++ lib/librte_eal/windows/eal/include/unistd.h | 8 ++ 5 files changed, 197 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..c2e2131b1 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/fnmatch.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _FNMATCH_H_ +#define _FNMATCH_H_ + +#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..a62b25bf6 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/pthread.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _PTHREAD_H_ +#define _PTHREAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* defining pthread_t type on windows */ typedef uintptr_t pthread_t; + +/* defining pthread_attr_t type on windows */ typedef void=20 +*pthread_attr_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _PTHREAD_H_ */ diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/wi= ndows/eal/include/regex.h new file mode 100644 index 000000000..daa102f74 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/regex.h @@ -0,0 +1,83 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _REGEX_H_ +#define _REGEX_H_ + +#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 =3D '\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/wi= ndows/eal/include/sched.h new file mode 100644 index 000000000..b105c43c3 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/sched.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _SCHED_H_ +#define _SCHED_H_ + +#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=20 +(_BITS_PER_SET - 1) + +#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET) #define=20 +_WHICH_SET(b) ((b) / _BITS_PER_SET) #define _WHICH_BIT(b) ((b) &=20 +(_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)] |=3D (1LL <<=20 +_WHICH_BIT(b))) + +#define CPU_ZERO(s) \ + do { \ + unsigned int _i; \ + \ + for (_i =3D 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++) \ + (s)->_bits[_i] =3D 0LL; \ + } while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* _SCHED_H_ */ diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/w= indows/eal/include/unistd.h new file mode 100644 index 000000000..fe3d9b579 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/unistd.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +/* Added to support common code on windows */ #ifndef _UNISTD_H_=20 +#define _UNISTD_H_ #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 EA0BDA05D3 for ; Tue, 26 Mar 2019 17:33:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9B6271B2AF; Tue, 26 Mar 2019 17:33:06 +0100 (CET) Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730092.outbound.protection.outlook.com [40.107.73.92]) by dpdk.org (Postfix) with ESMTP id 183421B1F5 for ; Tue, 26 Mar 2019 17:33:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z2bktZ8rKZldf+MERQBm50IBTiBD5eDULQgAZA2sTjk=; b=osFfZVpFcOh8Z1YLWAFGTU0tVmvvnpHPeQ/tAl+6U5XIkXQqU1d12jVb0YuBe9u+FDKHs2FB5zux5m7119kitnuFzoid3jxkEsXnkkDuVo4bwo9MgpUbKUJWscbx9Z9C/eMLRgwC4IIe0JhSeFNtrvkAQIHCjpItui8nA2PBZxg= Received: from MWHPR21MB0638.namprd21.prod.outlook.com (10.175.141.139) by MWHPR21MB0176.namprd21.prod.outlook.com (10.173.52.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.3; Tue, 26 Mar 2019 16:33:03 +0000 Received: from MWHPR21MB0638.namprd21.prod.outlook.com ([fe80::c4e7:ece1:887e:b983]) by MWHPR21MB0638.namprd21.prod.outlook.com ([fe80::c4e7:ece1:887e:b983%3]) with mapi id 15.20.1771.002; Tue, 26 Mar 2019 16:33:03 +0000 From: Harini Ramakrishnan To: Anand Rawat , "dev@dpdk.org" CC: "pallavi.kadam@intel.com" , "ranjit.menon@intel.com" , "jeffrey.b.shaw@intel.com" , "bruce.richardson@intel.com" , "thomas@monjalon.net" Thread-Topic: [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment Thread-Index: AQHU45mtRc152FbyQ0+GqulEnV5hhqYeG8gQ Date: Tue, 26 Mar 2019 16:33:03 +0000 Message-ID: References: <20190306041634.12976-1-anand.rawat@intel.com> <20190326060238.9884-1-anand.rawat@intel.com> <20190326060238.9884-6-anand.rawat@intel.com> In-Reply-To: <20190326060238.9884-6-anand.rawat@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=haramakr@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2019-03-26T16:33:01.1508043Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=70b2720c-d66c-4244-9602-525f0527976f; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic x-originating-ip: [131.107.147.44] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bb31225d-c5c4-4e9d-5634-08d6b208b7ff x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:MWHPR21MB0176; x-ms-traffictypediagnostic: MWHPR21MB0176: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Harini.Ramakrishnan@microsoft.com; x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1201; x-forefront-prvs: 09888BC01D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(346002)(376002)(366004)(136003)(13464003)(189003)(199004)(72206003)(102836004)(316002)(8936002)(256004)(478600001)(3846002)(105586002)(76176011)(7696005)(6436002)(74316002)(106356001)(22452003)(7736002)(81166006)(10090500001)(5660300002)(25786009)(4326008)(81156014)(305945005)(2501003)(2906002)(229853002)(8990500004)(6116002)(53936002)(55016002)(6246003)(71190400001)(71200400001)(14454004)(9686003)(68736007)(52536014)(86612001)(446003)(10290500003)(11346002)(86362001)(476003)(26005)(186003)(99286004)(54906003)(110136005)(97736004)(6506007)(66066001)(53546011)(33656002)(486006); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR21MB0176; H:MWHPR21MB0638.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 5yDCU9c44GaU+v651Bt+G3Y+oFXU+yspBGYHszA5+HyIEq3U4caRtYb+QzsnyNlRQM3+fVsCzB6EG8VECuDgBe5W4hf0cDQInvPxmx6e9WchnyMA0gu5OR9bcM3EdFnt5vEKhAt+iVLG4Q1/fdGKrcaFgqd0MowsoNmaHO79jXdTgoqbEs6fRho4XorZfsUkP9yLaYmLJy3HQWbNdFqBiNqsjDC0HlvK6hhnEDihKsXUvbzs8WvikAh1rvc7WeSpVcKkDIyjPuwl1+R5zYWwTxRbDPvXTvcQPBrc1eX2+n01fJN92XYNAnIQFBJVi16C9fb2f9z4MLbuEs7o/Ky8mzN8eURFtFMxqGhziD6Y7Rr+JzJ92t3Ev3/qwcLjLx6AqOYe9jCKpa46Fn65uFfgjMEKhIOqfL2sD8fK/gD3MVQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb31225d-c5c4-4e9d-5634-08d6b208b7ff X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Mar 2019 16:33:03.4499 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR21MB0176 Subject: Re: [dpdk-dev] [PATCH v5 5/8] eal: add headers for compatibility with windows environment 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" Message-ID: <20190326163303.QbmR554L4ysqP3uaKcOP_4gbzRzcV-MTBxX7XjKj63g@z> -----Original Message----- From: dev On Behalf Of Anand Rawat Sent: Monday, March 25, 2019 11:03 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 v5 5/8] eal: add headers for compatibility with = windows environment Added headers to support windows environment for common source. These headers will have windows specific implementions of the system librar= y apis provided in linux and freebsd. Signed-off-by: Anand Rawat Signed-off-by: Pallavi Kadam Reviewed-by: Jeff Shaw Reviewed-by: Ranjit Menon Acked-by: Harini Ramakrishnan --- lib/librte_eal/windows/eal/include/fnmatch.h | 43 ++++++++++ lib/librte_e= al/windows/eal/include/pthread.h | 22 ++++++ lib/librte_eal/windows/eal/include/regex.h | 83 ++++++++++++++++++++ lib/librte_eal/windows/eal/include/sched.h | 41 ++++++++++ lib/librte_eal/windows/eal/include/unistd.h | 8 ++ 5 files changed, 197 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..c2e2131b1 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/fnmatch.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _FNMATCH_H_ +#define _FNMATCH_H_ + +#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..a62b25bf6 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/pthread.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _PTHREAD_H_ +#define _PTHREAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* defining pthread_t type on windows */ typedef uintptr_t pthread_t; + +/* defining pthread_attr_t type on windows */ typedef void=20 +*pthread_attr_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _PTHREAD_H_ */ diff --git a/lib/librte_eal/windows/eal/include/regex.h b/lib/librte_eal/wi= ndows/eal/include/regex.h new file mode 100644 index 000000000..daa102f74 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/regex.h @@ -0,0 +1,83 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _REGEX_H_ +#define _REGEX_H_ + +#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 =3D '\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/wi= ndows/eal/include/sched.h new file mode 100644 index 000000000..b105c43c3 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/sched.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +#ifndef _SCHED_H_ +#define _SCHED_H_ + +#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=20 +(_BITS_PER_SET - 1) + +#define _NUM_SETS(b) (((b) + _BIT_SET_MASK) / _BITS_PER_SET) #define=20 +_WHICH_SET(b) ((b) / _BITS_PER_SET) #define _WHICH_BIT(b) ((b) &=20 +(_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)] |=3D (1LL <<=20 +_WHICH_BIT(b))) + +#define CPU_ZERO(s) \ + do { \ + unsigned int _i; \ + \ + for (_i =3D 0; _i < _NUM_SETS(CPU_SET_SIZE); _i++) \ + (s)->_bits[_i] =3D 0LL; \ + } while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* _SCHED_H_ */ diff --git a/lib/librte_eal/windows/eal/include/unistd.h b/lib/librte_eal/w= indows/eal/include/unistd.h new file mode 100644 index 000000000..fe3d9b579 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/unistd.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +/* Added to support common code on windows */ #ifndef _UNISTD_H_=20 +#define _UNISTD_H_ #endif /* _UNISTD_H_ */ -- 2.17.1.windows.2