zhangyue1818 commented on code in PR #1351:
URL: https://github.com/apache/cloudberry/pull/1351#discussion_r2992742567
##########
contrib/interconnect/udp/ic_udpifc.c:
##########
@@ -741,10 +736,15 @@ static void setRxThreadError(int eno);
static void resetRxThreadError(void);
static void SendDummyPacket(void);
+static void ConvertToIPv4MappedAddr(struct sockaddr_storage *sockaddr,
socklen_t *o_len);
+#if defined(__darwin__)
+#define s6_addr32 __u6_addr.__u6_addr32
Review Comment:
The `__darwin__` macro is already widely used throughout the codebase
(defined in `src/include/port/darwin.h`) for macOS-specific compatibility —
e.g. in pqcomm.c, ps_status.c, elog.c, sysv_shmem.c, etc. This is not about
building on macOS specifically, but about ensuring cross-platform
compatibility.
Why `s6_addr32` needs a macro:
macOS's `<netinet6/in6.h>` does not directly expose `s6_addr32` as a member
of `struct in6_addr`. On Linux it is available directly, but on macOS it must
be accessed via `__u6_addr.__u6_addr32`. This macro bridges that difference so
the code in `ConvertToIPv4MappedAddr` (e.g. `in6_new->sin6_addr.s6_addr32[3] =
in->sin_addr.s_addr`) compiles on both platforms.
Both the macro and the function are guarded by `#if defined(__darwin__)`
so they have no effect on Linux builds.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]