mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:44:58 +00:00
LibC: Implement pthread_{get,set}schedparam
This commit is contained in:
parent
b8567d7a9d
commit
ce25bd8584
1 changed files with 19 additions and 4 deletions
|
@ -496,15 +496,30 @@ int pthread_attr_setscope([[maybe_unused]] pthread_attr_t* attributes, [[maybe_u
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_getschedparam.html
|
||||
int pthread_getschedparam([[maybe_unused]] pthread_t thread, [[maybe_unused]] int* policy, [[maybe_unused]] struct sched_param* param)
|
||||
int pthread_getschedparam(pthread_t thread, [[maybe_unused]] int* policy, struct sched_param* param)
|
||||
{
|
||||
return 0;
|
||||
Syscall::SC_scheduler_parameters_params parameters {
|
||||
.pid_or_tid = thread,
|
||||
.mode = Syscall::SchedulerParametersMode::Thread,
|
||||
.parameters = *param,
|
||||
};
|
||||
int rc = syscall(Syscall::SC_scheduler_get_parameters, ¶meters);
|
||||
if (rc == 0)
|
||||
*param = parameters.parameters;
|
||||
|
||||
__RETURN_PTHREAD_ERROR(rc);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_setschedparam.html
|
||||
int pthread_setschedparam([[maybe_unused]] pthread_t thread, [[maybe_unused]] int policy, [[maybe_unused]] const struct sched_param* param)
|
||||
int pthread_setschedparam(pthread_t thread, [[maybe_unused]] int policy, struct sched_param const* param)
|
||||
{
|
||||
return 0;
|
||||
Syscall::SC_scheduler_parameters_params parameters {
|
||||
.pid_or_tid = thread,
|
||||
.mode = Syscall::SchedulerParametersMode::Thread,
|
||||
.parameters = *param,
|
||||
};
|
||||
int rc = syscall(Syscall::SC_scheduler_set_parameters, ¶meters);
|
||||
__RETURN_PTHREAD_ERROR(rc);
|
||||
}
|
||||
|
||||
static void pthread_cancel_signal_handler(int signal)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue