curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Question/proposal about function returning pollfds from multi handle

From: Dmitry Karpov via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 14 Dec 2023 21:26:20 +0000

Hi All,

As we know, the multi handle API provides a useful curl_multi_fdset() function allowing to set descriptor bits for the sockets used by the multi handle,
so, they can used in some external select() calls.

But currently there is no function that can provide a similar functionality (like array of pollfd structures) for external poll().
I think it would be useful to provide a function named something like "curl_multi_pollfds", which could have a signature like:

CURLMcode curl_multi_pollfds(struct pollfd *ufds, unsigned int max_nfds)

which will fill the provided array of pollfds up to max_nfds (it will return CURLM_OUT_OF_MEMORY if the number of descriptors is greater than the max size).

This function will be helpful to use with poll() to overcome the select() shortcomings.
(I don't think it will be difficult to add this function as the curl_multi_fdset() uses poll structures internally.)

What do you think?

Thanks,
Dmitry Karpov

-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-12-14