1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 18:15:06 +00:00

Kernel: Also add a process boosting mechanism

Let's also have set_process_boost() for giving all threads in a process
the same boost.
This commit is contained in:
Andreas Kling 2019-12-30 20:10:00 +01:00
parent 0dea0fd06f
commit a69734bf2e
6 changed files with 33 additions and 2 deletions

View file

@ -3922,3 +3922,17 @@ int Process::sys$set_thread_boost(int tid, int amount)
thread->set_priority_boost(amount);
return 0;
}
int Process::sys$set_process_boost(pid_t pid, int amount)
{
if (amount < 0 || amount > 20)
return -EINVAL;
InterruptDisabler disabler;
auto* process = Process::from_pid(pid);
if (!process || process->is_dead())
return -ESRCH;
if (!is_superuser() && process->uid() != euid())
return -EPERM;
process->m_priority_boost = amount;
return 0;
}