提交 97559999 编写于 作者: 些猜's avatar 些猜

porting里新增接口sched_setscheduler,修改musl_src.gni,新增对应测试用例并修改test_src_functional.gni

Signed-off-by: 些猜's avatarcaifuzhou <504631861@qq.com>
上级 6d299e95
#include <sched.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.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 = [ ...@@ -58,6 +58,7 @@ functional_list = [
"strtol", "strtol",
"strtold", "strtold",
"swprintf", "swprintf",
"sched_setscheduler",
"tgmath", "tgmath",
"time", "time",
"tls_align", "tls_align",
......
...@@ -1838,6 +1838,7 @@ musl_src_porting_file = [ ...@@ -1838,6 +1838,7 @@ musl_src_porting_file = [
"src/multibyte/wcsnrtombs.c", "src/multibyte/wcsnrtombs.c",
"src/network/inet_legacy.c", "src/network/inet_legacy.c",
"src/passwd/getspnam_r.c", "src/passwd/getspnam_r.c",
"src/sched/sched_setscheduler.c",
"src/thread/arm/clone.s", "src/thread/arm/clone.s",
"src/thread/arm/syscall_cp.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);//, MUSL_TYPE_PROCESS
;
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.
先完成此消息的编辑!
想要评论请 注册