1 Star 0 Fork 32

hantwofish/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0049-modif-mem.patch 1.65 KB
一键复制 编辑 原始数据 按行查看 历史
yinbin6 提交于 2023-11-18 17:35 . sync modif mem
From e69c39c7c73abd1245c1f7aecde3333fdb45ca2b Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Sat, 18 Nov 2023 17:07:32 +0800
Subject: [PATCH] modif mem
---
src/lstack/api/lstack_epoll.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
index f2c4a8b..7572918 100644
--- a/src/lstack/api/lstack_epoll.c
+++ b/src/lstack/api/lstack_epoll.c
@@ -910,9 +910,9 @@ static inline int timeval_to_ms(struct timeval *timeval)
return (timeval->tv_sec * 1000 + timeval->tv_usec / 1000);
}
-static nfds_t fds_select2poll(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct pollfd **fds)
+static nfds_t fds_select2poll(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct pollfd *fds)
{
- struct pollfd pollfds[FD_SETSIZE] = { 0 };
+ struct pollfd *pollfds = fds;
nfds_t nfds = 0;
for (int i = 0; i < maxfd; i++) {
@@ -930,8 +930,6 @@ static nfds_t fds_select2poll(int maxfd, fd_set *readfds, fd_set *writefds, fd_s
nfds++;
}
}
-
- *fds = pollfds;
return nfds;
}
@@ -946,8 +944,8 @@ int lstack_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfd
}
/* Convert the select parameter to the poll parameter. */
- struct pollfd *fds = NULL;
- nfds_t nfds = fds_select2poll(maxfd, readfds, writefds, exceptfds, &fds);
+ struct pollfd fds[FD_SETSIZE] = { 0 };
+ nfds_t nfds = fds_select2poll(maxfd, readfds, writefds, exceptfds, fds);
int timeout = timeval_to_ms(timeval);
int event_num = lstack_poll(fds, nfds, timeout);
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hantwofish/gazelle_1.git
git@gitee.com:hantwofish/gazelle_1.git
hantwofish
gazelle_1
gazelle_1
master

搜索帮助