mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 00:14:02 +00:00
Allow LWIP_SOCKET_OFFSET with an external FD_SET
Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
parent
0882e0ba89
commit
4d21d8da23
@ -1910,7 +1910,7 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
|
||||
timeout ? (s32_t)timeout->tv_sec : (s32_t) - 1,
|
||||
timeout ? (s32_t)timeout->tv_usec : (s32_t) - 1));
|
||||
|
||||
if ((maxfdp1 < 0) || (maxfdp1 > (FD_SETSIZE + LWIP_SOCKET_OFFSET))) {
|
||||
if ((maxfdp1 < 0) || (maxfdp1 > LWIP_SELECT_MAXNFDS)) {
|
||||
set_errno(EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
@ -465,6 +465,7 @@ typedef struct ipv6_mreq {
|
||||
#undef FD_SETSIZE
|
||||
/* Make FD_SETSIZE match NUM_SOCKETS in socket.c */
|
||||
#define FD_SETSIZE MEMP_NUM_NETCONN
|
||||
#define LWIP_SELECT_MAXNFDS (FD_SETSIZE + LWIP_SOCKET_OFFSET)
|
||||
#define FDSETSAFESET(n, code) do { \
|
||||
if (((n) - LWIP_SOCKET_OFFSET < MEMP_NUM_NETCONN) && (((int)(n) - LWIP_SOCKET_OFFSET) >= 0)) { \
|
||||
code; }} while(0)
|
||||
@ -480,10 +481,10 @@ typedef struct fd_set
|
||||
unsigned char fd_bits [(FD_SETSIZE+7)/8];
|
||||
} fd_set;
|
||||
|
||||
#elif LWIP_SOCKET_OFFSET
|
||||
#error LWIP_SOCKET_OFFSET does not work with external FD_SET!
|
||||
#elif FD_SETSIZE < MEMP_NUM_NETCONN
|
||||
#elif FD_SETSIZE < (LWIP_SOCKET_OFFSET + MEMP_NUM_NETCONN)
|
||||
#error "external FD_SETSIZE too small for number of sockets"
|
||||
#else
|
||||
#define LWIP_SELECT_MAXNFDS FD_SETSIZE
|
||||
#endif /* FD_SET */
|
||||
|
||||
/* poll-related defines and types */
|
||||
|
Loading…
Reference in New Issue
Block a user