diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-10-24 13:19:36 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-10-24 13:19:36 +0200 |
commit | 5f36a5f22e8bf0e9de9a8059722352d2f8cf9b5f (patch) | |
tree | dcb425849c408c6d2adf9f195ee34d23acd8901d /Kernel/Task.cpp | |
parent | bca4b71bfa1e3db74aaa706a9849e36768282a95 (diff) | |
download | serenity-5f36a5f22e8bf0e9de9a8059722352d2f8cf9b5f.zip |
Add an lstat() syscall and use it to make "ls" nicer.
Diffstat (limited to 'Kernel/Task.cpp')
-rw-r--r-- | Kernel/Task.cpp | 11 |
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; |