From: Sangeetha <sangeetha.elumalai@timesys.com>
Date: Fri, 12 Sep 2025 17:34:21 +0530

diff --git a/src/unix/core.c b/src/unix/core.c
index bd51b69..81e7256 100644
--- a/src/unix/core.c
+++ b/src/unix/core.c
@@ -110,6 +110,10 @@ extern char** environ;
 # include <sanitizer/linux_syscall_hooks.h>
 #endif
 
+#ifndef MSG_CMSG_CLOEXEC
+#define MSG_CMSG_CLOEXEC 0x40000000
+#endif
+
 static void uv__run_pending(uv_loop_t* loop);
 
 /* Verify that uv_buf_t is ABI-compatible with struct iovec. */
diff --git a/src/unix/linux.c b/src/unix/linux.c
index ea3e2de..f9265a2 100644
--- a/src/unix/linux.c
+++ b/src/unix/linux.c
@@ -124,6 +124,14 @@
 # endif
 #endif /* __NR_getrandom */
 
+#ifndef CLOCK_MONOTONIC_COARSE
+#define CLOCK_MONOTONIC_COARSE	6
+#endif
+
+#ifndef CLOCK_BOOTTIME
+#define CLOCK_BOOTTIME 	7
+#endif
+
 enum {
   UV__IORING_SETUP_SQPOLL = 2u,
   UV__IORING_SETUP_NO_SQARRAY = 0x10000u,
diff --git a/src/unix/udp.c b/src/unix/udp.c
index c4a3559..f84ff9a 100644
--- a/src/unix/udp.c
+++ b/src/unix/udp.c
@@ -40,6 +40,15 @@
 # define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
 #endif
 
+#ifdef __UCLIBC__
+/* For `recvmmsg' and `sendmmsg'.  */
+struct mmsghdr
+  {
+	struct msghdr msg_hdr;  	/* Actual message header.  */
+	unsigned int msg_len;   	/* Number of received or sent bytes for the entry. */
+  };
+#endif
+
 static void uv__udp_run_completed(uv_udp_t* handle);
 static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents);
 static void uv__udp_recvmsg(uv_udp_t* handle);
diff --git a/configure b/configure
index 26778c1..64a1e11 100755
--- a/configure
+++ b/configure
@@ -16541,3 +16541,29 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
+# Look for functions relating to thread naming
+for ac_func in pthread_setname_np pthread_set_name_np pthread_getname_np pthread_get_name_np
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+for ac_header in pthread_np.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "pthread_np.h" "ac_cv_header_pthread_np_h" "#include <pthread.h>
+"
+if test "x$ac_cv_header_pthread_np_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_PTHREAD_NP_H 1
+_ACEOF
+
+fi
+
+done
+
diff --git a/src/unix/thread.c b/src/unix/thread.c
index 34fea36..f56158b 100644
--- a/src/unix/thread.c
+++ b/src/unix/thread.c
@@ -901,7 +901,7 @@ void uv_key_set(uv_key_t* key, void* value) {
 int uv__thread_setname(const char* name) {
   return UV_ENOSYS;
 }
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) && defined(HAVE_PTHREAD_NP_H)
 int uv__thread_setname(const char* name) {
   char namebuf[UV_PTHREAD_MAX_NAMELEN_NP];
   strncpy(namebuf, name, sizeof(namebuf) - 1);
@@ -911,14 +911,14 @@ int uv__thread_setname(const char* name) {
     return UV__ERR(errno);
   return 0;
 }
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) && defined(HAVE_PTHREAD_NP_H)
 int uv__thread_setname(const char* name) {
   char namebuf[UV_PTHREAD_MAX_NAMELEN_NP];
   strncpy(namebuf, name, sizeof(namebuf) - 1);
   namebuf[sizeof(namebuf) - 1] = '\0';
   return UV__ERR(pthread_setname_np(pthread_self(), "%s", namebuf));
 }
-#elif defined(__OpenBSD__)
+#elif defined(__OpenBSD__) && defined(HAVE_PTHREAD_NP_H)
 int uv__thread_setname(const char* name) {
   char namebuf[UV_PTHREAD_MAX_NAMELEN_NP];
   strncpy(namebuf, name, sizeof(namebuf) - 1);
@@ -926,13 +926,17 @@ int uv__thread_setname(const char* name) {
   pthread_set_name_np(pthread_self(), namebuf);
   return 0;
 }
-#else
+#elif defined(HAVE_PTHREAD_NP_H)
 int uv__thread_setname(const char* name) {
   char namebuf[UV_PTHREAD_MAX_NAMELEN_NP];
   strncpy(namebuf, name, sizeof(namebuf) - 1);
   namebuf[sizeof(namebuf) - 1] = '\0';
   return UV__ERR(pthread_setname_np(pthread_self(), namebuf));
 }
+#else
+int uv__thread_setname(const char* name) {
+  return UV_ENOSYS;
+}
 #endif
 
 #if (defined(__ANDROID_API__) && __ANDROID_API__ < 26) || \
@@ -950,7 +954,7 @@ int uv__thread_getname(uv_thread_t* tid, char* name, size_t size) {
   name[size - 1] = '\0';
   return 0;
 }
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) && defined(HAVE_PTHREAD_NP_H)
 int uv__thread_getname(uv_thread_t* tid, char* name, size_t size) {
   char thread_name[UV_PTHREAD_MAX_NAMELEN_NP];
   if (pthread_getname_np(*tid, thread_name, sizeof(thread_name)) != 0)
@@ -960,7 +964,7 @@ int uv__thread_getname(uv_thread_t* tid, char* name, size_t size) {
   name[size - 1] = '\0';
   return 0;
 }
-#else
+#elif defined(HAVE_PTHREAD_NP_H)
 int uv__thread_getname(uv_thread_t* tid, char* name, size_t size) {
   int r;
   char thread_name[UV_PTHREAD_MAX_NAMELEN_NP];
@@ -972,4 +976,8 @@ int uv__thread_getname(uv_thread_t* tid, char* name, size_t size) {
   name[size - 1] = '\0';
   return 0;
 }
+#else
+int uv__thread_getname(uv_thread_t* tid, char* name, size_t size) {
+  return UV_ENOSYS;
+}
 #endif
diff --git a/src/unix/udp.c b/src/unix/udp.c
index c4a3559..7c4ef29 100644
--- a/src/unix/udp.c
+++ b/src/unix/udp.c
@@ -186,7 +186,11 @@ static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) {
   while (nread == -1 && errno == EINTR);
 #else
   do
+#ifndef __UCLIBC__
     nread = recvmmsg(handle->io_watcher.fd, msgs, chunks, 0, NULL);
+#else
+    nread = recvmsg(handle->io_watcher.fd, &msgs, 0);
+#endif
   while (nread == -1 && errno == EINTR);
 #endif
 
@@ -1325,6 +1329,8 @@ static int uv__udp_sendmsgv(int fd,
       do
 #if defined(__APPLE__)
         r = sendmsg_x(fd, m, n, MSG_DONTWAIT);
+#elif defined(__UCLIBC__)
+       r = sendmsg(fd, &m, 0);
 #else
         r = sendmmsg(fd, m, n, 0);
 #endif
diff --git a/src/unix/core.c b/src/unix/core.c
index bd51b69..53295ab 100644
--- a/src/unix/core.c
+++ b/src/unix/core.c
@@ -1165,7 +1165,7 @@ int uv__slurp(const char* filename, char* buf, size_t len) {
 
 
 int uv__dup2_cloexec(int oldfd, int newfd) {
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) && !defined(__UCLIBC__)
   int r;
 
   r = dup3(oldfd, newfd, O_CLOEXEC);
