xiaoxiang781216 commented on code in PR #18883:
URL: https://github.com/apache/nuttx/pull/18883#discussion_r3252557266


##########
sched/clock/clock_gettime.c:
##########
@@ -45,6 +45,20 @@
 #  include "clock/clock_timekeeping.h"
 #endif
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_ARCH_SIM) && defined(CONFIG_HOST_MACOS)
+/* Rust code built for the macOS host uses Darwin's libc clock IDs.  When it
+ * is linked into the NuttX simulator, those values are passed to NuttX's
+ * clock_gettime() implementation instead of Darwin's one.
+ */
+
+#  define DARWIN_CLOCK_MONOTONIC 6

Review Comment:
   why add macos specific code in common module? all macos specific code should 
be in arch/sim/.



##########
arch/sim/src/sim/posix/sim_macho_init.c:
##########
@@ -96,23 +99,28 @@ static void save_and_replace_init_funcs(int argc, const 
char *argv[],
   g_saved_envp = envp;
   g_saved_apple = apple;
 
-  g_saved_init_funcs = malloc(g_num_saved_init_funcs *
-                              sizeof(*g_saved_init_funcs));
+  g_saved_init_funcs = malloc((nfuncs - 1) * sizeof(*g_saved_init_funcs));
   allow_write(&mod_init_func_start, &mod_init_func_end);
-  int i = 0;
+  i = 0;

Review Comment:
   merge with line 84



-- 
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]

Reply via email to