mirror of
https://github.com/RGBCube/serenity
synced 2025-07-08 20:27:35 +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
|
@ -31,26 +31,26 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
int Process::sys$dump_backtrace()
|
||||
KResultOr<int> Process::sys$dump_backtrace()
|
||||
{
|
||||
dump_backtrace();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$dbgputch(u8 ch)
|
||||
KResultOr<int> Process::sys$dbgputch(u8 ch)
|
||||
{
|
||||
IO::out8(0xe9, ch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$dbgputstr(Userspace<const u8*> characters, int length)
|
||||
KResultOr<int> Process::sys$dbgputstr(Userspace<const u8*> characters, int length)
|
||||
{
|
||||
if (length <= 0)
|
||||
return 0;
|
||||
|
||||
auto buffer = UserOrKernelBuffer::for_user_buffer(characters, length);
|
||||
if (!buffer.has_value())
|
||||
return -EFAULT;
|
||||
return EFAULT;
|
||||
ssize_t nread = buffer.value().read_buffered<1024>(length, [&](const u8* buffer, size_t buffer_size) {
|
||||
for (size_t i = 0; i < buffer_size; ++i)
|
||||
IO::out8(0xe9, buffer[i]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue