1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

Kernel: Migrate process list locking to ProtectedValue

The existing recursive spinlock is repurposed for profiling only, as it
was shared with the process list.
This commit is contained in:
Jean-Baptiste Boric 2021-07-24 18:43:29 +02:00 committed by Andreas Kling
parent 8554b66d09
commit 08891e82a5
5 changed files with 76 additions and 86 deletions

View file

@ -16,7 +16,6 @@ KResultOr<FlatPtr> Process::sys$getsid(pid_t pid)
REQUIRE_PROMISE(proc);
if (pid == 0)
return sid().value();
ScopedSpinLock lock(g_processes_lock);
auto process = Process::from_pid(pid);
if (!process)
return ESRCH;
@ -51,7 +50,6 @@ KResultOr<FlatPtr> Process::sys$getpgid(pid_t pid)
REQUIRE_PROMISE(proc);
if (pid == 0)
return pgid().value();
ScopedSpinLock lock(g_processes_lock); // FIXME: Use a ProcessHandle
auto process = Process::from_pid(pid);
if (!process)
return ESRCH;
@ -68,7 +66,6 @@ KResultOr<FlatPtr> Process::sys$getpgrp()
SessionID Process::get_sid_from_pgid(ProcessGroupID pgid)
{
// FIXME: This xor sys$setsid() uses the wrong locking mechanism.
ScopedSpinLock lock(g_processes_lock);
SessionID sid { -1 };
Process::for_each_in_pgrp(pgid, [&](auto& process) {
@ -83,7 +80,7 @@ KResultOr<FlatPtr> Process::sys$setpgid(pid_t specified_pid, pid_t specified_pgi
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(proc);
ScopedSpinLock lock(g_processes_lock); // FIXME: Use a ProcessHandle
// FIXME: Use a ProcessHandle
ProcessID pid = specified_pid ? ProcessID(specified_pid) : this->pid();
if (specified_pgid < 0) {
// The value of the pgid argument is less than 0, or is not a value supported by the implementation.