Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clocks when building against WASI libc #103

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading