mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +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
|
@ -278,7 +278,7 @@ public:
|
||||||
int sys$fcntl(int fd, int cmd, u32 extra_arg);
|
int sys$fcntl(int fd, int cmd, u32 extra_arg);
|
||||||
int sys$ioctl(int fd, unsigned request, FlatPtr arg);
|
int sys$ioctl(int fd, unsigned request, FlatPtr arg);
|
||||||
int sys$mkdir(Userspace<const char*> pathname, size_t path_length, mode_t mode);
|
int sys$mkdir(Userspace<const char*> pathname, size_t path_length, mode_t mode);
|
||||||
clock_t sys$times(tms*);
|
clock_t sys$times(Userspace<tms*>);
|
||||||
int sys$utime(Userspace<const char*> pathname, size_t path_length, Userspace<const struct utimbuf*>);
|
int sys$utime(Userspace<const char*> pathname, size_t path_length, Userspace<const struct utimbuf*>);
|
||||||
int sys$link(Userspace<const Syscall::SC_link_params*>);
|
int sys$link(Userspace<const Syscall::SC_link_params*>);
|
||||||
int sys$unlink(const char* pathname, size_t path_length);
|
int sys$unlink(const char* pathname, size_t path_length);
|
||||||
|
|
|
@ -28,15 +28,20 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
clock_t Process::sys$times(tms* times)
|
clock_t Process::sys$times(Userspace<tms*> user_times)
|
||||||
{
|
{
|
||||||
REQUIRE_PROMISE(stdio);
|
REQUIRE_PROMISE(stdio);
|
||||||
if (!validate_write_typed(times))
|
if (!validate_write_typed(user_times))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
copy_to_user(×->tms_utime, &m_ticks_in_user);
|
|
||||||
copy_to_user(×->tms_stime, &m_ticks_in_kernel);
|
tms times = {};
|
||||||
copy_to_user(×->tms_cutime, &m_ticks_in_user_for_dead_children);
|
times.tms_utime = m_ticks_in_user;
|
||||||
copy_to_user(×->tms_cstime, &m_ticks_in_kernel_for_dead_children);
|
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;
|
return g_uptime & 0x7fffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue