Fix holding spinlocks for too long

This commit is contained in:
2025-09-06 09:35:31 +02:00
parent b89882e1cf
commit 3b18f56376
2 changed files with 11 additions and 12 deletions

View File

@ -12,15 +12,15 @@ int32_t SYSCALL3(sys_processctl, pid1, cmd1, optsptr1) {
uint64_t pid = pid1;
uint64_t cmd = cmd1;
int32_t ret = E_OK;
spinlock_acquire(&PROCS.spinlock);
if (pid == PID_SELF_MAGIC) {
pid = PROCS.current->pid;
}
spinlock_acquire(&PROCS.spinlock);
Proc *proc = NULL;
LL_FINDPROP(PROCS.procs, proc, pid, pid);
spinlock_release(&PROCS.spinlock);
if (proc == NULL) {
ret = E_INVALIDARGUMENT;
@ -31,15 +31,12 @@ int32_t SYSCALL3(sys_processctl, pid1, cmd1, optsptr1) {
case PCTL_KILL: {
proc_kill(proc);
ret = E_DOSCHEDULING;
goto done;
} break;
default: {
ret = E_INVALIDARGUMENT;
goto done;
} break;
}
done:
spinlock_release(&PROCS.spinlock);
return ret;
}