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:
parent
0dea0fd06f
commit
a69734bf2e
6 changed files with 33 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue