summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 1a92f1ea7c..3e1048e9be 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -1079,6 +1079,30 @@ int Process::sys$close(int fd)
return rc;
}
+int Process::sys$utime(const char* pathname, const Unix::utimbuf* buf)
+{
+ if (!validate_read_str(pathname))
+ return -EFAULT;
+ if (buf && !validate_read_typed(buf))
+ return -EFAULT;
+ String path(pathname);
+ int error;
+ auto descriptor = VFS::the().open(move(path), error, 0, cwd_inode()->identifier());
+ if (!descriptor)
+ return error;
+ Unix::time_t atime;
+ Unix::time_t mtime;
+ if (buf) {
+ atime = buf->actime;
+ mtime = buf->modtime;
+ } else {
+ auto now = RTC::now();
+ mtime = now;
+ atime = now;
+ }
+ return descriptor->set_atime_and_mtime(atime, mtime);
+}
+
int Process::sys$access(const char* pathname, int mode)
{
(void) mode;