mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Kernel: Use KResultOr and TRY() for ThreadTracer
Also make the constructor private, since it's only called by the static factory function.
This commit is contained in:
parent
ededd6aac6
commit
cd5d483bbd
Notes:
sideshowbarker
2024-07-18 04:31:34 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/cd5d483bbd4
2 changed files with 3 additions and 6 deletions
|
@ -785,10 +785,7 @@ void Process::set_tty(TTY* tty)
|
|||
|
||||
KResult Process::start_tracing_from(ProcessID tracer)
|
||||
{
|
||||
auto thread_tracer = ThreadTracer::create(tracer);
|
||||
if (!thread_tracer)
|
||||
return ENOMEM;
|
||||
m_tracer = move(thread_tracer);
|
||||
m_tracer = TRY(ThreadTracer::try_create(tracer));
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Kernel {
|
|||
|
||||
class ThreadTracer {
|
||||
public:
|
||||
static OwnPtr<ThreadTracer> create(ProcessID tracer) { return try_make<ThreadTracer>(tracer); }
|
||||
static KResultOr<NonnullOwnPtr<ThreadTracer>> try_create(ProcessID tracer) { return adopt_nonnull_own_or_enomem(new (nothrow) ThreadTracer(tracer)); }
|
||||
|
||||
ProcessID tracer_pid() const { return m_tracer_pid; }
|
||||
bool has_pending_signal(u32 signal) const { return m_pending_signals & (1 << (signal - 1)); }
|
||||
|
@ -34,9 +34,9 @@ public:
|
|||
return m_regs.value();
|
||||
}
|
||||
|
||||
private:
|
||||
explicit ThreadTracer(ProcessID);
|
||||
|
||||
private:
|
||||
ProcessID m_tracer_pid { -1 };
|
||||
|
||||
// This is a bitmap for signals that are sent from the tracer to the tracee
|
||||
|
|
Loading…
Reference in a new issue