From f2dc4f13cb945d50e21b2efee1dff9c498dada00 Mon Sep 17 00:00:00 2001 From: zms123456 <85141075+zmshahaha@users.noreply.github.com> Date: Sat, 14 Sep 2024 05:29:08 +0800 Subject: [PATCH] [components][lwip]fix lwip poll macro conflict --- .../net/lwip/lwip-2.1.2/src/include/lwip/sockets.h | 13 +++++++++++++ components/net/sal/impl/af_inet_lwip.c | 8 ++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/components/net/lwip/lwip-2.1.2/src/include/lwip/sockets.h b/components/net/lwip/lwip-2.1.2/src/include/lwip/sockets.h index 335bee358d..7fc8572a46 100644 --- a/components/net/lwip/lwip-2.1.2/src/include/lwip/sockets.h +++ b/components/net/lwip/lwip-2.1.2/src/include/lwip/sockets.h @@ -495,6 +495,18 @@ typedef struct fd_set /* poll-related defines and types */ /* @todo: find a better way to guard the definition of these defines and types if already defined */ #if !defined(POLLIN) && !defined(POLLOUT) +#ifdef RT_USING_MUSLLIBC +#define POLLIN 0x001 /**< There is data to read. */ +#define POLLPRI 0x002 /**< There is urgent data to read. */ +#define POLLOUT 0x004 /**< Writing is now possible. */ +#define POLLERR 0x008 /**< Error condition. */ +#define POLLHUP 0x010 /**< Hang up. */ +#define POLLNVAL 0x020 /**< Invalid polling request. */ +#define POLLRDNORM 0x040 /**< Normal data may be read. */ +#define POLLRDBAND 0x080 /**< Priority data may be read. */ +#define POLLWRNORM 0x100 /**< Writing normal data is possible. */ +#define POLLWRBAND 0x200 /**< Writing priority data is possible. */ +#else #define POLLIN 0x1 #define POLLOUT 0x2 #define POLLERR 0x4 @@ -506,6 +518,7 @@ typedef struct fd_set #define POLLWRNORM 0x80 #define POLLWRBAND 0x100 #define POLLHUP 0x200 +#endif /* RT_USING_MUSLLIBC */ typedef unsigned int nfds_t; struct pollfd { diff --git a/components/net/sal/impl/af_inet_lwip.c b/components/net/sal/impl/af_inet_lwip.c index 9183e1a63f..876dfba535 100644 --- a/components/net/sal/impl/af_inet_lwip.c +++ b/components/net/sal/impl/af_inet_lwip.c @@ -10,16 +10,16 @@ #include +#ifdef SAL_USING_POSIX +#include +#endif + #include #include #include #include #include -#ifdef SAL_USING_POSIX -#include -#endif - #include #include