From: Roland Dobai Date: Wed, 23 May 2018 06:25:46 +0000 (+0200) Subject: VFS: Optionally disable the VFS implementation of select() X-Git-Tag: v3.1-beta1~84^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=004bf84d8c1f6b46b28e3f105995d82f9f1733e6;p=esp-idf VFS: Optionally disable the VFS implementation of select() This allows to temporarily resolve issues like https://github.com/espressif/esp-idf/issues/1987 while bugs are fixed in the VFS implementation of select(). --- diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index c24910e368..efd053b5f2 100755 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -37,6 +37,16 @@ config LWIP_MAX_SOCKETS the maximum amount of sockets here. The valid value is from 1 to 16. +config USE_ONLY_LWIP_SELECT + bool "Support LWIP socket select() only" + default n + help + The virtual filesystem layer of select() redirects sockets to + lwip_select() and non-socket file descriptors to their respective driver + implementations. If this option is enabled then all calls of select() + will be redirected to lwip_select(), therefore, select can be used + for sockets only. + config LWIP_SO_REUSE bool "Enable SO_REUSEADDR option" default y diff --git a/components/newlib/select.c b/components/newlib/select.c index dc945eafb4..e802a4d329 100644 --- a/components/newlib/select.c +++ b/components/newlib/select.c @@ -14,8 +14,17 @@ #include #include "esp_vfs.h" +#include "sdkconfig.h" + +#ifdef CONFIG_USE_ONLY_LWIP_SELECT +#include "lwip/sockets.h" +#endif int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout) { +#ifdef CONFIG_USE_ONLY_LWIP_SELECT + return lwip_select(nfds, readfds, writefds, errorfds, timeout); +#else return esp_vfs_select(nfds, readfds, writefds, errorfds, timeout); +#endif } diff --git a/components/vfs/README.rst b/components/vfs/README.rst index 4644689a93..36af5c388c 100644 --- a/components/vfs/README.rst +++ b/components/vfs/README.rst @@ -93,6 +93,10 @@ Examples demonstrating the use of :cpp:func:`select` with VFS file descriptors are the :example:`peripherals/uart_select` and the :example:`system/select` examples. +If :cpp:func:`select` is used for socket file descriptors only then one can +enable the :ref:`CONFIG_USE_ONLY_LWIP_SELECT` option which can reduce the code +size and improve performance. + Paths -----