From 67080fa04564030496faaac868c4531a178a6e1a Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 3 Jul 2024 14:46:25 +0900 Subject: [PATCH] `times` should always return 0 for `tms_cutime` (#510) `tms_cutime` is the sum of the user times of child processes *excluding the current process*. Since WASI doesn't provide a way to spawn a new process, this value should always be 0. --- libc-bottom-half/clocks/times.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libc-bottom-half/clocks/times.c b/libc-bottom-half/clocks/times.c index e245569a4..48fa07baa 100644 --- a/libc-bottom-half/clocks/times.c +++ b/libc-bottom-half/clocks/times.c @@ -17,7 +17,8 @@ clock_t times(struct tms *buffer) { __wasi_timestamp_t user = __clock(); *buffer = (struct tms){ .tms_utime = user, - .tms_cutime = user + // WASI doesn't provide a way to spawn a new process, so always 0. + .tms_cutime = 0 }; __wasi_timestamp_t realtime = 0;