From e86738205d52cecfb5817c80b3bc1fca5f8e317a Mon Sep 17 00:00:00 2001 From: Roland Dobai Date: Thu, 24 May 2018 13:47:00 +0200 Subject: [PATCH] Fix redefinition of select() on platforms where ESP_PLATFORM is discarded Ref: https://github.com/espressif/esp-idf/issues/1987 --- components/lwip/include/lwip/lwip/sockets.h | 9 ++++----- components/lwip/include/lwip/port/lwipopts.h | 2 ++ .../newlib/{include => platform_include}/sys/select.h | 0 3 files changed, 6 insertions(+), 5 deletions(-) rename components/newlib/{include => platform_include}/sys/select.h (100%) diff --git a/components/lwip/include/lwip/lwip/sockets.h b/components/lwip/include/lwip/lwip/sockets.h index 5978b38c49..e9ebff6560 100755 --- a/components/lwip/include/lwip/lwip/sockets.h +++ b/components/lwip/include/lwip/lwip/sockets.h @@ -38,7 +38,6 @@ #if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ -#include #include /* for size_t */ #include /* for FD_ZERO */ @@ -590,10 +589,10 @@ static inline int sendto(int s,const void *dataptr,size_t size,int flags,const s { return lwip_sendto_r(s,dataptr,size,flags,to,tolen); } static inline int socket(int domain,int type,int protocol) { return lwip_socket(domain,type,protocol); } -#ifndef ESP_PLATFORM +#ifndef ESP_HAS_SELECT static inline int select(int maxfdp1,fd_set *readset,fd_set *writeset,fd_set *exceptset,struct timeval *timeout) { return lwip_select(maxfdp1,readset,writeset,exceptset,timeout); } -#endif /* ESP_PLATFORM */ +#endif /* ESP_HAS_SELECT */ static inline int ioctlsocket(int s,long cmd,void *argp) { return lwip_ioctl_r(s,cmd,argp); } @@ -646,10 +645,10 @@ static inline int sendto(int s,const void *dataptr,size_t size,int flags,const s { return lwip_sendto(s,dataptr,size,flags,to,tolen); } static inline int socket(int domain,int type,int protocol) { return lwip_socket(domain,type,protocol); } -#ifndef ESP_PLATFORM +#ifndef ESP_HAS_SELECT static inline int select(int maxfdp1,fd_set t*readset,fd_set *writeset,fd_set *exceptset,struct timeval *timeout) { return lwip_select(maxfdp1,readset,writeset,exceptset,timeout); } -#endif /* ESP_PLATFORM */ +#endif /* ESP_HAS_SELECT */ static inline int ioctlsocket(int s,long cmd,void *argp) { return lwip_ioctl(s,cmd,argp); } diff --git a/components/lwip/include/lwip/port/lwipopts.h b/components/lwip/include/lwip/port/lwipopts.h index 4f43ed990c..4d4ceb564f 100644 --- a/components/lwip/include/lwip/port/lwipopts.h +++ b/components/lwip/include/lwip/port/lwipopts.h @@ -39,6 +39,7 @@ #include #include #include +#include #include "esp_task.h" #include "esp_system.h" #include "sdkconfig.h" @@ -730,6 +731,7 @@ #define ESP_DHCP_TIMER 1 #define ESP_LWIP_LOGI(...) ESP_LOGI("lwip", __VA_ARGS__) #define ESP_PING 1 +#define ESP_HAS_SELECT 1 #if CONFIG_LWIP_IRAM_OPTIMIZATION #define ESP_IRAM_ATTR IRAM_ATTR diff --git a/components/newlib/include/sys/select.h b/components/newlib/platform_include/sys/select.h similarity index 100% rename from components/newlib/include/sys/select.h rename to components/newlib/platform_include/sys/select.h