summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzms123456 <[email protected]>2024-09-14 05:29:08 +0800
committerGitHub <[email protected]>2024-09-13 17:29:08 -0400
commitf2dc4f13cb945d50e21b2efee1dff9c498dada00 (patch)
tree9072e34b0e3b282cd55f48cd877e499acce6da77
parent6d39cdf8361c22865ee44824b4fd3d197b32a212 (diff)
[components][lwip]fix lwip poll macro conflict
-rw-r--r--components/net/lwip/lwip-2.1.2/src/include/lwip/sockets.h13
-rw-r--r--components/net/sal/impl/af_inet_lwip.c8
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 <rtthread.h>
+#ifdef SAL_USING_POSIX
+#include <poll.h>
+#endif
+
#include <lwip/sockets.h>
#include <lwip/netdb.h>
#include <lwip/api.h>
#include <lwip/init.h>
#include <lwip/netif.h>
-#ifdef SAL_USING_POSIX
-#include <poll.h>
-#endif
-
#include <sal_low_lvl.h>
#include <af_inet.h>