mirror of
https://github.com/RGBCube/serenity
synced 2025-05-21 15:35:07 +00:00
Kernel: Move KBufferBuilder to the fallible KBuffer API
KBufferBuilder::build() now returns an OwnPtr<KBuffer> and can fail. Clients of the API have been updated to handle that situation.
This commit is contained in:
parent
d936d86332
commit
8e79bde2b7
18 changed files with 121 additions and 100 deletions
|
@ -612,10 +612,14 @@ void Process::finalize()
|
|||
if (!description_or_error.is_error()) {
|
||||
auto& description = description_or_error.value();
|
||||
auto json = m_perf_event_buffer->to_json(m_pid, m_executable ? m_executable->absolute_path() : "");
|
||||
auto json_buffer = UserOrKernelBuffer::for_kernel_buffer(json.data());
|
||||
auto result = description->write(json_buffer, json.size());
|
||||
if (result.is_error()) {
|
||||
dbgln("Error while writing perfcore file: {}", result.error().error());
|
||||
if (!json) {
|
||||
dbgln("Error generating perfcore JSON");
|
||||
} else {
|
||||
auto json_buffer = UserOrKernelBuffer::for_kernel_buffer(json->data());
|
||||
auto result = description->write(json_buffer, json->size());
|
||||
if (result.is_error()) {
|
||||
dbgln("Error while writing perfcore file: {}", result.error().error());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -840,7 +844,7 @@ void Process::FileDescriptionAndFlags::set(NonnullRefPtr<FileDescription>&& desc
|
|||
m_flags = flags;
|
||||
}
|
||||
|
||||
KBuffer Process::backtrace() const
|
||||
OwnPtr<KBuffer> Process::backtrace() const
|
||||
{
|
||||
KBufferBuilder builder;
|
||||
for_each_thread([&](Thread& thread) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue