mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
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
This commit is contained in:
parent
c11c0fe453
commit
60eea6940f
3 changed files with 26 additions and 39 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue