Dmitry V. Levin | fff2f31 | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 1 | #include "defs.h" |
| 2 | |
| 3 | #include <sched.h> |
| 4 | |
| 5 | #include "xlat/schedulers.h" |
| 6 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 7 | SYS_FUNC(sched_getscheduler) |
Dmitry V. Levin | fff2f31 | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 8 | { |
| 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. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 19 | SYS_FUNC(sched_setscheduler) |
Dmitry V. Levin | fff2f31 | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 20 | { |
| 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. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 33 | SYS_FUNC(sched_getparam) |
Dmitry V. Levin | fff2f31 | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 34 | { |
| 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. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 47 | SYS_FUNC(sched_setparam) |
Dmitry V. Levin | fff2f31 | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 48 | { |
| 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. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 59 | SYS_FUNC(sched_get_priority_min) |
Dmitry V. Levin | fff2f31 | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 60 | { |
| 61 | if (entering(tcp)) { |
| 62 | printxval(schedulers, tcp->u_arg[0], "SCHED_???"); |
| 63 | } |
| 64 | return 0; |
| 65 | } |
| 66 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 67 | SYS_FUNC(sched_rr_get_interval) |
Dmitry V. Levin | fff2f31 | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 68 | { |
| 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 | } |