47 lines
1.8 KiB
Diff
47 lines
1.8 KiB
Diff
From 881bf800f35c79f778b1cdb401ad7ff780b010e9 Mon Sep 17 00:00:00 2001
|
|
From: yangchen <yangchen145@huawei.com>
|
|
Date: Wed, 6 Dec 2023 12:23:51 +0800
|
|
Subject: [PATCH] fix example print error
|
|
|
|
---
|
|
src/lstack/api/lstack_epoll.c | 7 +------
|
|
src/lstack/api/lstack_wrap.c | 4 ++++
|
|
2 files changed, 5 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
|
|
index a2d2a9b..7825bed 100644
|
|
--- a/src/lstack/api/lstack_epoll.c
|
|
+++ b/src/lstack/api/lstack_epoll.c
|
|
@@ -941,12 +941,7 @@ static nfds_t fds_select2poll(int maxfd, fd_set *readfds, fd_set *writefds, fd_s
|
|
|
|
int lstack_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeval)
|
|
{
|
|
- if (maxfd == 0) {
|
|
- LSTACK_LOG(ERR, LSTACK, "select maxfd is zero\n");
|
|
- return 0;
|
|
- }
|
|
-
|
|
- if (maxfd < 0 || maxfd > FD_SETSIZE || (readfds == NULL && writefds == NULL && exceptfds == NULL)) {
|
|
+ if (maxfd < 0 || maxfd > FD_SETSIZE) {
|
|
LSTACK_LOG(ERR, LSTACK, "select input param error, fd num=%d\n", maxfd);
|
|
GAZELLE_RETURN(EINVAL);
|
|
}
|
|
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
|
index abbf8a1..69a1409 100644
|
|
--- a/src/lstack/api/lstack_wrap.c
|
|
+++ b/src/lstack/api/lstack_wrap.c
|
|
@@ -595,6 +595,10 @@ static int32_t do_sigaction(int32_t signum, const struct sigaction *act, struct
|
|
|
|
static int32_t do_select(int32_t nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
|
{
|
|
+ if ((select_posix_path() == PATH_KERNEL) || !(readfds || writefds || exceptfds) || nfds == 0) {
|
|
+ return posix_api->select_fn(nfds, readfds, writefds, exceptfds, timeout);
|
|
+ }
|
|
+
|
|
return posix_api->select_fn(nfds, readfds, writefds, exceptfds, timeout);
|
|
}
|
|
|
|
--
|
|
2.27.0
|
|
|