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