Switch from FD_SETSIZE to getdtablesize(2) as it can make the FD to be

tunable. Also it gets more close with the original implementation from
OpenBSD.

Requested by:	rodrigc
Approved by:	rodrigc (mentor)
Differential Revision:	https://reviews.freebsd.org/D4970
This commit is contained in:
Marcelo Araujo 2016-01-22 03:02:38 +00:00
parent ba86521396
commit db891e2149

View File

@ -83,17 +83,14 @@ void
yp_enable_events(void)
{
int i;
extern fd_set svc_fdset;
struct yp_event *ye;
for (i = 0; i < FD_SETSIZE; i++) {
if (FD_ISSET(i, &svc_fdset)) {
if ((ye = calloc(1, sizeof(*ye))) == NULL)
fatal(NULL);
event_set(&ye->ye_event, i, EV_READ, yp_fd_event, NULL);
event_add(&ye->ye_event, NULL);
TAILQ_INSERT_TAIL(&env->sc_yp->yd_events, ye, ye_entry);
}
for (i = 0; i < getdtablesize(); i++) {
if ((ye = calloc(1, sizeof(*ye))) == NULL)
fatal(NULL);
event_set(&ye->ye_event, i, EV_READ, yp_fd_event, NULL);
event_add(&ye->ye_event, NULL);
TAILQ_INSERT_TAIL(&env->sc_yp->yd_events, ye, ye_entry);
}
}