2 * Copyright (c) 2004 Ulrich Drepper <drepper@redhat.com>
3 * Copyright (c) 2005 Roland McGrath <roland@redhat.com>
4 * Copyright (c) 2012-2015 Dmitry V. Levin <ldv@altlinux.org>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include "xlat/schedulers.h"
35 #include "xlat/sched_flags.h"
37 SYS_FUNC(sched_getscheduler)
40 tprintf("%d", (int) tcp->u_arg[0]);
41 } else if (!syserror(tcp)) {
42 tcp->auxstr = xlookup(schedulers, (kernel_ulong_t) tcp->u_rval);
43 if (tcp->auxstr != NULL)
49 SYS_FUNC(sched_setscheduler)
51 tprintf("%d, ", (int) tcp->u_arg[0]);
52 printxval(schedulers, tcp->u_arg[1], "SCHED_???");
54 printnum_int(tcp, tcp->u_arg[2], "%d");
59 SYS_FUNC(sched_getparam)
62 tprintf("%d, ", (int) tcp->u_arg[0]);
64 printnum_int(tcp, tcp->u_arg[1], "%d");
68 SYS_FUNC(sched_setparam)
70 tprintf("%d, ", (int) tcp->u_arg[0]);
71 printnum_int(tcp, tcp->u_arg[1], "%d");
76 SYS_FUNC(sched_get_priority_min)
78 printxval(schedulers, tcp->u_arg[0], "SCHED_???");
83 SYS_FUNC(sched_rr_get_interval)
86 tprintf("%d, ", (int) tcp->u_arg[0]);
89 printaddr(tcp->u_arg[1]);
91 print_timespec(tcp, tcp->u_arg[1]);
97 print_sched_attr(struct tcb *const tcp, const kernel_ulong_t addr,
102 uint32_t sched_policy;
103 uint64_t sched_flags;
105 uint32_t sched_priority;
106 uint64_t sched_runtime;
107 uint64_t sched_deadline;
108 uint64_t sched_period;
111 if (size > sizeof(attr))
113 if (umoven_or_printaddr(tcp, addr, size, &attr))
116 tprintf("{size=%u, sched_policy=", attr.size);
117 printxval(schedulers, attr.sched_policy, "SCHED_???");
118 tprints(", sched_flags=");
119 printflags64(sched_flags, attr.sched_flags, "SCHED_FLAG_???");
120 tprintf(", sched_nice=%d", attr.sched_nice);
121 tprintf(", sched_priority=%u", attr.sched_priority);
122 tprintf(", sched_runtime=%" PRIu64, attr.sched_runtime);
123 tprintf(", sched_deadline=%" PRIu64, attr.sched_deadline);
124 tprintf(", sched_period=%" PRIu64 "}", attr.sched_period);
127 SYS_FUNC(sched_setattr)
129 tprintf("%d, ", (int) tcp->u_arg[0]);
130 print_sched_attr(tcp, tcp->u_arg[1], 0x100);
131 tprintf(", %u", (unsigned int) tcp->u_arg[2]);
136 SYS_FUNC(sched_getattr)
139 tprintf("%d, ", (int) tcp->u_arg[0]);
141 print_sched_attr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
143 (unsigned int) tcp->u_arg[2],
144 (unsigned int) tcp->u_arg[3]);