1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:27:46 +00:00

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. :^)
This commit is contained in:
Andreas Kling 2021-11-08 00:51:39 +01:00
parent 7ee10c6926
commit 79fa9765ca
262 changed files with 2415 additions and 2600 deletions

View file

@ -6,7 +6,7 @@
#pragma once
#include <Kernel/API/KResult.h>
#include <AK/Error.h>
#include <Kernel/KBuffer.h>
namespace Kernel {
@ -101,10 +101,10 @@ class PerformanceEventBuffer {
public:
static OwnPtr<PerformanceEventBuffer> try_create_with_size(size_t buffer_size);
KResult append(int type, FlatPtr arg1, FlatPtr arg2, const StringView& arg3, Thread* current_thread = Thread::current());
KResult append_with_ip_and_bp(ProcessID pid, ThreadID tid, FlatPtr eip, FlatPtr ebp,
ErrorOr<void> append(int type, FlatPtr arg1, FlatPtr arg2, const StringView& arg3, Thread* current_thread = Thread::current());
ErrorOr<void> append_with_ip_and_bp(ProcessID pid, ThreadID tid, FlatPtr eip, FlatPtr ebp,
int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3);
KResult append_with_ip_and_bp(ProcessID pid, ThreadID tid, const RegisterState& regs,
ErrorOr<void> append_with_ip_and_bp(ProcessID pid, ThreadID tid, const RegisterState& regs,
int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3);
void clear()
@ -119,17 +119,17 @@ public:
return const_cast<PerformanceEventBuffer&>(*this).at(index);
}
KResult to_json(KBufferBuilder&) const;
ErrorOr<void> to_json(KBufferBuilder&) const;
void add_process(const Process&, ProcessEventType event_type);
KResultOr<FlatPtr> register_string(NonnullOwnPtr<KString>);
ErrorOr<FlatPtr> register_string(NonnullOwnPtr<KString>);
private:
explicit PerformanceEventBuffer(NonnullOwnPtr<KBuffer>);
template<typename Serializer>
KResult to_json_impl(Serializer&) const;
ErrorOr<void> to_json_impl(Serializer&) const;
PerformanceEvent& at(size_t index);