From ecef7e1557e475119ff5c96929d9e378c8379c53 Mon Sep 17 00:00:00 2001 From: dzf Date: Tue, 2 Jan 2024 16:44:10 +0800 Subject: [PATCH] Solve gettid not declared error. Signed-off-by: dzf --- frameworks/libhilog/base/hilog_base.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frameworks/libhilog/base/hilog_base.c b/frameworks/libhilog/base/hilog_base.c index 7e344f6..0eaf669 100644 --- a/frameworks/libhilog/base/hilog_base.c +++ b/frameworks/libhilog/base/hilog_base.c @@ -17,10 +17,14 @@ #include #include +#ifndef __NR_gettid +#define __NR_gettid +#endif #include #include #include #include +#include #include #include #include @@ -33,6 +37,11 @@ const int SOCKET_TYPE = SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC; const int INVALID_SOCKET = -1; const struct sockaddr_un SOCKET_ADDR = {AF_UNIX, SOCKET_FILE_DIR INPUT_SOCKET_NAME}; +pid_t gettid(void) +{ + return syscall(SYS_gettid); +} + static int SendMessage(HilogMsg *header, const char *tag, uint16_t tagLen, const char *fmt, uint16_t fmtLen) { // The hilogbase interface cannot has mutex, so need to re-open and connect to the socketof the hilogd -- Gitee