mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
Kernel: Better handling of allocation failure in profiling
If we can't allocate a PerformanceEventBuffer to store the profiling events, we now fail sys$profiling_enable() and sys$perf_event() with ENOMEM instead of carrying on with a broken buffer.
This commit is contained in:
@@ -667,11 +667,12 @@ void Process::tracer_trap(Thread& thread, const RegisterState& regs)
|
||||
thread.send_urgent_signal_to_self(SIGTRAP);
|
||||
}
|
||||
|
||||
PerformanceEventBuffer& Process::ensure_perf_events()
|
||||
bool Process::create_perf_events_buffer_if_needed()
|
||||
{
|
||||
if (!m_perf_event_buffer)
|
||||
m_perf_event_buffer = make<PerformanceEventBuffer>();
|
||||
return *m_perf_event_buffer;
|
||||
if (!m_perf_event_buffer) {
|
||||
m_perf_event_buffer = PerformanceEventBuffer::try_create_with_size(4 * MiB);
|
||||
}
|
||||
return !!m_perf_event_buffer;
|
||||
}
|
||||
|
||||
bool Process::remove_thread(Thread& thread)
|
||||
|
||||
Reference in New Issue
Block a user