The return value of the system call "times" are in clock ticks?

From: Xiang Gao
Date: Wed Jan 13 2016 - 01:20:48 EST


Hi,

In the man page of the system call "times", i.e. "man 2 times", it says that
"All times reported are in clock ticks."

However, it seems not in the kernel. In my personal computer, it is in
seconds...

I don't know what it is supposed to be. If it is supposed to be in
clock ticks, here is a patch attached that fix this problem. If it is
not supposed to be in clock ticks, then the corresponding man page
should be changed.

Xiang Gao
diff --git a/kernel/sys.c b/kernel/sys.c
index 6af9212..b2cb197 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -886,10 +886,10 @@ void do_sys_times(struct tms *tms)
thread_group_cputime_adjusted(current, &tgutime, &tgstime);
cutime = current->signal->cutime;
cstime = current->signal->cstime;
- tms->tms_utime = cputime_to_clock_t(tgutime);
- tms->tms_stime = cputime_to_clock_t(tgstime);
- tms->tms_cutime = cputime_to_clock_t(cutime);
- tms->tms_cstime = cputime_to_clock_t(cstime);
+ tms->tms_utime = (__force clock_t)(tgutime);
+ tms->tms_stime = (__force clock_t)(tgstime);
+ tms->tms_cutime = (__force clock_t)(cutime);
+ tms->tms_cstime = (__force clock_t)(cstime);
}

SYSCALL_DEFINE1(times, struct tms __user *, tbuf)