]> granicus.if.org Git - strace/blob - sched.c
ioctl: prepare ioctl_decode_command_number for future changes
[strace] / sched.c
1 #include "defs.h"
2
3 #include <sched.h>
4
5 #include "xlat/schedulers.h"
6
7 SYS_FUNC(sched_getscheduler)
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
19 SYS_FUNC(sched_setscheduler)
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
33 SYS_FUNC(sched_getparam)
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
47 SYS_FUNC(sched_setparam)
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
59 SYS_FUNC(sched_get_priority_min)
60 {
61         if (entering(tcp)) {
62                 printxval(schedulers, tcp->u_arg[0], "SCHED_???");
63         }
64         return 0;
65 }
66
67 SYS_FUNC(sched_rr_get_interval)
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 }