mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +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
|
@ -905,7 +905,9 @@ void vdbgln(StringView fmtstr, TypeErasedFormatParams& params)
|
|||
struct timespec ts = TimeManagement::the().monotonic_time(TimePrecision::Coarse).to_timespec();
|
||||
if (Kernel::Thread::current()) {
|
||||
auto& thread = *Kernel::Thread::current();
|
||||
builder.appendff("{}.{:03} \033[34;1m[#{} {}({}:{})]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000, Kernel::Processor::current_id(), thread.process().name(), thread.pid().value(), thread.tid().value());
|
||||
thread.process().name().with([&](auto& process_name) {
|
||||
builder.appendff("{}.{:03} \033[34;1m[#{} {}({}:{})]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000, Kernel::Processor::current_id(), process_name->view(), thread.pid().value(), thread.tid().value());
|
||||
});
|
||||
} else {
|
||||
builder.appendff("{}.{:03} \033[34;1m[#{} Kernel]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000, Kernel::Processor::current_id());
|
||||
}
|
||||
|
@ -958,7 +960,9 @@ void vdmesgln(StringView fmtstr, TypeErasedFormatParams& params)
|
|||
|
||||
if (Kernel::Processor::is_initialized() && Kernel::Thread::current()) {
|
||||
auto& thread = *Kernel::Thread::current();
|
||||
builder.appendff("{}.{:03} \033[34;1m[{}({}:{})]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000, thread.process().name(), thread.pid().value(), thread.tid().value());
|
||||
thread.process().name().with([&](auto& process_name) {
|
||||
builder.appendff("{}.{:03} \033[34;1m[{}({}:{})]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000, process_name->view(), thread.pid().value(), thread.tid().value());
|
||||
});
|
||||
} else {
|
||||
builder.appendff("{}.{:03} \033[34;1m[Kernel]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000);
|
||||
}
|
||||
|
@ -983,7 +987,9 @@ void v_critical_dmesgln(StringView fmtstr, TypeErasedFormatParams& params)
|
|||
# ifdef AK_OS_SERENITY
|
||||
if (Kernel::Processor::is_initialized() && Kernel::Thread::current()) {
|
||||
auto& thread = *Kernel::Thread::current();
|
||||
builder.appendff("[{}({}:{})]: ", thread.process().name(), thread.pid().value(), thread.tid().value());
|
||||
thread.process().name().with([&](auto& process_name) {
|
||||
builder.appendff("[{}({}:{})]: ", process_name->view(), thread.pid().value(), thread.tid().value());
|
||||
});
|
||||
} else {
|
||||
builder.appendff("[Kernel]: ");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue