mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
Kernel: Make File::write() and File::read() return KResultOr<size_t>
Instead of returning a ssize_t where negative values mean error, we now return KResultOr<size_t> and use the error state to report errors exclusively.
This commit is contained in:
parent
58feebeed2
commit
7a3ab6c517
58 changed files with 223 additions and 229 deletions
|
@ -56,8 +56,10 @@ ssize_t Process::sys$read(int fd, Userspace<u8*> buffer, ssize_t size)
|
|||
return -EAGAIN;
|
||||
}
|
||||
}
|
||||
// FIXME: We should have a read() that takes a Userspace<u8*>
|
||||
return description->read(buffer.unsafe_userspace_ptr(), size);
|
||||
auto result = description->read(buffer.unsafe_userspace_ptr(), size);
|
||||
if (result.is_error())
|
||||
return result.error();
|
||||
return result.value();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue