mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:57:35 +00:00
Kernel: Use Userspace<T> for the times syscall
This commit is contained in:
parent
e7728ca8fd
commit
7943655838
2 changed files with 12 additions and 7 deletions
|
@ -28,15 +28,20 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
clock_t Process::sys$times(tms* times)
|
||||
clock_t Process::sys$times(Userspace<tms*> user_times)
|
||||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
if (!validate_write_typed(times))
|
||||
if (!validate_write_typed(user_times))
|
||||
return -EFAULT;
|
||||
copy_to_user(×->tms_utime, &m_ticks_in_user);
|
||||
copy_to_user(×->tms_stime, &m_ticks_in_kernel);
|
||||
copy_to_user(×->tms_cutime, &m_ticks_in_user_for_dead_children);
|
||||
copy_to_user(×->tms_cstime, &m_ticks_in_kernel_for_dead_children);
|
||||
|
||||
tms times = {};
|
||||
times.tms_utime = m_ticks_in_user;
|
||||
times.tms_stime = m_ticks_in_kernel;
|
||||
times.tms_cutime = m_ticks_in_user_for_dead_children;
|
||||
times.tms_cstime = m_ticks_in_kernel_for_dead_children;
|
||||
|
||||
copy_to_user(user_times, ×);
|
||||
|
||||
return g_uptime & 0x7fffffff;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue