Loading...
--- libmalloc/libmalloc-317.40.8/src/internal.h
+++ libmalloc/libmalloc-317.121.1/src/internal.h
@@ -67,6 +67,7 @@
 #endif
 #include <os/tsd.h>
 #include <paths.h>
+#include <pthread/pthread.h>  // _pthread_threadid_self_np_direct()
 #include <pthread/private.h>  // _pthread_threadid_self_np_direct()
 #include <pthread/tsd_private.h>  // TSD keys
 #include <signal.h>
@@ -145,6 +146,18 @@
 	return malloc_tracing_enabled;
 }
 
+static inline uint32_t
+_malloc_cpu_number(void)
+{
+#if TARGET_OS_SIMULATOR
+	size_t n;
+	pthread_cpu_number_np(&n);
+	return (uint32_t)n;
+#else
+	return _os_cpu_number();
+#endif
+}
+
 /*
   * Copies the malloc library's _malloc_msl_lite_hooks_t structure to a given
   * location. Size is passed to allow the structure to  grow. Since this is