!148 [sync] PR-146: fix epoll_wait report events0
From: @openeuler-sync-bot Reviewed-by: @wu-changsheng Signed-off-by: @wu-changsheng
This commit is contained in:
commit
3ca2e6da49
69
0145-add-unix_prefix-in-gazellectl.patch
Normal file
69
0145-add-unix_prefix-in-gazellectl.patch
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
From 633f4f3303847c80575af4002394a70669f2a373 Mon Sep 17 00:00:00 2001
|
||||||
|
From: kircher <majun65@huawei.com>
|
||||||
|
Date: Fri, 18 Nov 2022 16:29:38 +0800
|
||||||
|
Subject: [PATCH 06/10] add unix_prefix in gazellectl
|
||||||
|
|
||||||
|
---
|
||||||
|
src/ltran/ltran_dfx.c | 28 +++++++++++++++++-----------
|
||||||
|
1 file changed, 17 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
|
||||||
|
index 5d2c305..c505822 100644
|
||||||
|
--- a/src/ltran/ltran_dfx.c
|
||||||
|
+++ b/src/ltran/ltran_dfx.c
|
||||||
|
@@ -164,26 +164,32 @@ static int32_t dfx_connect_ltran(bool use_ltran, bool probe)
|
||||||
|
printf("%s:%d memset_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ ret = strncpy_s(addr.sun_path, sizeof(addr.sun_path), GAZELLE_RUN_DIR,
|
||||||
|
+ strlen(GAZELLE_RUN_DIR) + 1);
|
||||||
|
+ if (ret != EOK) {
|
||||||
|
+ printf("%s:%d strncpy_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (g_unix_prefix) {
|
||||||
|
- ret = strncat_s(addr.sun_path, sizeof(addr.sun_path), GAZELLE_RUN_DIR,
|
||||||
|
- strlen(GAZELLE_RUN_DIR) + 1);
|
||||||
|
+ ret = strncat_s(addr.sun_path, sizeof(addr.sun_path), g_unix_prefix,
|
||||||
|
+ strlen(g_unix_prefix) + 1);
|
||||||
|
if (ret != EOK) {
|
||||||
|
- printf("%s:%d strncpy_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
|
||||||
|
+ printf("%s:%d strncat_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addr.sun_family = AF_UNIX;
|
||||||
|
if (use_ltran) {
|
||||||
|
- ret = strncat_s(addr.sun_path, sizeof(addr.sun_path), GAZELLE_DFX_SOCK_PATHNAME,
|
||||||
|
- strlen(GAZELLE_DFX_SOCK_PATHNAME) + 1);
|
||||||
|
+ ret = strncat_s(addr.sun_path, sizeof(addr.sun_path), GAZELLE_DFX_SOCK_FILENAME,
|
||||||
|
+ strlen(GAZELLE_DFX_SOCK_FILENAME) + 1);
|
||||||
|
if (ret != EOK) {
|
||||||
|
- printf("%s:%d strncpy_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
|
||||||
|
+ printf("%s:%d strncat_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
- ret = strncat_s(addr.sun_path, sizeof(addr.sun_path), GAZELLE_REG_SOCK_PATHNAME,
|
||||||
|
- strlen(GAZELLE_REG_SOCK_PATHNAME) + 1);
|
||||||
|
+ ret = strncat_s(addr.sun_path, sizeof(addr.sun_path), GAZELLE_REG_SOCK_FILENAME,
|
||||||
|
+ strlen(GAZELLE_REG_SOCK_FILENAME) + 1);
|
||||||
|
if (ret != EOK) {
|
||||||
|
- printf("%s:%d strncpy_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
|
||||||
|
+ printf("%s:%d strncat_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -915,8 +921,8 @@ static void gazelle_print_lstack_stat_conn(void *buf, const struct gazelle_stat_
|
||||||
|
static void show_usage(void)
|
||||||
|
{
|
||||||
|
printf("Usage: gazellectl [-h | help] \n"
|
||||||
|
- " or: gazellectl ltran {quit | show | set} [LTRAN_OPTIONS] \n"
|
||||||
|
- " or: gazellectl lstack {show | set} ip [LSTACK_OPTIONS] \n \n"
|
||||||
|
+ " or: gazellectl ltran {quit | show | set} [LTRAN_OPTIONS] [-u UNIX_PREFIX]\n"
|
||||||
|
+ " or: gazellectl lstack {show | set} ip [LSTACK_OPTIONS] [-u UNIX_PREFIX]\n \n"
|
||||||
|
" quit ltran process exit \n \n"
|
||||||
|
" where LTRAN_OPTIONS := \n"
|
||||||
|
" show: \n"
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
75
0146-fix-epoll_wait-report-event0.patch
Normal file
75
0146-fix-epoll_wait-report-event0.patch
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
From d5fefe68d8f4bdc7e7828b1477b1eba30457c383 Mon Sep 17 00:00:00 2001
|
||||||
|
From: jiangheng <jiangheng14@huawei.com>
|
||||||
|
Date: Fri, 2 Dec 2022 11:08:41 +0800
|
||||||
|
Subject: [PATCH 10/10] fix epoll_wait report event0
|
||||||
|
|
||||||
|
---
|
||||||
|
src/lstack/api/lstack_epoll.c | 19 ++++++++++---------
|
||||||
|
1 file changed, 10 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
|
||||||
|
index c3fd31c..35df625 100644
|
||||||
|
--- a/src/lstack/api/lstack_epoll.c
|
||||||
|
+++ b/src/lstack/api/lstack_epoll.c
|
||||||
|
@@ -58,11 +58,11 @@ void add_sock_event(struct lwip_sock *sock, uint32_t event)
|
||||||
|
|
||||||
|
/* app thread have read/write, event is outdated */
|
||||||
|
if (event == EPOLLIN && sock->conn->state != NETCONN_LISTEN && !NETCONN_IS_DATAIN(sock)) {
|
||||||
|
- pthread_spin_unlock(&wakeup->event_list_lock);
|
||||||
|
+ pthread_spin_unlock(&wakeup->event_list_lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event == EPOLLOUT && !NETCONN_IS_OUTIDLE(sock)) {
|
||||||
|
- pthread_spin_unlock(&wakeup->event_list_lock);
|
||||||
|
+ pthread_spin_unlock(&wakeup->event_list_lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -147,8 +147,9 @@ static void raise_pending_events(struct wakeup_poll *wakeup, struct lwip_sock *s
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
pthread_spin_lock(&wakeup->event_list_lock);
|
||||||
|
- sock->events = event;
|
||||||
|
- if (wakeup->type == WAKEUP_EPOLL && list_is_null(&sock->event_list)) {
|
||||||
|
+ sock->events = event;
|
||||||
|
+ if (wakeup->type == WAKEUP_EPOLL && (sock->events & sock->epoll_events) &&
|
||||||
|
+ list_is_null(&sock->event_list)) {
|
||||||
|
list_add_node(&wakeup->event_list, &sock->event_list);
|
||||||
|
}
|
||||||
|
pthread_spin_unlock(&wakeup->event_list_lock);
|
||||||
|
@@ -362,7 +363,7 @@ static int32_t epoll_lwip_event(struct wakeup_poll *wakeup, struct epoll_event *
|
||||||
|
list_for_each_safe(node, temp, &wakeup->event_list) {
|
||||||
|
struct lwip_sock *sock = container_of(node, struct lwip_sock, event_list);
|
||||||
|
|
||||||
|
- if (sock->epoll_events == 0) {
|
||||||
|
+ if ((sock->epoll_events & sock->events) == 0) {
|
||||||
|
list_del_node_null(&sock->event_list);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
@@ -474,9 +475,9 @@ int32_t lstack_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t maxe
|
||||||
|
|
||||||
|
if (__atomic_load_n(&wakeup->have_kernel_event, __ATOMIC_ACQUIRE)) {
|
||||||
|
kernel_num = posix_api->epoll_wait_fn(epfd, &events[lwip_num], maxevents - lwip_num, 0);
|
||||||
|
- if (!kernel_num) {
|
||||||
|
+ if (!kernel_num) {
|
||||||
|
__atomic_store_n(&wakeup->have_kernel_event, false, __ATOMIC_RELEASE);
|
||||||
|
- }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lwip_num + kernel_num > 0) {
|
||||||
|
@@ -681,9 +682,9 @@ int32_t lstack_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
|
||||||
|
uint32_t index = wakeup->events[i].data.u32;
|
||||||
|
fds[index].revents = wakeup->events[i].events;
|
||||||
|
}
|
||||||
|
- if (!kernel_num) {
|
||||||
|
+ if (!kernel_num) {
|
||||||
|
__atomic_store_n(&wakeup->have_kernel_event, false, __ATOMIC_RELEASE);
|
||||||
|
- }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lwip_num + kernel_num > 0) {
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: gazelle
|
Name: gazelle
|
||||||
Version: 1.0.1
|
Version: 1.0.1
|
||||||
Release: 25
|
Release: 26
|
||||||
Summary: gazelle is a high performance user-mode stack
|
Summary: gazelle is a high performance user-mode stack
|
||||||
License: MulanPSL-2.0
|
License: MulanPSL-2.0
|
||||||
URL: https://gitee.com/openeuler/gazelle
|
URL: https://gitee.com/openeuler/gazelle
|
||||||
@ -159,6 +159,8 @@ Patch9141: 0141-fix-data-flow-error-when-use-NIC-in-kernel.patch
|
|||||||
Patch9142: 0142-fix-write-event-error.patch
|
Patch9142: 0142-fix-write-event-error.patch
|
||||||
Patch9143: 0143-add-malloc-init-zero.patch
|
Patch9143: 0143-add-malloc-init-zero.patch
|
||||||
Patch9144: 0144-modify-event-error.patch
|
Patch9144: 0144-modify-event-error.patch
|
||||||
|
Patch9145: 0145-add-unix_prefix-in-gazellectl.patch
|
||||||
|
Patch9146: 0146-fix-epoll_wait-report-event0.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
%{name} is a high performance user-mode stack.
|
%{name} is a high performance user-mode stack.
|
||||||
@ -199,6 +201,9 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
|
|||||||
%config(noreplace) %{conf_path}/ltran.conf
|
%config(noreplace) %{conf_path}/ltran.conf
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Dec 2 2022 wuchangsheng <wuchangsheng2@huawei.com> - 1.0.1-26
|
||||||
|
- fix epoll_wait report events 0
|
||||||
|
|
||||||
* Thu Dec 1 UTC compile_success <980965867@qq.com> - 1.0.1-25
|
* Thu Dec 1 UTC compile_success <980965867@qq.com> - 1.0.1-25
|
||||||
- add malloc init zero
|
- add malloc init zero
|
||||||
- modify EPOLLOUT event is overwritten.
|
- modify EPOLLOUT event is overwritten.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user