mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
Kernel: Rework Process::Priority into ThreadPriority
Scheduling priority is now set at the thread level instead of at the process level. This is a step towards allowing processes to set different priorities for threads. There's no userspace API for that yet, since only the main thread's priority is affected by sched_setparam().
This commit is contained in:
parent
e33bbdb6ba
commit
083c5f8b89
7 changed files with 46 additions and 46 deletions
|
@ -2555,10 +2555,10 @@ int Process::sys$sched_setparam(pid_t pid, const struct sched_param* param)
|
|||
if (!is_superuser() && m_euid != peer->m_uid && m_uid != peer->m_uid)
|
||||
return -EPERM;
|
||||
|
||||
if (param->sched_priority < Process::FirstPriority || param->sched_priority > Process::LastPriority)
|
||||
if (param->sched_priority < (int)ThreadPriority::First || param->sched_priority > (int)ThreadPriority::Last)
|
||||
return -EINVAL;
|
||||
|
||||
peer->set_priority(Priority(param->sched_priority));
|
||||
peer->main_thread().set_priority((ThreadPriority)param->sched_priority);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2578,7 +2578,7 @@ int Process::sys$sched_getparam(pid_t pid, struct sched_param* param)
|
|||
if (!is_superuser() && m_euid != peer->m_uid && m_uid != peer->m_uid)
|
||||
return -EPERM;
|
||||
|
||||
param->sched_priority = peer->priority();
|
||||
param->sched_priority = (int)peer->main_thread().priority();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2755,23 +2755,6 @@ int Process::sys$get_shared_buffer_size(int shared_buffer_id)
|
|||
return shared_buffer.size();
|
||||
}
|
||||
|
||||
const char* to_string(Process::Priority priority)
|
||||
{
|
||||
switch (priority) {
|
||||
case Process::IdlePriority:
|
||||
return "Idle";
|
||||
case Process::LowPriority:
|
||||
return "Low";
|
||||
case Process::NormalPriority:
|
||||
return "Normal";
|
||||
case Process::HighPriority:
|
||||
return "High";
|
||||
}
|
||||
kprintf("to_string(Process::Priority): Invalid priority: %u\n", priority);
|
||||
ASSERT_NOT_REACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Process::terminate_due_to_signal(u8 signal)
|
||||
{
|
||||
ASSERT_INTERRUPTS_DISABLED();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue