kernel: times() can take NULL
This commit is contained in:
parent
255be42c9f
commit
2c45d0b5d0
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue