1 Star 0 Fork 32

Ren Zhijie/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0092-sigaction-fix-deprecated-signal-flags.patch 2.37 KB
一键复制 编辑 原始数据 按行查看 历史
From 3af406243bb2a4a6c8ac5b3f1d98a9cd7e0af295 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Wed, 20 Dec 2023 11:37:13 +0800
Subject: [PATCH] sigaction: fix deprecated signal flags
---
src/lstack/api/lstack_signal.c | 10 +++++++++-
src/lstack/core/lstack_lwip.c | 7 ++++---
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/lstack/api/lstack_signal.c b/src/lstack/api/lstack_signal.c
index 6da6eb4..314c14c 100644
--- a/src/lstack/api/lstack_signal.c
+++ b/src/lstack/api/lstack_signal.c
@@ -57,7 +57,7 @@ static inline bool match_hijack_signal(int sig)
static void lstack_sig_default_handler(int sig)
{
- LSTACK_LOG(ERR, LSTACK, "lstack dumped,caught signal:%d\n", sig);
+ LSTACK_LOG(ERR, LSTACK, "lstack dumped, caught signal: %d\n", sig);
if (get_global_cfg_params() && get_global_cfg_params()->is_primary) {
delete_primary_path();
}
@@ -94,5 +94,13 @@ int lstack_sigaction(int sig_num, const struct sigaction *action, struct sigacti
new_action.sa_handler = lstack_sig_default_handler;
return posix_api->sigaction_fn(sig_num, &new_action, old_action);
}
+
+ /* SA_INTERRUPT is deprecated, use SA_RESETHAND instead. */
+ if ((match_hijack_signal(sig_num) != 0) && (action && action->sa_flags == SA_INTERRUPT)) {
+ new_action = *action;
+ new_action.sa_flags |= SA_RESETHAND;
+ return posix_api->sigaction_fn(sig_num, &new_action, old_action);
+ }
+
return posix_api->sigaction_fn(sig_num, action, old_action);
}
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 34ec1bd..100f075 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -564,10 +564,11 @@ static ssize_t do_lwip_fill_sendring(struct lwip_sock *sock, const void *buf, si
uint32_t write_avail = gazelle_ring_readable_count(sock->send_ring);
struct wakeup_poll *wakeup = sock->wakeup;
- if (!netconn_is_nonblocking(sock->conn)) {
- while (write_avail < write_num) {
- write_avail = gazelle_ring_readable_count(sock->send_ring);
+ while (!netconn_is_nonblocking(sock->conn) && (write_avail < write_num)) {
+ if (sock->errevent > 0) {
+ GAZELLE_RETURN(ENOTCONN);
}
+ write_avail = gazelle_ring_readable_count(sock->send_ring);
}
/* send_ring is full, data attach last pbuf */
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/byterzj/gazelle.git
git@gitee.com:byterzj/gazelle.git
byterzj
gazelle
gazelle
master

搜索帮助