Date: Fri, 22 Jan 2016 03:02:39 +0000 (UTC) From: Marcelo Araujo <araujo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294543 - head/usr.sbin/ypldap Message-ID: <201601220302.u0M32dW2089530@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: araujo Date: Fri Jan 22 03:02:38 2016 New Revision: 294543 URL: https://svnweb.freebsd.org/changeset/base/294543 Log: 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 Modified: head/usr.sbin/ypldap/yp.c Modified: head/usr.sbin/ypldap/yp.c ============================================================================== --- head/usr.sbin/ypldap/yp.c Fri Jan 22 02:28:17 2016 (r294542) +++ head/usr.sbin/ypldap/yp.c Fri Jan 22 03:02:38 2016 (r294543) @@ -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); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601220302.u0M32dW2089530>