Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/88055/?format=api
http://patches.dpdk.org/api/patches/88055/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210221012831.14643-8-dmitry.kozliuk@gmail.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20210221012831.14643-8-dmitry.kozliuk@gmail.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210221012831.14643-8-dmitry.kozliuk@gmail.com", "date": "2021-02-21T01:28:31", "name": "[v2,7/7] eal/windows: do not expose POSIX symbols", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "64dee44befdcd3a153a3440a6463e09092690b14", "submitter": { "id": 1581, "url": "http://patches.dpdk.org/api/people/1581/?format=api", "name": "Dmitry Kozlyuk", "email": "dmitry.kozliuk@gmail.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210221012831.14643-8-dmitry.kozliuk@gmail.com/mbox/", "series": [ { "id": 15320, "url": "http://patches.dpdk.org/api/series/15320/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15320", "date": "2021-02-21T01:28:24", "name": "eal/windows: do not expose POSIX symbols", "version": 2, "mbox": "http://patches.dpdk.org/series/15320/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/88055/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/88055/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 5ADD3A034F;\n\tSun, 21 Feb 2021 02:29:27 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 446CB22A288;\n\tSun, 21 Feb 2021 02:28:51 +0100 (CET)", "from mail-lj1-f176.google.com (mail-lj1-f176.google.com\n [209.85.208.176])\n by mails.dpdk.org (Postfix) with ESMTP id 3601A22A26E\n for <dev@dpdk.org>; Sun, 21 Feb 2021 02:28:47 +0100 (CET)", "by mail-lj1-f176.google.com with SMTP id e8so5723234ljj.5\n for <dev@dpdk.org>; Sat, 20 Feb 2021 17:28:47 -0800 (PST)", "from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru.\n [37.110.65.23])\n by smtp.gmail.com with ESMTPSA id d5sm1401666lfe.232.2021.02.20.17.28.45\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sat, 20 Feb 2021 17:28:46 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=VGTbFC6BAAP7FC4WGTcjkH+HAq6/LlWUGZSmcrrUGZE=;\n b=C1GfupZNT9b7UMNyIjUdpwq2z9wzazL+U3GenuuU93BjglTPdaukmHSlXqPSBeoGVL\n t7KpLXuC6cjN5jE7+v+mVV9WZgLAWF5ioo6RcQEWOcVam2mmVFWZS7Ojl+nwjxOurl3t\n IivSIHVnT0HN1OZPzm0o5JS3AzNUevmGxR7a5B2Ztg+1nK73pZR5omlEMAawhoNXIZ9X\n Vm9t8gvx8xefBQZePrNKgoYn7LRtjz/j8R+rKR5omiV0f9BXPxfEZ6NWSdCZI5qsmzTj\n 9sTZjsuVyww2+pj2u3xP/f9nKnr2MU6GBvnjy2+xE93iclgLhyGOz2DK88l4F/7Corb0\n pqNg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=VGTbFC6BAAP7FC4WGTcjkH+HAq6/LlWUGZSmcrrUGZE=;\n b=Lh3IatJYmf+WEYeSrqo9Jnium8DkoT2JEFWEMBBATtAfPqUOfogTu+p9Pb7bRTRlac\n CDdMpXvVjThi166rZ6+/uQMd64k7URbIssvmMsHUD+3pU/BJT7yocK8sSmD2949UG3CA\n Q1qQ4WlUvf+gr+MiqoVCMOuke7vPNYQsv5MIGODuSDuiw+4hoUhGbOkSp8p4Kx4DbRGX\n eiaihFFk6BhwecbpGzAfkZzrpybz7ntFkPrL7EbmCBwiomw1vmCDDqjrlyqY+HpInt2V\n ikAI9TBgUU3sPvXUcocjfBZ5et9N8Xtfn++hQcqsGh23KLTqUEQE1fDTV+PT0QnPXzt6\n wOrQ==", "X-Gm-Message-State": "AOAM533NnEx0erUoUPGr0HfVVNIVeKMuEHjWJdO+SMY2OylgWNowS0cH\n s8Z8QRG0SAo0hGQnt2Jh6huV4Lldu+qsSRde", "X-Google-Smtp-Source": "\n ABdhPJzL+ISRLy17OVfBUlS9ZPFlqSsFrhpePuXW6wqpgGE9onNoGR1h3E+NefduUuqnXzFidXhpTA==", "X-Received": "by 2002:a19:f60c:: with SMTP id x12mr443164lfe.156.1613870926502;\n Sat, 20 Feb 2021 17:28:46 -0800 (PST)", "From": "Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>", "To": "dev@dpdk.org", "Cc": "Tyler Retzlaff <roretzla@microsoft.com>,\n Nick Connolly <nick.connolly@mayadata.io>,\n Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,\n Bruce Richardson <bruce.richardson@intel.com>,\n Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,\n Dmitry Malloy <dmitrym@microsoft.com>,\n Pallavi Kadam <pallavi.kadam@intel.com>", "Date": "Sun, 21 Feb 2021 04:28:31 +0300", "Message-Id": "<20210221012831.14643-8-dmitry.kozliuk@gmail.com>", "X-Mailer": "git-send-email 2.29.2", "In-Reply-To": "<20210221012831.14643-1-dmitry.kozliuk@gmail.com>", "References": "<20210220232910.772-1-dmitry.kozliuk@gmail.com>\n <20210221012831.14643-1-dmitry.kozliuk@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v2 7/7] eal/windows: do not expose POSIX symbols", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Exposing POSIX symbols could break consumer POSIX compatibility code.\n\n* Make renaming of close() and unlink() private to EAL.\n\n* Remove renaming of strncasecmp(), strtok_r(), and sleep()\n in favor of using EAL wrappers. Similarly remove PATH_MAX macro.\n\n* Replace index(3p), which is not available on Windows, with strchr(3),\n as recommended by POSIX.1-2008. strerror_r() is only used inside EAL,\n rename it only where it's needed. Same for asprintf(), it has an\n internal EAL wrapper and is removed from public API.\n\nSigned-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>\n---\n doc/guides/rel_notes/release_21_05.rst | 9 ++\n lib/librte_eal/common/eal_common_errno.c | 4 +\n lib/librte_eal/common/eal_common_options.c | 2 +-\n lib/librte_eal/common/eal_private.h | 5 ++\n lib/librte_eal/freebsd/include/rte_os.h | 4 +-\n lib/librte_eal/linux/include/rte_os.h | 4 +-\n lib/librte_eal/windows/include/rte_os.h | 99 ++--------------------\n 7 files changed, 29 insertions(+), 98 deletions(-)", "diff": "diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst\nindex 5aa9ed7db..6380dfa53 100644\n--- a/doc/guides/rel_notes/release_21_05.rst\n+++ b/doc/guides/rel_notes/release_21_05.rst\n@@ -84,6 +84,15 @@ API Changes\n Also, make sure to start the actual text at the margin.\n =======================================================\n \n+* eal/windows: Removed POSIX symbols from EAL headers. Exposing POSIX symbols\n+ has been incorrect and could conflict with consumer POSIX implementations.\n+ Wrappers are provided for\n+ ``strtok_r(3p)`` (``rte_strtok``),\n+ ``strncasecmp(3p)`` (``rte_strncasecmp``),\n+ ``sleep(3p)`` (``rte_thread_sleep``),\n+ ``PATH_MAX`` (``RTE_PATH_MAX``).\n+ Removed are ``strerror_r(3p)`` and ``asprintf(3p)``.\n+\n \n ABI Changes\n -----------\ndiff --git a/lib/librte_eal/common/eal_common_errno.c b/lib/librte_eal/common/eal_common_errno.c\nindex 2a10fb823..536eea0c3 100644\n--- a/lib/librte_eal/common/eal_common_errno.c\n+++ b/lib/librte_eal/common/eal_common_errno.c\n@@ -15,6 +15,10 @@\n #include <rte_errno.h>\n #include <rte_string_fns.h>\n \n+#ifdef RTE_EXEC_ENV_WINDOWS\n+#define strerror_r(a, b, c) strerror_s(b, c, a)\n+#endif\n+\n RTE_DEFINE_PER_LCORE(int, _rte_errno);\n \n const char *\ndiff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c\nindex 275f879d7..fd3b22e8a 100644\n--- a/lib/librte_eal/common/eal_common_options.c\n+++ b/lib/librte_eal/common/eal_common_options.c\n@@ -1936,7 +1936,7 @@ eal_check_common_options(struct internal_config *internal_cfg)\n \t\tRTE_LOG(ERR, EAL, \"Invalid length of --\" OPT_MBUF_POOL_OPS_NAME\" option\\n\");\n \t\treturn -1;\n \t}\n-\tif (index(eal_get_hugefile_prefix(), '%') != NULL) {\n+\tif (strchr(eal_get_hugefile_prefix(), '%') != NULL) {\n \t\tRTE_LOG(ERR, EAL, \"Invalid char, '%%', in --\"OPT_FILE_PREFIX\" \"\n \t\t\t\"option\\n\");\n \t\treturn -1;\ndiff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex a5d9c5123..860551661 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -756,4 +756,9 @@ int eal_asprintf(char **buffer, const char *format, ...);\n #define eal_asprintf asprintf\n #endif\n \n+#ifdef RTE_EXEC_ENV_WINDOWS\n+#define close _close\n+#define unlink _unlink\n+#endif\n+\n #endif /* _EAL_PRIVATE_H_ */\ndiff --git a/lib/librte_eal/freebsd/include/rte_os.h b/lib/librte_eal/freebsd/include/rte_os.h\nindex b37d59b5e..a5bf10021 100644\n--- a/lib/librte_eal/freebsd/include/rte_os.h\n+++ b/lib/librte_eal/freebsd/include/rte_os.h\n@@ -6,9 +6,9 @@\n #define _RTE_OS_H_\n \n /**\n- * This is header should contain any function/macro definition\n+ * This header should contain any function/macro definition\n * which are not supported natively or named differently in the\n- * freebsd OS. Functions will be added in future releases.\n+ * freebsd OS. It must not define symbols without \"rte_\" prefix.\n */\n \n #include <pthread_np.h>\ndiff --git a/lib/librte_eal/linux/include/rte_os.h b/lib/librte_eal/linux/include/rte_os.h\nindex af7d052d9..04f510eec 100644\n--- a/lib/librte_eal/linux/include/rte_os.h\n+++ b/lib/librte_eal/linux/include/rte_os.h\n@@ -6,9 +6,9 @@\n #define _RTE_OS_H_\n \n /**\n- * This is header should contain any function/macro definition\n+ * This header should contain any function/macro definition\n * which are not supported natively or named differently in the\n- * linux OS. Functions will be added in future releases.\n+ * linux OS. It must not define symbols without \"rte_\" prefix.\n */\n \n #include <sched.h>\ndiff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h\nindex edca11bd2..9c9c31214 100644\n--- a/lib/librte_eal/windows/include/rte_os.h\n+++ b/lib/librte_eal/windows/include/rte_os.h\n@@ -6,15 +6,11 @@\n #define _RTE_OS_H_\n \n /**\n- * This is header should contain any function/macro definition\n- * which are not supported natively or named differently in the\n- * Windows OS. It must not include Windows-specific headers.\n+ * This header should contain any function/macro definition\n+ * which are not supported natively or named differently in Windows OS.\n */\n \n-#include <stdarg.h>\n-#include <stdio.h>\n #include <stdlib.h>\n-#include <string.h>\n \n #ifdef __cplusplus\n extern \"C\" {\n@@ -22,101 +18,18 @@ extern \"C\" {\n \n #define RTE_PATH_MAX _MAX_PATH\n \n-/* limits.h replacement, value as in <windows.h> */\n-#ifndef PATH_MAX\n-#define PATH_MAX _MAX_PATH\n-#endif\n-\n-#ifndef sleep\n-#define sleep(x) Sleep(1000 * (x))\n-#endif\n-\n-#ifndef strerror_r\n-#define strerror_r(a, b, c) strerror_s(b, c, a)\n-#endif\n-\n-#ifndef strdup\n-/* strdup is deprecated in Microsoft libc and _strdup is preferred */\n-#define strdup(str) _strdup(str)\n-#endif\n-\n-#ifndef strtok_r\n-#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)\n-#endif\n-\n-#ifndef index\n-#define index(a, b) strchr(a, b)\n-#endif\n-\n-#ifndef rindex\n-#define rindex(a, b) strrchr(a, b)\n-#endif\n-\n-#ifndef strncasecmp\n-#define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)\n-#endif\n-\n-#ifndef close\n-#define close _close\n-#endif\n-\n-#ifndef unlink\n-#define unlink _unlink\n-#endif\n-\n /* cpu_set macros implementation */\n #define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)\n #define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)\n #define RTE_CPU_FILL(set) CPU_FILL(set)\n #define RTE_CPU_NOT(dst, src) CPU_NOT(dst, src)\n \n-/* as in <windows.h> */\n+/* This is an exception without \"rte_\" prefix, because Windows does have\n+ * ssize_t, but it's defined in <windows.h> which we avoid to expose.\n+ * If ssize_t is defined in user code, it necessarily has the same type.\n+ */\n typedef long long ssize_t;\n \n-#ifndef RTE_TOOLCHAIN_GCC\n-\n-static inline int\n-asprintf(char **buffer, const char *format, ...)\n-{\n-\tint size, ret;\n-\tva_list arg;\n-\n-\tva_start(arg, format);\n-\tsize = vsnprintf(NULL, 0, format, arg);\n-\tva_end(arg);\n-\tif (size < 0)\n-\t\treturn -1;\n-\tsize++;\n-\n-\t*buffer = (char *)malloc(size);\n-\tif (*buffer == NULL)\n-\t\treturn -1;\n-\n-\tva_start(arg, format);\n-\tret = vsnprintf(*buffer, size, format, arg);\n-\tva_end(arg);\n-\tif (ret != size - 1) {\n-\t\tfree(*buffer);\n-\t\treturn -1;\n-\t}\n-\treturn ret;\n-}\n-\n-static inline const char *\n-eal_strerror(int code)\n-{\n-\tstatic char buffer[128];\n-\n-\tstrerror_s(buffer, sizeof(buffer), code);\n-\treturn buffer;\n-}\n-\n-#ifndef strerror\n-#define strerror eal_strerror\n-#endif\n-\n-#endif /* RTE_TOOLCHAIN_GCC */\n-\n #ifdef __cplusplus\n }\n #endif\n", "prefixes": [ "v2", "7/7" ] }{ "id": 88055, "url": "