tiny-curl: base and FreeRTOS support

This commit is contained in:
Daniel Stenberg 2021-04-12 08:52:24 +02:00
parent 6f19f68e93
commit 462d10f44c
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
17 changed files with 1368 additions and 54 deletions

View file

@ -311,7 +311,7 @@ static size_t hash_fd(void *key, size_t key_length, size_t slots_num)
curl_socket_t fd = *((curl_socket_t *) key);
(void) key_length;
return (fd % slots_num);
return ((long)fd % slots_num); /* weirdo FreeRTOS hack */
}
/*
@ -1022,8 +1022,8 @@ static int multi_getsock(struct Curl_easy *data,
}
CURLMcode curl_multi_fdset(struct Curl_multi *multi,
fd_set *read_fd_set, fd_set *write_fd_set,
fd_set *exc_fd_set, int *max_fd)
curl_fd_set *read_fd_set, curl_fd_set *write_fd_set,
curl_fd_set *exc_fd_set, int *max_fd)
{
/* Scan through all the easy handles to get the file descriptors set.
Some easy handles may not have connected to the remote host yet,
@ -1056,21 +1056,23 @@ CURLMcode curl_multi_fdset(struct Curl_multi *multi,
if(!FDSET_SOCK(sockbunch[i]))
/* pretend it doesn't exist */
continue;
FD_SET(sockbunch[i], read_fd_set);
CURL_FD_SET(sockbunch[i], read_fd_set, eSELECT_READ);
s = sockbunch[i];
}
if((bitmap & GETSOCK_WRITESOCK(i)) && VALID_SOCK(sockbunch[i])) {
if(!FDSET_SOCK(sockbunch[i]))
/* pretend it doesn't exist */
continue;
FD_SET(sockbunch[i], write_fd_set);
CURL_FD_SET(sockbunch[i], write_fd_set, eSELECT_WRITE);
s = sockbunch[i];
}
if(s == CURL_SOCKET_BAD)
/* this socket is unused, break out of loop */
break;
#ifndef FreeRTOS
if((int)s > this_max_fd)
this_max_fd = (int)s;
#endif
}
data = data->next; /* check next handle */
@ -1099,8 +1101,8 @@ static CURLMcode multi_wait(struct Curl_multi *multi,
unsigned int curlfds;
long timeout_internal;
int retcode = 0;
struct pollfd a_few_on_stack[NUM_POLLS_ON_STACK];
struct pollfd *ufds = &a_few_on_stack[0];
struct curl_pollfd a_few_on_stack[NUM_POLLS_ON_STACK];
struct curl_pollfd *ufds = &a_few_on_stack[0];
bool ufds_malloc = FALSE;
#ifdef USE_WINSOCK
WSANETWORKEVENTS wsa_events;