--- a/otherlibs/unix/socketaddr.c	2017-12-15 13:57:16.000000000 -0800
+++ b/otherlibs/unix/socketaddr.c	2017-12-15 14:02:56.000000000 -0800
@@ -30,6 +30,18 @@
 #include <io.h>
 #endif

+static size_t
+strnlen(const char *s, size_t maxlen)
+{
+	size_t len;
+
+	for (len = 0; len < maxlen; len++, s++) {
+		if (!*s)
+			break;
+	}
+	return (len);
+}
+
 CAMLexport value caml_unix_alloc_inet_addr(struct in_addr * a)
 {
   value res;

--- a/runtime/runtime_events.c	2026-02-17 22:20:54.000000000 +0800
+++ b/runtime/runtime_events.c	2026-06-14 09:15:19.000000000 +0800
@@ -86,6 +86,18 @@
 
 typedef enum { EV_RUNTIME, EV_USER } ev_category;
 
+static size_t
+strnlen(const char *s, size_t maxlen)
+{
+	size_t len;
+
+	for (len = 0; len < maxlen; len++, s++) {
+		if (!*s)
+			break;
+	}
+	return (len);
+}
+
 /* These store state for the current ring buffers open for writing */
 static struct runtime_events_metadata_header *current_metadata = NULL;
 static int current_ring_total_size;
