Kernel: Disable profiling if setting up the buffer or timer failed

This commit is contained in:
Gunnar Beutner 2021-05-24 08:59:30 +02:00 committed by Andreas Kling
parent d3f298c592
commit ad6587424f
Notes: sideshowbarker 2024-07-18 17:28:30 +09:00

View file

@ -53,10 +53,14 @@ KResultOr<int> Process::sys$profiling_enable(pid_t pid, u64 event_mask)
return EPERM;
g_profiling_event_mask = event_mask;
process->set_profiling(true);
if (!process->create_perf_events_buffer_if_needed())
if (!process->create_perf_events_buffer_if_needed()) {
process->set_profiling(false);
return ENOMEM;
if (!TimeManagement::the().enable_profile_timer())
}
if (!TimeManagement::the().enable_profile_timer()) {
process->set_profiling(false);
return ENOTSUP;
}
return 0;
}