summaryrefslogtreecommitdiff
path: root/Kernel/Task.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-10-24 13:19:36 +0200
committerAndreas Kling <awesomekling@gmail.com>2018-10-24 13:19:36 +0200
commit5f36a5f22e8bf0e9de9a8059722352d2f8cf9b5f (patch)
treedcb425849c408c6d2adf9f195ee34d23acd8901d /Kernel/Task.cpp
parentbca4b71bfa1e3db74aaa706a9849e36768282a95 (diff)
downloadserenity-5f36a5f22e8bf0e9de9a8059722352d2f8cf9b5f.zip
Add an lstat() syscall and use it to make "ls" nicer.
Diffstat (limited to 'Kernel/Task.cpp')
-rw-r--r--Kernel/Task.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/Kernel/Task.cpp b/Kernel/Task.cpp
index fe185cc154..7005394ee5 100644
--- a/Kernel/Task.cpp
+++ b/Kernel/Task.cpp
@@ -700,13 +700,22 @@ int Task::sys$close(int fd)
return 0;
}
+int Task::sys$lstat(const char* path, void* statbuf)
+{
+ auto handle = VirtualFileSystem::the().open(move(path));
+ if (!handle)
+ return -1;
+ handle->stat((Unix::stat*)statbuf);
+ return 0;
+}
+
int Task::sys$open(const char* path, size_t pathLength)
{
Task::checkSanity("sys$open");
#ifdef DEBUG_IO
kprintf("Task::sys$open(): PID=%u, path=%s {%u}\n", m_pid, path, pathLength);
#endif
- auto* handle = current->openFile(String(path, pathLength));
+ auto* handle = openFile(String(path, pathLength));
if (handle)
return handle->fd();
return -1;