blob: d3192fa2161619878a405f6dea265e27b07a0c56 [file] [log] [blame]
Dmitry V. Levinfff2f312014-12-11 19:25:02 +00001#include "defs.h"
2
3#include <sched.h>
4
5#include "xlat/schedulers.h"
6
7int
8sys_sched_getscheduler(struct tcb *tcp)
9{
10 if (entering(tcp)) {
11 tprintf("%d", (int) tcp->u_arg[0]);
12 } else if (!syserror(tcp)) {
13 tcp->auxstr = xlookup(schedulers, tcp->u_rval);
14 if (tcp->auxstr != NULL)
15 return RVAL_STR;
16 }
17 return 0;
18}
19
20int
21sys_sched_setscheduler(struct tcb *tcp)
22{
23 if (entering(tcp)) {
24 struct sched_param p;
25 tprintf("%d, ", (int) tcp->u_arg[0]);
26 printxval(schedulers, tcp->u_arg[1], "SCHED_???");
27 if (umove(tcp, tcp->u_arg[2], &p) < 0)
28 tprintf(", %#lx", tcp->u_arg[2]);
29 else
30 tprintf(", { %d }", p.sched_priority);
31 }
32 return 0;
33}
34
35int
36sys_sched_getparam(struct tcb *tcp)
37{
38 if (entering(tcp)) {
39 tprintf("%d, ", (int) tcp->u_arg[0]);
40 } else {
41 struct sched_param p;
42 if (umove(tcp, tcp->u_arg[1], &p) < 0)
43 tprintf("%#lx", tcp->u_arg[1]);
44 else
45 tprintf("{ %d }", p.sched_priority);
46 }
47 return 0;
48}
49
50int
51sys_sched_setparam(struct tcb *tcp)
52{
53 if (entering(tcp)) {
54 struct sched_param p;
55 if (umove(tcp, tcp->u_arg[1], &p) < 0)
56 tprintf("%d, %#lx", (int) tcp->u_arg[0], tcp->u_arg[1]);
57 else
58 tprintf("%d, { %d }", (int) tcp->u_arg[0], p.sched_priority);
59 }
60 return 0;
61}
62
63int
64sys_sched_get_priority_min(struct tcb *tcp)
65{
66 if (entering(tcp)) {
67 printxval(schedulers, tcp->u_arg[0], "SCHED_???");
68 }
69 return 0;
70}
71
72int
73sys_sched_rr_get_interval(struct tcb *tcp)
74{
75 if (entering(tcp)) {
76 tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]);
77 } else {
78 if (syserror(tcp))
79 tprintf("%#lx", tcp->u_arg[1]);
80 else
81 print_timespec(tcp, tcp->u_arg[1]);
82 }
83 return 0;
84}