2020-01-18 05:38:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2019-06-07 06:49:03 -03:00
|
|
|
#include <errno.h>
|
|
|
|
|
#include <sched.h>
|
2021-02-05 08:16:30 -03:00
|
|
|
#include <syscall.h>
|
2019-04-21 19:13:41 -03:00
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
|
|
int sched_yield()
|
|
|
|
|
{
|
|
|
|
|
int rc = syscall(SC_yield);
|
|
|
|
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-20 20:09:48 -03:00
|
|
|
int sched_get_priority_min([[maybe_unused]] int policy)
|
2019-05-29 18:20:51 -03:00
|
|
|
{
|
|
|
|
|
return 0; // Idle
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-20 20:09:48 -03:00
|
|
|
int sched_get_priority_max([[maybe_unused]] int policy)
|
2019-05-29 18:20:51 -03:00
|
|
|
{
|
|
|
|
|
return 3; // High
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-07 06:49:03 -03:00
|
|
|
int sched_setparam(pid_t pid, const struct sched_param* param)
|
2019-05-29 18:20:51 -03:00
|
|
|
{
|
|
|
|
|
int rc = syscall(SC_sched_setparam, pid, param);
|
|
|
|
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-07 06:49:03 -03:00
|
|
|
int sched_getparam(pid_t pid, struct sched_param* param)
|
2019-05-29 18:20:51 -03:00
|
|
|
{
|
|
|
|
|
int rc = syscall(SC_sched_getparam, pid, param);
|
|
|
|
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
|
|
|
}
|
2019-04-21 19:13:41 -03:00
|
|
|
}
|