Skip to content

Commit

Permalink
Merge pull request #103 from turbolent/wasi-libc-clocks
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent authored Oct 13, 2024
2 parents 042b592 + 87ae131 commit 3b18f55
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 @@ -1764,13 +1764,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 @@ -2038,13 +2046,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 3b18f55

Please sign in to comment.