1 Star 0 Fork 32

修一/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0047-add-kernel-path-in-epoll-funcs.patch 1.98 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2022-07-07 21:58 . backport upstream patches:
From 17fa541e456acccae61669fcc403b44e4aabb2d5 Mon Sep 17 00:00:00 2001
From: wuchangsheng <wuchangsheng2@huawei.com>
Date: Thu, 21 Apr 2022 16:59:44 +0800
Subject: [PATCH 08/18] add kernel path in epoll funcs
---
src/lstack/api/lstack_wrap.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 0164069..f623da3 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -77,6 +77,15 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd)
static inline int32_t do_epoll_create(int32_t size)
{
+ if (posix_api == NULL) {
+ /* link liblstack.so using LD_PRELOAD mode will read liblstack.so,
+ poisx_api need to be initialized here */
+ if (posix_api_init() != 0) {
+ LSTACK_PRE_LOG(LSTACK_ERR, "posix_api_init failed\n");
+ }
+ return posix_api->epoll_create_fn(size);
+ }
+
if (unlikely(posix_api->is_chld)) {
return posix_api->epoll_create_fn(size);
}
@@ -90,16 +99,22 @@ static inline int32_t do_epoll_ctl(int32_t epfd, int32_t op, int32_t fd, struct
return posix_api->epoll_ctl_fn(epfd, op, fd, event);
}
+ struct lwip_sock *sock = get_socket_by_fd(epfd);
+ if (sock == NULL || sock->wakeup == NULL) {
+ return posix_api->epoll_ctl_fn(epfd, op, fd, event);
+ }
+
return lstack_epoll_ctl(epfd, op, fd, event);
}
static inline int32_t do_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t maxevents, int32_t timeout)
{
- if (events == NULL || maxevents == 0) {
- GAZELLE_RETURN(EINVAL);
+ if (unlikely(posix_api->is_chld)) {
+ return posix_api->epoll_wait_fn(epfd, events, maxevents, timeout);
}
- if (unlikely(posix_api->is_chld)) {
+ struct lwip_sock *sock = get_socket_by_fd(epfd);
+ if (sock == NULL || sock->wakeup == NULL) {
return posix_api->epoll_wait_fn(epfd, events, maxevents, timeout);
}
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/slxiu/gazelle_1.git
git@gitee.com:slxiu/gazelle_1.git
slxiu
gazelle_1
gazelle_1
master

搜索帮助