blob: 8bb7c253eb8d3401c592166b8f8d2f9ec97815b2 [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
Dmitry V. Levina0bd3742015-04-07 01:36:50 +00007SYS_FUNC(sched_getscheduler)
Dmitry V. Levinfff2f312014-12-11 19:25:02 +00008{
9 if (entering(tcp)) {
10 tprintf("%d", (int) tcp->u_arg[0]);
11 } else if (!syserror(tcp)) {
12 tcp->auxstr = xlookup(schedulers, tcp->u_rval);
13 if (tcp->auxstr != NULL)
14 return RVAL_STR;
15 }
16 return 0;
17}
18
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000019SYS_FUNC(sched_setscheduler)
Dmitry V. Levinfff2f312014-12-11 19:25:02 +000020{
21 if (entering(tcp)) {
22 struct sched_param p;
23 tprintf("%d, ", (int) tcp->u_arg[0]);
24 printxval(schedulers, tcp->u_arg[1], "SCHED_???");
25 if (umove(tcp, tcp->u_arg[2], &p) < 0)
26 tprintf(", %#lx", tcp->u_arg[2]);
27 else
28 tprintf(", { %d }", p.sched_priority);
29 }
30 return 0;
31}
32
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000033SYS_FUNC(sched_getparam)
Dmitry V. Levinfff2f312014-12-11 19:25:02 +000034{
35 if (entering(tcp)) {
36 tprintf("%d, ", (int) tcp->u_arg[0]);
37 } else {
38 struct sched_param p;
39 if (umove(tcp, tcp->u_arg[1], &p) < 0)
40 tprintf("%#lx", tcp->u_arg[1]);
41 else
42 tprintf("{ %d }", p.sched_priority);
43 }
44 return 0;
45}
46
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000047SYS_FUNC(sched_setparam)
Dmitry V. Levinfff2f312014-12-11 19:25:02 +000048{
49 if (entering(tcp)) {
50 struct sched_param p;
51 if (umove(tcp, tcp->u_arg[1], &p) < 0)
52 tprintf("%d, %#lx", (int) tcp->u_arg[0], tcp->u_arg[1]);
53 else
54 tprintf("%d, { %d }", (int) tcp->u_arg[0], p.sched_priority);
55 }
56 return 0;
57}
58
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000059SYS_FUNC(sched_get_priority_min)
Dmitry V. Levinfff2f312014-12-11 19:25:02 +000060{
61 if (entering(tcp)) {
62 printxval(schedulers, tcp->u_arg[0], "SCHED_???");
63 }
64 return 0;
65}
66
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000067SYS_FUNC(sched_rr_get_interval)
Dmitry V. Levinfff2f312014-12-11 19:25:02 +000068{
69 if (entering(tcp)) {
70 tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]);
71 } else {
72 if (syserror(tcp))
73 tprintf("%#lx", tcp->u_arg[1]);
74 else
75 print_timespec(tcp, tcp->u_arg[1]);
76 }
77 return 0;
78}