From 82a35b739ab487714efe6001ecb1d5789d83074c Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Mon, 14 May 2007 14:18:41 +0000 Subject: [PATCH] Replace select() by poll() to avoid problems with big descriptor number. Approved by: glebius (mentor) --- lib/libnetgraph/internal.h | 2 +- lib/libnetgraph/msg.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/libnetgraph/internal.h b/lib/libnetgraph/internal.h index 0c947e5eab6d..748ca7bb7571 100644 --- a/lib/libnetgraph/internal.h +++ b/lib/libnetgraph/internal.h @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include diff --git a/lib/libnetgraph/msg.c b/lib/libnetgraph/msg.c index 48447d953265..534d1d181d48 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; } }