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 0eefb8c
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions wasi/wasi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1754,13 +1754,19 @@ 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 +2034,19 @@ 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 0eefb8c

Please sign in to comment.