• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 35300925c26ce9eba9f4f1c9a4181708da771392 Mon Sep 17 00:00:00 2001
2From: Honggang LI <honggangli@163.com>
3Date: Tue, 12 Jul 2022 10:15:36 +0800
4Subject: [PATCH] Replace gettid() with syscall(SYS_gettid)
5
6Remove gettid() to address a backport issue for gazelle library.
7
8Signed-off-by: Honggang LI <honggangli@163.com>
9---
10 src/include/arch/cc.h | 4 ++--
11 src/include/lwiplog.h | 3 +--
12 2 files changed, 3 insertions(+), 4 deletions(-)
13
14diff --git a/src/include/arch/cc.h b/src/include/arch/cc.h
15index 222b0c9..aa18573 100644
16--- a/src/include/arch/cc.h
17+++ b/src/include/arch/cc.h
18@@ -62,7 +62,7 @@ void alloc_memp_##name##_base(void) \
19     memp_pools[MEMP_##name] = &memp_ ## name; \
20     \
21     char mpname[MEMZONE_NAMESIZE] = {0}; \
22-    snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", gettid(), #name); \
23+    snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", (int)syscall(SYS_gettid), #name); \
24     memp_memory_##name##_base = \
25         sys_hugepage_malloc(mpname, LWIP_MEM_ALIGN_BUFFER(__size)); \
26     memp_pools[MEMP_##name]->base = memp_memory_##name##_base; \
27@@ -73,7 +73,7 @@ PER_THREAD uint8_t *variable_name; \
28 void alloc_memory_##variable_name(void) \
29 { \
30     char mpname[MEMZONE_NAMESIZE] = {0}; \
31-    snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", gettid(), #variable_name); \
32+    snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", (int)syscall(SYS_gettid), #variable_name); \
33     (variable_name) = \
34         sys_hugepage_malloc(mpname, LWIP_MEM_ALIGN_BUFFER(size)); \
35 }
36diff --git a/src/include/lwiplog.h b/src/include/lwiplog.h
37index 6fccac8..011ed21 100644
38--- a/src/include/lwiplog.h
39+++ b/src/include/lwiplog.h
40@@ -35,13 +35,12 @@
41
42 #include <stdio.h>
43 #include <sys/syscall.h>
44+#include <unistd.h>
45
46 #include <rte_log.h>
47
48 #include "lwipopts.h"
49
50-extern int gettid(void);
51-
52 #if USE_DPDK_LOG
53
54 #define LWIP_LOG_WARN   LWIP_DBG_LEVEL_WARNING
55--
562.31.1
57
58