Subject: Antw: Re: Select (function _libssh2_wait_socket) issue on some on an embedded platform

Antw: Re: Select (function _libssh2_wait_socket) issue on some on an embedded platform

From: Sebastien Fricker <Sebastien.Fricker_at_ipetronik.com>
Date: Fri, 26 Mar 2010 14:29:38 +0100

Daniel,
On RTOS select always return 0 if readfd and writefd are pointing to
the same variable.

if you have a look on the prototype of the select function you can see
that the df_set pointer are not const pointers:

int select(int nfds, fd_set *readfds, fd_set *writefds,
                  fd_set *exceptfds, struct timeval *timeout);

This mean that select can modify the contain of readfd and writefd. In
the manual of select on Linux, I also found:
" On exit, the sets are modified in place to indicate which file
descriptors actually changed status. "

I guess that this is the problem: &fd is modified twice, and this could
be a problem on some OS.
Regards
Sébastien

>>> Daniel Stenberg <daniel_at_haxx.se> schrieb am 26.03.2010 um 14:13 in
Nachricht
<alpine.DEB.2.00.1003261412200.27808_at_tvnag.unkk.fr>:
> On Fri, 26 Mar 2010, Sebastien Fricker wrote:
>
>> If readfd and writefd are pointing to 2 different variables, select
works
>> well.
>
> ...
>
>> The modification should not create any regression to libssh2, and if
nobody
>> are seeing any problem about this code, I will provide a patch.
>
> I wouldn't mind that minor work-around to make it run better. But
please, add
>
> an explanatory comment about the reason for this weirdness, as
otherwise
> someone will just optimize it away again in the future...
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-03-26