1 Star 0 Fork 48

flying-eagle/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0025-Replace-gettid-with-syscall-SYS_gettid.patch 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2024-02-06 10:45 . adapt lwip-2.2.0
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..10d667b 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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/flying-eagle12138/lwip.git
git@gitee.com:flying-eagle12138/lwip.git
flying-eagle12138
lwip
lwip
master

搜索帮助