!58 [sync] PR-55: Replace gettid() with syscall()

From: @openeuler-sync-bot 
Reviewed-by: @wu-changsheng 
Signed-off-by: @wu-changsheng
This commit is contained in:
openeuler-ci-bot 2022-07-26 08:41:41 +00:00 committed by Gitee
commit fa99a91208
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,57 @@
From 35300925c26ce9eba9f4f1c9a4181708da771392 Mon Sep 17 00:00:00 2001
From: Honggang LI <honggangli@163.com>
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 <honggangli@163.com>
---
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 <stdio.h>
#include <sys/syscall.h>
+#include <unistd.h>
#include <rte_log.h>
#include "lwipopts.h"
-extern int gettid(void);
-
#if USE_DPDK_LOG
#define LWIP_LOG_WARN LWIP_DBG_LEVEL_WARNING
--
2.31.1

View File

@ -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 <honggangli@163.com> - 2.1.3-13
- Replace gettid() with syscall()
* Fri Jul 8 2022 xiusailong<xiusailong@huawei.com> - 2.1.3-12
- sync two patches from 20.03-LTS-SP1