sys/select: integration with LWIP
When CONFIG_DISABLE_POLL=y lwip_select() will be used
The patch fix compile error when CONFIG_DISABLE_POLL is set
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
-#if defined(CONFIG_DISABLE_POLL) && defined(CONFIG_NET_SOCKET)
-
-#include <net/lwip/sockets.h>
-
-#else
-
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
#warning "Large fd_set needed"
#endif
-/* Standard helper macros */
-
-#define FD_CLR(fd, set) ((set)->fd_bits[(fd)/8]) &= ~(1 << ((fd) & 7))
-#define FD_SET(fd, set) ((set)->fd_bits[(fd)/8]) |= (1 << ((fd) & 7))
-#define FD_ISSET(fd, set) ((set)->fd_bits[(fd)/8]) & (1 << ((fd) & 7))
-#define FD_ZERO(set) memset(set, 0, sizeof(fd_set))
-
/****************************************************************************
* Type Definitions
****************************************************************************/
@@ -127,6 +114,33 @@ typedef struct fd_set {
uint8_t fd_bits[__SELECT_NUINT32 * 4];
} fd_set;
+/****************************************************************************
+ * Integration with LWIP
+ *
+ * select() can be defined in fs/vfs/fs_select.c or
+ * or in net/socket/bsd_socket_api.c when CONFIG_DISABLE_POLL=y
+ *
+ * in the second case LWIP implementation will be used with own declatations
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_DISABLE_POLL)
+
+#if !defined(CONFIG_NET_SOCKET)
+#error Both system poll and network sockets are disabled
+#else
+#include <net/lwip/sockets.h>
+#endif
+
+#else
+
+/* Standard helper macros */
+
+#define FD_CLR(fd, set) ((set)->fd_bits[(fd)/8]) &= ~(1 << ((fd) & 7))
+#define FD_SET(fd, set) ((set)->fd_bits[(fd)/8]) |= (1 << ((fd) & 7))
+#define FD_ISSET(fd, set) ((set)->fd_bits[(fd)/8]) & (1 << ((fd) & 7))
+#define FD_ZERO(set) memset(set, 0, sizeof(fd_set))
+
#endif /* CONFIG_DISABLE_POLL */
/****************************************************************************
