Skip to content

Commit

Permalink
CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID are not availabl…
Browse files Browse the repository at this point in the history
…e in WASI libc
  • Loading branch information
turbolent committed Oct 13, 2024
1 parent 4c53309 commit 87ae131
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions wasi/wasi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1754,13 +1754,21 @@ wasiClockTimeGet(
break;
}
#endif
#ifdef _POSIX_CPUTIME
/* Don't check for _POSIX_CPUTIME, because e.g. WASI libc defines it,
* but it does not have CLOCK_PROCESS_CPUTIME_ID.
* See https://github.com/WebAssembly/wasi-libc/issues/513
*/
#ifdef CLOCK_PROCESS_CPUTIME_ID
case WASI_CLOCK_PROCESS_CPUTIME_ID: {
nativeClockID = CLOCK_PROCESS_CPUTIME_ID;
break;
}
#endif
#ifdef _POSIX_THREAD_CPUTIME
/* Don't check for _POSIX_THREAD_CPUTIME, because e.g. WASI libc defines it,
* but it does not have CLOCK_THREAD_CPUTIME_ID.
* See https://github.com/WebAssembly/wasi-libc/issues/513
*/
#ifdef CLOCK_THREAD_CPUTIME_ID
case WASI_CLOCK_THREAD_CPUTIME_ID: {
nativeClockID = CLOCK_THREAD_CPUTIME_ID;
break;
Expand Down Expand Up @@ -2028,13 +2036,21 @@ wasiClockResGet(
break;
}
#endif
#ifdef _POSIX_CPUTIME
/* Don't check for _POSIX_CPUTIME, because e.g. WASI libc defines it,
* but it does not have CLOCK_PROCESS_CPUTIME_ID.
* See https://github.com/WebAssembly/wasi-libc/issues/513
*/
#ifdef CLOCK_PROCESS_CPUTIME_ID
case WASI_CLOCK_PROCESS_CPUTIME_ID: {
nativeClockID = CLOCK_PROCESS_CPUTIME_ID;
break;
}
#endif
#ifdef _POSIX_THREAD_CPUTIME
/* Don't check for _POSIX_THREAD_CPUTIME, because e.g. WASI libc defines it,
* but it does not have CLOCK_THREAD_CPUTIME_ID.
* See https://github.com/WebAssembly/wasi-libc/issues/513
*/
#ifdef CLOCK_THREAD_CPUTIME_ID
case WASI_CLOCK_THREAD_CPUTIME_ID: {
nativeClockID = CLOCK_THREAD_CPUTIME_ID;
break;
Expand Down

0 comments on commit 87ae131

Please sign in to comment.