1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

Kernel: Turn Thread::current and Process::current into functions

This allows us to query the current thread and process on a
per processor basis
This commit is contained in:
Tom 2020-06-28 15:34:31 -06:00 committed by Andreas Kling
parent cdc78515b6
commit 16783bd14d
39 changed files with 518 additions and 369 deletions

View file

@ -296,7 +296,7 @@ Optional<KBuffer> procfs$pid_vm(InodeIdentifier identifier)
KBufferBuilder builder;
JsonArraySerializer array { builder };
for (auto& region : process.regions()) {
if (!region.is_user_accessible() && !Process::current->is_superuser())
if (!region.is_user_accessible() && !Process::current()->is_superuser())
continue;
auto region_object = array.add_object();
region_object.add("readable", region.is_readable());
@ -439,7 +439,7 @@ Optional<KBuffer> procfs$profile(InodeIdentifier)
object.add("executable", Profiling::executable_path());
auto array = object.add_array("events");
bool mask_kernel_addresses = !Process::current->is_superuser();
bool mask_kernel_addresses = !Process::current()->is_superuser();
Profiling::for_each_sample([&](auto& sample) {
auto object = array.add_object();
object.add("type", "sample");
@ -677,7 +677,7 @@ Optional<KBuffer> procfs$pid_root(InodeIdentifier identifier)
Optional<KBuffer> procfs$self(InodeIdentifier)
{
char buffer[16];
sprintf(buffer, "%u", Process::current->pid());
sprintf(buffer, "%u", Process::current()->pid());
return KBuffer::copy((const u8*)buffer, strlen(buffer));
}
@ -807,7 +807,7 @@ Optional<KBuffer> procfs$memstat(InodeIdentifier)
Optional<KBuffer> procfs$all(InodeIdentifier)
{
InterruptDisabler disabler;
ScopedSpinLock lock(g_scheduler_lock);
auto processes = Process::all_processes();
KBufferBuilder builder;
JsonArraySerializer array { builder };