On 2/6/13 6:12 PM, Ian Lepore wrote:
> On Wed, 2013-02-06 at 13:16 +0000, Andrey Zonov wrote:
>> Author: zont
>> Date: Wed Feb  6 13:16:43 2013
>> New Revision: 246402
>> URL: http://svnweb.freebsd.org/changeset/base/246402
>>
>> Log:
>>   MFC r245696:
>>   - Force inetd to have listen queue size to be set to the value of
>>     kern.ipc.somaxconn instead of hardcoded value 64.
>>
>> Modified:
>>   stable/9/usr.sbin/inetd/inetd.c
>> Directory Properties:
>>   stable/9/usr.sbin/inetd/   (props changed)
>>
>> Modified: stable/9/usr.sbin/inetd/inetd.c
>> ==============================================================================
>> --- stable/9/usr.sbin/inetd/inetd.c  Wed Feb  6 13:14:30 2013        
>> (r246401)
>> +++ stable/9/usr.sbin/inetd/inetd.c  Wed Feb  6 13:16:43 2013        
>> (r246402)
>> @@ -1387,7 +1387,7 @@ setsockopt(fd, SOL_SOCKET, opt, (char *)
>>                  }
>>          }
>>      if (sep->se_socktype == SOCK_STREAM)
>> -            listen(sep->se_fd, 64);
>> +            listen(sep->se_fd, -1);
>>      enable(sep);
>>      if (debug) {
>>              warnx("registered %s on %d",
> 
> I recently discovered that the posix documentation for listen(2) states
> that a queue depth less than zero is to be treated as if zero were
> specified, and the behavior for zero is to minimize the length of the
> queue to the smallest value the implementation supports (with words that
> imply the desired (but not required) effect is to stop listening if
> possible).
> 

Hm, I could not imagine that POSIX creates new shiny bike for that.

> Given that, perhaps it's unwise to expand the amount of code we've got
> that relies on this freebsd-specific non-conformance?
> 

I think it is BSD-specific and I like -1 more than INT_MAX here.

Note that Linux is going crazy when you set backlog more than system limit.

-- 
Andrey Zonov

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to