提交 9b3c8ab0 编写于 作者: O openharmony_ci 提交者: Gitee

!166 扩展linux用户态下的接口sched_setscheduler

Merge pull request !166 from caifuzhou/master
#include <sched.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "test.h"
#define TEST(c) ((!c) ? 1 : (t_error(#c" failed: %s" ,strerror(errno)),0))
int main(int argc,char *argv[])
{
struct sched_param param;
int maxpri;
maxpri = sched_get_priority_max(SCHED_FIFO);
if(maxpri == -1)
{
perror("get priority failed");
return -1;
}
param.sched_priority = maxpri;
TEST(sched_setscheduler(getpid(), SCHED_FIFO, &param));
TEST(!(sched_getscheduler(getpid()) == SCHED_FIFO));
return 0;
}
......@@ -58,6 +58,7 @@ functional_list = [
"strtol",
"strtold",
"swprintf",
"sched_setscheduler",
"tgmath",
"time",
"tls_align",
......
......@@ -1838,6 +1838,7 @@ musl_src_porting_file = [
"src/multibyte/wcsnrtombs.c",
"src/network/inet_legacy.c",
"src/passwd/getspnam_r.c",
"src/sched/sched_setscheduler.c",
"src/thread/arm/clone.s",
"src/thread/arm/syscall_cp.s",
]
#include <sched.h>
#include <errno.h>
#include "syscall.h"
#include "pthread_impl.h"
int sched_setscheduler(pid_t pid, int sched, const struct sched_param *param)
{
int r;
if (!param) {
r = -EINVAL;
goto exit;
}
r = __syscall(SYS_sched_setscheduler, pid , sched , param->sched_priority);
;
exit:
return __syscall_ret(r);
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册