整改代码不同步问题

Signed-off-by: liaoxingxing <liaoxingbin@h-partners.com>
This commit is contained in:
liaoxingxing 2024-09-02 15:48:55 +08:00
parent 195290a135
commit a7fa5b06de
7 changed files with 21 additions and 18 deletions

1
.gitattributes vendored
View File

@ -1 +0,0 @@
test/fixtures/lorem_ipsum.txt text eol=lf

View File

@ -246,13 +246,13 @@ if (defined(ohos_lite)) {
if (is_mac || (defined(is_ios) && is_ios)) {
sources += nonwin_srcs + [
"src/unix/bsd-ifaddrs.c",
"src/unix/kqueue.c",
"src/unix/random-getentropy.c",
"src/unix/darwin-proctitle.c",
"src/unix/darwin.c",
"src/unix/fsevents.c",
"src/unix/os390-proctitle.c",
"src/unix/kqueue.c",
"src/unix/log_unix.c",
"src/unix/os390-proctitle.c",
"src/unix/random-getentropy.c",
"src/unix/trace_unix.c",
]
} else if (is_mingw || is_win) {
@ -289,10 +289,10 @@ if (defined(ohos_lite)) {
sources += nonwin_srcs + [
"src/unix/linux.c",
"src/unix/procfs-exepath.c",
"src/unix/proctitle.c",
"src/unix/random-getentropy.c",
"src/unix/random-getrandom.c",
"src/unix/random-sysctl-linux.c",
"src/unix/proctitle.c",
]
if (libuv_use_ffrt) {
external_deps += [ "ffrt:libffrt" ]
@ -307,9 +307,11 @@ if (defined(ohos_lite)) {
"hitrace:hitrace_meter",
]
}
if (is_ohos && enable_async_stack) {
sources += [ "src/dfx/async_stack/libuv_async_stack.c" ]
}
if (is_android) {
sources += [
"src/win/log_win.c",
@ -319,20 +321,20 @@ if (defined(ohos_lite)) {
} else if (is_linux) {
sources += nonwin_srcs + [
"src/unix/linux.c",
"src/unix/log_unix.c",
"src/unix/procfs-exepath.c",
"src/unix/proctitle.c",
"src/unix/random-getrandom.c",
"src/unix/random-sysctl-linux.c",
"src/unix/proctitle.c",
"src/unix/log_unix.c",
"src/unix/trace_unix.c",
]
} else {
sources += nonwin_srcs + [
"src/unix/linux.c",
"src/unix/procfs-exepath.c",
"src/unix/proctitle.c",
"src/unix/random-getrandom.c",
"src/unix/random-sysctl-linux.c",
"src/unix/proctitle.c",
]
}
subsystem_name = "thirdparty"

View File

@ -226,6 +226,7 @@ typedef enum {
#define UV_EVENT_MAGIC_OFFSET 0x12345ULL
#define UV_EVENT_MAGIC_OFFSETBITS 44
/* Handle types. */
typedef struct uv_loop_s uv_loop_t;
typedef struct uv_handle_s uv_handle_t;
@ -1953,6 +1954,7 @@ UV_EXTERN void uv_loop_set_data(uv_loop_t*, void* data);
UV_EXTERN int uv_register_task_to_event(struct uv_loop_s* loop, uv_post_task func, void* handler);
UV_EXTERN int uv_unregister_task_to_event(struct uv_loop_s* loop);
UV_EXTERN int uv_check_data_valid(struct uv_loop_data* data);
/* String utilities needed internally for dealing with Windows. */
size_t uv_utf16_length_as_wtf8(const uint16_t* utf16,
ssize_t utf16_len);

View File

@ -177,7 +177,7 @@ HEAP_EXPORT(void heap_remove(struct heap* heap,
path >>= 1;
k -= 1;
}
heap->nelts -= 1;
/* Unlink the max node. */

View File

@ -35,6 +35,9 @@
#include "ffrt_inner.h"
#endif
#include <stdio.h>
#ifdef ASYNC_STACKTRACE
#include "dfx/async_stack/libuv_async_stack.h"
#endif
#define MAX_THREADPOOL_SIZE 1024
#define UV_TRACE_NAME "UV_TRACE"
@ -53,10 +56,6 @@ static struct uv__queue run_slow_work_message;
static struct uv__queue slow_io_pending_wq;
#ifdef ASYNC_STACKTRACE
#include "dfx/async_stack/libuv_async_stack.h"
#endif
#ifdef UV_STATISTIC
#define MAX_DUMP_QUEUE_SIZE 200
static uv_mutex_t dump_queue_mutex;
@ -634,7 +633,7 @@ static int uv__work_cancel(uv_loop_t* loop, uv_req_t* req, struct uv__work* w) {
uv__loop_internal_fields_t* lfields = uv__get_internal_fields(w->loop);
int qos = (ffrt_qos_t)(intptr_t)req->reserved[0];
if (uv_check_data_valid((struct uv_loop_data*)(loop->data)) == 0) {
if (uv_check_data_valid((struct uv_loop_data*)(w->loop->data)) == 0) {
int status = (w->work == uv__cancelled) ? UV_ECANCELED : 0;
struct uv_loop_data* addr = (struct uv_loop_data*)((uint64_t)w->loop->data -
(UV_EVENT_MAGIC_OFFSET << UV_EVENT_MAGIC_OFFSETBITS));
@ -666,7 +665,7 @@ void uv__work_done(uv_async_t* handle) {
return;
}
rdunlock_closed_uv_loop_rwlock();
uv_mutex_lock(&loop->wq_mutex);
#ifndef USE_FFRT
uv__queue_move(&loop->wq, &wq);

View File

@ -97,7 +97,6 @@ int uv_timer_start(uv_timer_t* handle,
(struct heap_node*) &handle->heap_node,
timer_less_than);
uv__handle_start(handle);
#ifdef __linux__
if (uv_check_data_valid((struct uv_loop_data*)handle->loop->data) == 0) {
uv_async_send(&handle->loop->wq_async);

View File

@ -1954,13 +1954,13 @@ int uv_register_task_to_event(struct uv_loop_s* loop, uv_post_task func, void* h
#endif
}
int uv_unregister_task_to_event(struct uv_loop_s* loop)
{
#if defined(__aarch64__)
if (loop == NULL || loop->data == NULL ||
((uint64_t)loop->data >> UV_EVENT_MAGIC_OFFSETBITS) != (uint64_t)(UV_EVENT_MAGIC_OFFSET))
return -1;
loop->data = (struct uv_loop_data*)((uint64_t)loop->data -
(UV_EVENT_MAGIC_OFFSET << UV_EVENT_MAGIC_OFFSETBITS));
free(loop->data);
@ -1971,6 +1971,7 @@ int uv_unregister_task_to_event(struct uv_loop_s* loop)
#endif
}
int uv_check_data_valid(struct uv_loop_data* data) {
#if defined(__aarch64__)
if (data == NULL || ((uint64_t)data >> UV_EVENT_MAGIC_OFFSETBITS) != (uint64_t)(UV_EVENT_MAGIC_OFFSET)) {
@ -1986,4 +1987,5 @@ int uv_check_data_valid(struct uv_loop_data* data) {
#else
return -1;
#endif
}
}