summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/inode_watcher.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-08 00:51:39 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-08 01:10:53 +0100
commit79fa9765ca89869d19364143989436d117974c21 (patch)
tree3af62f70127d9217d841047f6b7461351800d1ae /Kernel/Syscalls/inode_watcher.cpp
parent7ee10c69264cb278845a1e1b06d5acf2e5e7ddf0 (diff)
downloadserenity-79fa9765ca89869d19364143989436d117974c21.zip
Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
Diffstat (limited to 'Kernel/Syscalls/inode_watcher.cpp')
-rw-r--r--Kernel/Syscalls/inode_watcher.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Kernel/Syscalls/inode_watcher.cpp b/Kernel/Syscalls/inode_watcher.cpp
index b118d10d53..0634d23a4e 100644
--- a/Kernel/Syscalls/inode_watcher.cpp
+++ b/Kernel/Syscalls/inode_watcher.cpp
@@ -13,7 +13,7 @@
namespace Kernel {
-KResultOr<FlatPtr> Process::sys$create_inode_watcher(u32 flags)
+ErrorOr<FlatPtr> Process::sys$create_inode_watcher(u32 flags)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(rpath);
@@ -34,7 +34,7 @@ KResultOr<FlatPtr> Process::sys$create_inode_watcher(u32 flags)
return fd_allocation.fd;
}
-KResultOr<FlatPtr> Process::sys$inode_watcher_add_watch(Userspace<const Syscall::SC_inode_watcher_add_watch_params*> user_params)
+ErrorOr<FlatPtr> Process::sys$inode_watcher_add_watch(Userspace<const Syscall::SC_inode_watcher_add_watch_params*> user_params)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(rpath);
@@ -52,13 +52,14 @@ KResultOr<FlatPtr> Process::sys$inode_watcher_add_watch(Userspace<const Syscall:
return TRY(inode_watcher->register_inode(custody->inode(), params.event_mask));
}
-KResultOr<FlatPtr> Process::sys$inode_watcher_remove_watch(int fd, int wd)
+ErrorOr<FlatPtr> Process::sys$inode_watcher_remove_watch(int fd, int wd)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
auto description = TRY(fds().open_file_description(fd));
if (!description->is_inode_watcher())
return EBADF;
- return description->inode_watcher()->unregister_by_wd(wd);
+ TRY(description->inode_watcher()->unregister_by_wd(wd));
+ return 0;
}
}