1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +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:
Andreas Kling 2021-03-01 13:49:16 +01:00
parent 9af1e1a3bf
commit ac71775de5
70 changed files with 747 additions and 742 deletions

View file

@ -28,7 +28,7 @@
namespace Kernel {
int Process::sys$uname(Userspace<utsname*> user_buf)
KResultOr<int> Process::sys$uname(Userspace<utsname*> user_buf)
{
extern String* g_hostname;
extern Lock* g_hostname_lock;
@ -37,7 +37,7 @@ int Process::sys$uname(Userspace<utsname*> user_buf)
LOCKER(*g_hostname_lock, Lock::Mode::Shared);
if (g_hostname->length() + 1 > sizeof(utsname::nodename))
return -ENAMETOOLONG;
return ENAMETOOLONG;
utsname buf {};
memcpy(buf.sysname, "SerenityOS", 11);
@ -47,7 +47,7 @@ int Process::sys$uname(Userspace<utsname*> user_buf)
memcpy(buf.nodename, g_hostname->characters(), g_hostname->length() + 1);
if (!copy_to_user(user_buf, &buf))
return -EFAULT;
return EFAULT;
return 0;
}