gazelle/0049-modif-mem.patch
yinbin e16732f418 sync modif mem
(cherry picked from commit 49814db46179f7757a09ab5c4a7721a78ec67021)
2023-11-18 17:45:15 +08:00

49 lines
1.7 KiB
Diff

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