mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
Kernel: Protect Process::m_name with a spinlock
This also lets us remove the `get_process_name` and `set_process_name` syscalls from the big lock. :^)
This commit is contained in:
parent
b26ecca970
commit
fe7b08dad7
13 changed files with 102 additions and 42 deletions
|
@ -335,10 +335,13 @@ OwnPtr<PerformanceEventBuffer> PerformanceEventBuffer::try_create_with_size(size
|
|||
ErrorOr<void> PerformanceEventBuffer::add_process(Process const& process, ProcessEventType event_type)
|
||||
{
|
||||
OwnPtr<KString> executable;
|
||||
if (process.executable())
|
||||
if (process.executable()) {
|
||||
executable = TRY(process.executable()->try_serialize_absolute_path());
|
||||
else
|
||||
executable = TRY(KString::formatted("<{}>", process.name()));
|
||||
} else {
|
||||
executable = TRY(process.name().with([&](auto& process_name) {
|
||||
return KString::formatted("<{}>", process_name->view());
|
||||
}));
|
||||
}
|
||||
|
||||
TRY(append_with_ip_and_bp(process.pid(), 0, 0, 0,
|
||||
event_type == ProcessEventType::Create ? PERF_EVENT_PROCESS_CREATE : PERF_EVENT_PROCESS_EXEC,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue