kernel: times() can take NULL

This commit is contained in:
K. Lange 2021-09-05 13:48:17 +09:00
parent 255be42c9f
commit 2c45d0b5d0
1 changed files with 7 additions and 5 deletions

View File

@ -982,12 +982,14 @@ static long sys_reboot(void) {
}
static long sys_times(struct tms *buf) {
PTR_VALIDATE(buf);
if (buf) {
PTR_VALIDATE(buf);
buf->tms_utime = this_core->current_process->time_total / arch_cpu_mhz();
buf->tms_stime = this_core->current_process->time_sys / arch_cpu_mhz();
buf->tms_cutime = this_core->current_process->time_children / arch_cpu_mhz();
buf->tms_cstime = this_core->current_process->time_sys_children / arch_cpu_mhz();
buf->tms_utime = this_core->current_process->time_total / arch_cpu_mhz();
buf->tms_stime = this_core->current_process->time_sys / arch_cpu_mhz();
buf->tms_cutime = this_core->current_process->time_children / arch_cpu_mhz();
buf->tms_cstime = this_core->current_process->time_sys_children / arch_cpu_mhz();
}
return arch_perf_timer() / arch_cpu_mhz();
}