1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +00:00

Kernel: Stop using *LockRefPtr for ProcessGroup

Had to wrap Process::m_pg in a SpinlockProtected for this to be safe.
This commit is contained in:
Andreas Kling 2023-04-02 21:57:12 +02:00
parent ed1253ab90
commit 83b409083b
9 changed files with 31 additions and 23 deletions

View file

@ -38,7 +38,8 @@ ErrorOr<FlatPtr> Process::sys$setsid()
return EPERM;
// Create a new Session and a new ProcessGroup.
m_pg = TRY(ProcessGroup::try_create(ProcessGroupID(pid().value())));
auto process_group = TRY(ProcessGroup::create(ProcessGroupID(pid().value())));
m_pg.with([&](auto& pg) { pg = move(process_group); });
m_tty = nullptr;
return with_mutable_protected_data([&](auto& protected_data) -> ErrorOr<FlatPtr> {
protected_data.sid = pid().value();
@ -119,7 +120,8 @@ ErrorOr<FlatPtr> Process::sys$setpgid(pid_t specified_pid, pid_t specified_pgid)
return EPERM;
}
// FIXME: There are more EPERM conditions to check for here..
process->m_pg = TRY(ProcessGroup::try_find_or_create(new_pgid));
auto process_group = TRY(ProcessGroup::find_or_create(new_pgid));
process->m_pg.with([&](auto& pg) { pg = move(process_group); });
return with_mutable_protected_data([&](auto& protected_data) -> ErrorOr<FlatPtr> {
auto credentials = this->credentials();