summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2007-05-14 14:18:41 +0000
committermav <mav@FreeBSD.org>2007-05-14 14:18:41 +0000
commit830b368aaf80f26f040d3e8f5061619338859bee (patch)
treef5348dd2c041df8b884da04bf627f96d517509e3
parent003d9887d8d503f3259edc017f0c5625648742b5 (diff)
downloadFreeBSD-src-830b368aaf80f26f040d3e8f5061619338859bee.zip
FreeBSD-src-830b368aaf80f26f040d3e8f5061619338859bee.tar.gz
Replace select() by poll() to avoid problems with big
descriptor number. Approved by: glebius (mentor)
-rw-r--r--lib/libnetgraph/internal.h2
-rw-r--r--lib/libnetgraph/msg.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/libnetgraph/internal.h b/lib/libnetgraph/internal.h
index 0c947e5..748ca7b 100644
--- a/lib/libnetgraph/internal.h
+++ b/lib/libnetgraph/internal.h
@@ -44,7 +44,7 @@
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-#include <sys/select.h>
+#include <poll.h>
#include <sys/linker.h>
#include <stddef.h>
diff --git a/lib/libnetgraph/msg.c b/lib/libnetgraph/msg.c
index 48447d9..534d1d1 100644
--- a/lib/libnetgraph/msg.c
+++ b/lib/libnetgraph/msg.c
@@ -235,16 +235,17 @@ NgDeliverMsg(int cs, const char *path,
/* Wait for reply if there should be one. */
if (msg->header.cmd & NGM_HASREPLY) {
- fd_set rfds;
+ struct pollfd rfds;
int n;
- FD_ZERO(&rfds);
- FD_SET(cs, &rfds);
- n = select(cs + 1, &rfds, NULL, NULL, NULL);
+ rfds.fd = cs;
+ rfds.events = POLLIN;
+ rfds.revents = 0;
+ n = poll(&rfds, 1, INFTIM);
if (n == -1) {
errnosv = errno;
if (_gNgDebugLevel >= 1)
- NGLOG("select");
+ NGLOG("poll");
rtn = -1;
}
}
OpenPOWER on IntegriCloud