加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-Don-t-redefine-gettid-if-glibc-provides-it.patch 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
From 04f80ac2c822543f130c30942560e4a3300f8481 Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Tue, 28 Jul 2020 09:41:05 +0800
Subject: [PATCH] Don't redefine gettid if glibc provides it
glibc 2.30+ include a definition for gettid() so that users don't have
to manually define gettid() with syscall().
Old code don't check this, this will redefine gettid() on the latest
versions of glibc, causing build fail.
Signed-off-by: lingsheng <lingsheng@huawei.com>
---
KAE/utils/engine_utils.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/KAE/utils/engine_utils.h b/KAE/utils/engine_utils.h
index 160e449..12a587e 100644
--- a/KAE/utils/engine_utils.h
+++ b/KAE/utils/engine_utils.h
@@ -28,7 +28,15 @@
#include <sys/types.h>
#include <sys/syscall.h>
+#if __GLIBC_PREREQ(2, 30)
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <unistd.h>
+#else
#define gettid() syscall(SYS_gettid)
+#endif
+
#define PRINTPID \
US_DEBUG("pid=%d, ptid=%lu, tid=%d", getpid(), pthread_self(), gettid())
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化