-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdisable-hilog.patch
More file actions
131 lines (120 loc) · 4.13 KB
/
disable-hilog.patch
File metadata and controls
131 lines (120 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
project third_party/musl/
diff --git a/ldso/linux/dynlink.c b/ldso/linux/dynlink.c
index d27b728ee..313d923a7 100644
--- a/ldso/linux/dynlink.c
+++ b/ldso/linux/dynlink.c
@@ -3778,9 +3778,6 @@ void __dls3(size_t *sp, size_t *auxv, size_t *aux)
InitParameterClient();
#endif
-#if defined (ENABLE_MUSL_LOG) && !defined(__LITEOS__)
- InitHilogSocketFd();
-#endif
#if defined(__aarch64__) && (!defined(__LITEOS__))
InstallPACHandler();
#endif
diff --git a/porting/linux/user/src/hilog/hilog_adapter.c b/porting/linux/user/src/hilog/hilog_adapter.c
index bfe1a34cb..c73c50250 100644
--- a/porting/linux/user/src/hilog/hilog_adapter.c
+++ b/porting/linux/user/src/hilog/hilog_adapter.c
@@ -69,32 +69,7 @@ static void Cleanup()
static int GetSocketFdInstance()
{
- if (g_socketFd == INVALID_SOCKET || fcntl(g_socketFd, F_GETFL) == -1) {
- pthread_mutex_lock(&g_lock);
- if (g_socketFd == INVALID_SOCKET || fcntl(g_socketFd, F_GETFL) == -1) {
- int tempSocketFd = TEMP_FAILURE_RETRY(socket(AF_UNIX, SOCKET_TYPE, 0));
- if (tempSocketFd < 0) {
- dprintf(ERROR_FD, "HiLogAdapter: Can't create socket! Errno: %d\n", errno);
- pthread_mutex_unlock(&g_lock);
- return tempSocketFd;
- }
-
- long int result =
- TEMP_FAILURE_RETRY(connect(tempSocketFd, (const struct sockaddr *)(&SOCKET_ADDR), sizeof(SOCKET_ADDR)));
- if (result < 0) {
- dprintf(ERROR_FD, "HiLogAdapter: Can't connect to server. Errno: %d\n", errno);
- if (tempSocketFd >= 0) {
- __close(tempSocketFd);
- }
- pthread_mutex_unlock(&g_lock);
- return result;
- }
- g_socketFd = tempSocketFd;
- atexit(Cleanup);
- }
- pthread_mutex_unlock(&g_lock);
- }
- return g_socketFd;
+ return -1;
}
static int SendMessage(HilogMsg *header, const char *tag, uint16_t tagLen, const char *fmt, uint16_t fmtLen)
@@ -172,23 +147,12 @@ int HiLogAdapterVaList(LogType type, LogLevel level, unsigned int domain, const
bool is_musl_log_enable()
{
- if (getpid() == 1) {
- return false;
- }
- return musl_log_enable;
+ return false;
}
bool HiLogAdapterIsLoggable(unsigned int domain, const char *tag, LogLevel level)
{
- if (tag == NULL || level < g_logLevel || level <= LOG_LEVEL_MIN || level >= LOG_LEVEL_MAX) {
- return false;
- }
-
- if (!is_musl_log_enable()) {
- return false;
- }
-
- return true;
+ return false;
}
#ifdef OHOS_ENABLE_PARAMETER
diff --git a/src/hilog/linux/hilog_adapter.c b/src/hilog/linux/hilog_adapter.c
index df9d343a5..9764930f1 100644
--- a/src/hilog/linux/hilog_adapter.c
+++ b/src/hilog/linux/hilog_adapter.c
@@ -65,19 +65,7 @@ extern int __close(int fd);
// only generate a new socketFd
static int GenerateHilogSocketFd()
{
- int socketFd = TEMP_FAILURE_RETRY(socket(AF_UNIX, SOCKET_TYPE, 0));
- if (socketFd == INVALID_SOCKET) {
- dprintf(ERROR_FD, "HiLogAdapter_init: Can't create socket! Errno: %d\n", errno);
- return INVALID_SOCKET;
- }
- long int result =
- TEMP_FAILURE_RETRY(connect(socketFd, (const struct sockaddr *)(&SOCKET_ADDR), sizeof(SOCKET_ADDR)));
- if (result == INVALID_RESULT) {
- dprintf(ERROR_FD, "HiLogAdapter_init: Can't connect to server. Errno: %d\n", errno);
- __close(socketFd);
- return INVALID_SOCKET;
- }
- return socketFd;
+ return -1;
}
HILOG_LOCAL_API
@@ -248,23 +236,12 @@ int HiLogAdapterVaList(LogType type, LogLevel level, unsigned int domain, const
bool is_musl_log_enable()
{
- if (getpid() == 1) {
- return false;
- }
- return musl_log_enable;
+ return false;
}
bool HiLogAdapterIsLoggable(unsigned int domain, const char *tag, LogLevel level)
{
- if (tag == NULL || level < g_logLevel || level <= LOG_LEVEL_MIN || level >= LOG_LEVEL_MAX) {
- return false;
- }
-
- if (!is_musl_log_enable()) {
- return false;
- }
-
- return true;
+ return false;
}
bool HiLogBaseIsLoggable(unsigned int domain, const char *tag, LogLevel level)