Replace select() by poll() to avoid problems with big

descriptor number.

Approved by:	glebius (mentor)
This commit is contained in:
Alexander Motin 2007-05-14 14:18:41 +00:00
parent 79df5e05ee
commit 82a35b739a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169551
2 changed files with 7 additions and 6 deletions

View File

@ -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>

View File

@ -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;
}
}