The pain of poll(2)?

If you’re working on a multi-platform project which does network communication you will end up thinking about replacing select(2) with poll(2) sooner or later. The problem with select are well known. poll(2) removes the limitations of select(2) and improves speed and features. The problem is that poll(2) isn’t available on all platforms. This means you need a poll(2)-emulation or create wrappers around other similar poll() functions.

In libssh we use a poll(2)-emulation based on select for platforms which don’t provide a poll(2) function like some Windows versions or UNIX systems.

Windows Vista or newer version provide a poll(2) like function called WSAPoll(). To be able to support this call which is faster the the poll(2)-emulation and allows to use more file descriptors we implemented a runtime detection for WSAPoll(). This means during initialization of the socket, we check if the functions can be found in the relevant library. If Windows doesn’t provide it, we fallback to the poll(2)-emulation.

I took several month to get this working correctly on UNIX and Windows. This feature starts to work correctly with libssh 0.4.6 released today.

kio_sftp updates

openSUSE has backported the new kio_sftp implementation based on libssh to their KDE 4.3 packages. This increased the users and helped to find some bugs in kio_sftp and KDE. The current implementation is working fairly well.

As soon as libssh 0.4 will be released (hopefully soon) I will add more features. Users asked for ~/.ssh/config support and I’ve added openssh’s statvfs extension to libssh. This means I can check if there is enough space on the server before I copy a file.