mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 09:12:44 +00:00
Replace select() by poll() to avoid problems with big
descriptor number. Approved by: glebius (mentor)
This commit is contained in:
parent
79df5e05ee
commit
82a35b739a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169551
@ -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>
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user