From cae06a12e4e238608562c9a1bb5103d720f33021 Mon Sep 17 00:00:00 2001 From: Honggang LI Date: Tue, 12 Jul 2022 10:23:50 +0800 Subject: [PATCH] Replace gettid() with syscall() Signed-off-by: Honggang LI (cherry picked from commit db4399852a6440c5b97cd884d1fe94216ecb73c5) --- ...place-gettid-with-syscall-SYS_gettid.patch | 57 +++++++++++++++++++ lwip.spec | 6 +- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 0025-Replace-gettid-with-syscall-SYS_gettid.patch diff --git a/0025-Replace-gettid-with-syscall-SYS_gettid.patch b/0025-Replace-gettid-with-syscall-SYS_gettid.patch new file mode 100644 index 0000000..92abd14 --- /dev/null +++ b/0025-Replace-gettid-with-syscall-SYS_gettid.patch @@ -0,0 +1,57 @@ +From 35300925c26ce9eba9f4f1c9a4181708da771392 Mon Sep 17 00:00:00 2001 +From: Honggang LI +Date: Tue, 12 Jul 2022 10:15:36 +0800 +Subject: [PATCH] Replace gettid() with syscall(SYS_gettid) + +Remove gettid() to address a backport issue for gazelle library. + +Signed-off-by: Honggang LI +--- + src/include/arch/cc.h | 4 ++-- + src/include/lwiplog.h | 3 +-- + 2 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/include/arch/cc.h b/src/include/arch/cc.h +index 222b0c9..aa18573 100644 +--- a/src/include/arch/cc.h ++++ b/src/include/arch/cc.h +@@ -62,7 +62,7 @@ void alloc_memp_##name##_base(void) \ + memp_pools[MEMP_##name] = &memp_ ## name; \ + \ + char mpname[MEMZONE_NAMESIZE] = {0}; \ +- snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", gettid(), #name); \ ++ snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", (int)syscall(SYS_gettid), #name); \ + memp_memory_##name##_base = \ + sys_hugepage_malloc(mpname, LWIP_MEM_ALIGN_BUFFER(__size)); \ + memp_pools[MEMP_##name]->base = memp_memory_##name##_base; \ +@@ -73,7 +73,7 @@ PER_THREAD uint8_t *variable_name; \ + void alloc_memory_##variable_name(void) \ + { \ + char mpname[MEMZONE_NAMESIZE] = {0}; \ +- snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", gettid(), #variable_name); \ ++ snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", (int)syscall(SYS_gettid), #variable_name); \ + (variable_name) = \ + sys_hugepage_malloc(mpname, LWIP_MEM_ALIGN_BUFFER(size)); \ + } +diff --git a/src/include/lwiplog.h b/src/include/lwiplog.h +index 6fccac8..011ed21 100644 +--- a/src/include/lwiplog.h ++++ b/src/include/lwiplog.h +@@ -35,13 +35,12 @@ + + #include + #include ++#include + + #include + + #include "lwipopts.h" + +-extern int gettid(void); +- + #if USE_DPDK_LOG + + #define LWIP_LOG_WARN LWIP_DBG_LEVEL_WARNING +-- +2.31.1 + diff --git a/lwip.spec b/lwip.spec index 050c4a2..8005c65 100644 --- a/lwip.spec +++ b/lwip.spec @@ -4,7 +4,7 @@ Summary: lwip is a small independent implementation of the TCP/IP protocol suite Name: lwip Version: 2.1.3 -Release: 12 +Release: 13 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.tar.gz @@ -36,6 +36,7 @@ Patch9020: 0021-refactor-event-if-ring-is-full-the-node-is-added-to-.patch Patch9021: 0022-notify-app-that-sock-state-changes-to-CLOSE_WAIT.patch Patch9022: 0023-refactor-event-and-checksum-offload-support.patch Patch9023: 0024-refactor-pkt-read-send-performance.patch +Patch9024: 0025-Replace-gettid-with-syscall-SYS_gettid.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -64,6 +65,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Tue Jul 12 2022 Honggang Li - 2.1.3-13 +- Replace gettid() with syscall() + * Fri Jul 8 2022 xiusailong - 2.1.3-12 - sync two patches from 20.03-LTS-SP1 -- Gitee