瀏覽代碼

sandboxed-system-primitives: make CPT/TCT clock ids optional (#1126)

NuttX doesn't have them.
YAMAMOTO Takashi 3 年之前
父節點
當前提交
2fe83e29cd
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c

+ 4 - 0
core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c

@@ -181,15 +181,19 @@ convert_clockid(__wasi_clockid_t in, clockid_t *out)
         case __WASI_CLOCK_MONOTONIC:
             *out = CLOCK_MONOTONIC;
             return true;
+#if defined(CLOCK_PROCESS_CPUTIME_ID)
         case __WASI_CLOCK_PROCESS_CPUTIME_ID:
             *out = CLOCK_PROCESS_CPUTIME_ID;
             return true;
+#endif
         case __WASI_CLOCK_REALTIME:
             *out = CLOCK_REALTIME;
             return true;
+#if defined(CLOCK_THREAD_CPUTIME_ID)
         case __WASI_CLOCK_THREAD_CPUTIME_ID:
             *out = CLOCK_THREAD_CPUTIME_ID;
             return true;
+#endif
         default:
             return false;
     }