blob: d968a2c5c37a2b791f0b1e878970e109090c8c74 [file] [log] [blame]
Fei Jieea5c7b52016-03-10 17:12:24 +08001#include "tests.h"
2#include <sys/syscall.h>
3
4#if defined __NR_sched_getparam && defined __NR_sched_setparam
5
6# include <errno.h>
7# include <sched.h>
8# include <stdio.h>
9# include <unistd.h>
10
11int
12main(void)
13{
14 struct sched_param *const param = tail_alloc(sizeof(struct sched_param));
15 int rc = syscall(__NR_sched_getparam, 0, param);
16 printf("sched_getparam(0, [%d]) = %d\n",
17 param->sched_priority, rc);
18
19 param->sched_priority = -1;
20 rc = syscall(__NR_sched_setparam, 0, param);
21 printf("sched_setparam(0, [%d]) = %d %s (%m)\n",
22 param->sched_priority, rc,
23 errno == EPERM ? "EPERM" : "EINVAL");
24
25 puts("+++ exited with 0 +++");
26 return 0;
27}
28
29#else
30
31SKIP_MAIN_UNDEFINED("__NR_sched_getparam && __NR_sched_setparam")
32
33#endif