diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-06 17:33:37 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-06 18:56:51 +0200 |
commit | 60eea6940f52c37e88199659b05e7df4494ac6fd (patch) | |
tree | e148ae4ced5a573e41e762ed3941a8e49378c88d /Kernel/Coredump.h | |
parent | c11c0fe4533051055d3dfc721a82adbd2599fb7d (diff) | |
download | serenity-60eea6940f52c37e88199659b05e7df4494ac6fd.zip |
Kernel: Tidy up Coredump construction
- Use KResultOr and TRY to propagate errors
- Return more specific errors now that they have a path out from here
Diffstat (limited to 'Kernel/Coredump.h')
-rw-r--r-- | Kernel/Coredump.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/Coredump.h b/Kernel/Coredump.h index de405fbe66..197b9feb83 100644 --- a/Kernel/Coredump.h +++ b/Kernel/Coredump.h @@ -15,14 +15,14 @@ namespace Kernel { class Coredump { public: - static OwnPtr<Coredump> create(NonnullRefPtr<Process>, const String& output_path); + static KResultOr<NonnullOwnPtr<Coredump>> try_create(NonnullRefPtr<Process>, StringView output_path); ~Coredump() = default; [[nodiscard]] KResult write(); private: - Coredump(NonnullRefPtr<Process>, NonnullRefPtr<FileDescription>&&); - static RefPtr<FileDescription> create_target_file(const Process&, const String& output_path); + Coredump(NonnullRefPtr<Process>, NonnullRefPtr<FileDescription>); + static KResultOr<NonnullRefPtr<FileDescription>> try_create_target_file(Process const&, StringView output_path); [[nodiscard]] KResult write_elf_header(); [[nodiscard]] KResult write_program_headers(size_t notes_size); @@ -36,7 +36,7 @@ private: KResultOr<ByteBuffer> create_notes_metadata_data() const; NonnullRefPtr<Process> m_process; - NonnullRefPtr<FileDescription> m_fd; + NonnullRefPtr<FileDescription> m_description; const size_t m_num_program_headers; }; |