1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 04:24:59 +00:00

Kernel: Make Process::start_tracing_from API OOM safe

Modify the API so it's possible to propagate error on OOM failure.
NonnullOwnPtr<T> is not appropriate for the ThreadTracer::create() API,
so switch to OwnPtr<T>, use adopt_own_if_nonnull() to handle creation.
This commit is contained in:
Brian Gianforcaro 2021-05-12 21:44:07 -07:00 committed by Andreas Kling
parent dba261f79b
commit 956314f0a1
4 changed files with 12 additions and 6 deletions

View file

@ -660,9 +660,13 @@ void Process::set_tty(TTY* tty)
m_tty = tty;
}
void Process::start_tracing_from(ProcessID tracer)
KResult Process::start_tracing_from(ProcessID tracer)
{
m_tracer = ThreadTracer::create(tracer);
auto thread_tracer = ThreadTracer::create(tracer);
if (!thread_tracer)
return ENOMEM;
m_tracer = move(thread_tracer);
return KSuccess;
}
void Process::stop_tracing()