bagder/curl — pull request #38 by sgolemon (2012-07-17 02:30:25+00:00)
Title: curl_multi_fdvec

Here's an alternative to curl_multi_select() which addresses your desire for being able to add arbitrary file descriptors. Workflow here is:

long read_fds, write_fds;

curl_multi_getinfo(multi, CURLMINFO_NUM_READ_FDS, &read_fds);
curl_multi_getinfo(multi, CURLMINFO_NUM_WRITE_FDS, &write_fds);

int *rfds = calloc(read_fds, sizeof(int));
int *wfds = calloc(write_fds, sizeof(int));

curl_multi_fdvec(multi, rfds, wfds, NULL);

Then the caller can put into fd_set or struct pollfd as desired, allocating extra space for external fds if desired.

LMK what you think of this approach, and I can add manpages/tests if you like it better.

Note that although I included support for exception fds, there's no internal plumbing for it in keeping with curl_multi_fdset().