svn commit: r296109 - head/libexec/rlogind

Pedro Giffuni pfg at FreeBSD.org
Sat Feb 27 14:47:35 UTC 2016


Hello;



On 02/27/16 08:08, Ronald Klop wrote:
> Hi,
>
> I'm not a FreeBSD commiter, but read these commits to stay informed
> about what is happening.
> This commit (and the one for talk) mentions _what_ is changed, but not
> _why_ it is changed. I'm curious why this is better. Mind to share any
> comments on this?
>


Sure. The difference is very small and it could even be argued if the
change is worth it at all. Both poll(2) and select(2) do the same and
have basically the same performance but poll(2) is a bit more scalable.

> Regards,
> Ronald.
>
>
> On Fri, 26 Feb 2016 21:02:02 +0100, Pedro F. Giffuni <pfg at freebsd.org>
> wrote:
>
...
>> Modified: head/libexec/rlogind/rlogind.c
>> ==============================================================================
>>
>> --- head/libexec/rlogind/rlogind.c    Fri Feb 26 19:49:04 2016
>> (r296108)
>> +++ head/libexec/rlogind/rlogind.c    Fri Feb 26 20:02:01 2016
>> (r296109)
>> @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
>>  #include <errno.h>
>>  #include <libutil.h>
>>  #include <paths.h>
>> +#include <poll.h>
>>  #include <pwd.h>
>>  #include <syslog.h>
>>  #include <stdio.h>
>> @@ -350,34 +351,27 @@ protocol(int f, int p)
>>          nfd = f + 1;
>>      else
>>          nfd = p + 1;
>> -    if (nfd > FD_SETSIZE) {
>> -        syslog(LOG_ERR, "select mask too small, increase FD_SETSIZE");
>> -        fatal(f, "internal error (select mask too small)", 0);
>> -    }


In the case of rlogind, note that the above limitation has disappeared
by using poll(2).

I will add that FreeBSD has a native poll(2) implementation, it is
not a wrapper around select as some old postings would suggest.

I don't have any plans to do a massive shakeup against select(2), this
was some lower hanging fruit that was easy to change. For new code
kqueue(2) should be preferred.

Pedro.


More information about the svn-src-all mailing list