mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +00:00
Kernel: Make all syscall functions return KResultOr<T>
This makes it a lot easier to return errors since we no longer have to worry about negating EFOO errors and can just return them flat.
This commit is contained in:
parent
9af1e1a3bf
commit
ac71775de5
70 changed files with 747 additions and 742 deletions
|
@ -30,27 +30,27 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
int Process::sys$link(Userspace<const Syscall::SC_link_params*> user_params)
|
||||
KResultOr<int> Process::sys$link(Userspace<const Syscall::SC_link_params*> user_params)
|
||||
{
|
||||
REQUIRE_PROMISE(cpath);
|
||||
Syscall::SC_link_params params;
|
||||
if (!copy_from_user(¶ms, user_params))
|
||||
return -EFAULT;
|
||||
return EFAULT;
|
||||
auto old_path = copy_string_from_user(params.old_path);
|
||||
if (old_path.is_null())
|
||||
return -EFAULT;
|
||||
return EFAULT;
|
||||
auto new_path = copy_string_from_user(params.new_path);
|
||||
if (new_path.is_null())
|
||||
return -EFAULT;
|
||||
return EFAULT;
|
||||
return VFS::the().link(old_path, new_path, current_directory());
|
||||
}
|
||||
|
||||
int Process::sys$symlink(Userspace<const Syscall::SC_symlink_params*> user_params)
|
||||
KResultOr<int> Process::sys$symlink(Userspace<const Syscall::SC_symlink_params*> user_params)
|
||||
{
|
||||
REQUIRE_PROMISE(cpath);
|
||||
Syscall::SC_symlink_params params;
|
||||
if (!copy_from_user(¶ms, user_params))
|
||||
return -EFAULT;
|
||||
return EFAULT;
|
||||
auto target = get_syscall_path_argument(params.target);
|
||||
if (target.is_error())
|
||||
return target.error();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue