NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: select() timeout



On Sun, Feb 19, 2012 at 07:33:53PM -0500, James K. Lowden wrote:
> Matthias Scheler <tron%zhadum.org.uk@localhost> wrote:
> 
> > And select(2) is a dangerous API. 
> 
> Dangerous how?  When the filehandle count is controlled,

It is not the number of file descriptors that matter but the highest
file descriptor number.

> ... what problem does it present?  

I've see select(2) blanking a huge portion of stack space under Linux
because OpenSSL got a file descriptor number outside of FD_SETSIZE.
The author of this bit of code had just like you assumed that nothing
could go wrong when you use select(2) to handle a single file descriptor.

Newer version of OpenSSL use poll(2).

> select(2) is the oldest and most portable of its kind.  It's not hard
> to find C libraries that do not support poll or kqueue.  

The target platform was NetBSD in this case. And system which don't
support poll(2) should just be moved to the atticc.

        Kind regards

-- 
Matthias Scheler                                  http://zhadum.org.uk/


Home | Main Index | Thread Index | Old Index