2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
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.
33 #include <sys/timex.h>
36 print_timezone(struct tcb *tcp, const long addr)
40 if (umove_or_printaddr(tcp, addr, &tz))
43 tprintf("{tz_minuteswest=%d, tz_dsttime=%d}",
44 tz.tz_minuteswest, tz.tz_dsttime);
47 SYS_FUNC(gettimeofday)
50 print_timeval(tcp, tcp->u_arg[0]);
52 print_timezone(tcp, tcp->u_arg[1]);
58 SYS_FUNC(osf_gettimeofday)
61 print_timeval32(tcp, tcp->u_arg[0]);
63 print_timezone(tcp, tcp->u_arg[1]);
69 SYS_FUNC(settimeofday)
71 print_timeval(tcp, tcp->u_arg[0]);
73 print_timezone(tcp, tcp->u_arg[1]);
79 SYS_FUNC(osf_settimeofday)
81 print_timeval32(tcp, tcp->u_arg[0]);
83 print_timezone(tcp, tcp->u_arg[1]);
92 print_timespec(tcp, tcp->u_arg[0]);
97 * Second (returned) timespec is only significant if syscall
98 * was interrupted. On success and in case of other errors we
99 * print only its address, since kernel doesn't modify it,
100 * and printing the value may show uninitialized data.
102 if (is_erestart(tcp)) {
103 temporarily_clear_syserror(tcp);
104 print_timespec(tcp, tcp->u_arg[1]);
105 restore_cleared_syserror(tcp);
107 printaddr(tcp->u_arg[1]);
113 #include "xlat/itimer_which.h"
118 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
121 print_itimerval(tcp, tcp->u_arg[1]);
127 SYS_FUNC(osf_getitimer)
130 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
133 print_itimerval32(tcp, tcp->u_arg[1]);
142 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
144 print_itimerval(tcp, tcp->u_arg[1]);
147 print_itimerval(tcp, tcp->u_arg[2]);
153 SYS_FUNC(osf_setitimer)
156 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
158 print_itimerval32(tcp, tcp->u_arg[1]);
161 print_itimerval32(tcp, tcp->u_arg[2]);
167 #include "xlat/adjtimex_state.h"
170 do_adjtimex(struct tcb *tcp, long addr)
172 if (print_timex(tcp, addr))
174 tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
183 return do_adjtimex(tcp, tcp->u_arg[0]);
187 #include "xlat/clockflags.h"
188 #include "xlat/clocknames.h"
191 printclockname(int clockid)
194 # include "xlat/cpuclocknames.h"
197 if ((clockid & CLOCKFD_MASK) == CLOCKFD)
198 tprintf("FD_TO_CLOCKID(%d)", CLOCKID_TO_FD(clockid));
200 if(CPUCLOCK_PERTHREAD(clockid))
201 tprintf("MAKE_THREAD_CPUCLOCK(%d,", CPUCLOCK_PID(clockid));
203 tprintf("MAKE_PROCESS_CPUCLOCK(%d,", CPUCLOCK_PID(clockid));
204 printxval(cpuclocknames, clockid & CLOCKFD_MASK, "CPUCLOCK_???");
210 printxval(clocknames, clockid, "CLOCK_???");
213 SYS_FUNC(clock_settime)
215 printclockname(tcp->u_arg[0]);
217 print_timespec(tcp, tcp->u_arg[1]);
222 SYS_FUNC(clock_gettime)
225 printclockname(tcp->u_arg[0]);
228 print_timespec(tcp, tcp->u_arg[1]);
233 SYS_FUNC(clock_nanosleep)
236 printclockname(tcp->u_arg[0]);
238 printflags(clockflags, tcp->u_arg[1], "TIMER_???");
240 print_timespec(tcp, tcp->u_arg[2]);
244 * Second (returned) timespec is only significant
245 * if syscall was interrupted and flags is not TIMER_ABSTIME.
247 if (!tcp->u_arg[1] && is_erestart(tcp)) {
248 temporarily_clear_syserror(tcp);
249 print_timespec(tcp, tcp->u_arg[3]);
250 restore_cleared_syserror(tcp);
252 printaddr(tcp->u_arg[3]);
258 SYS_FUNC(clock_adjtime)
261 return do_adjtimex(tcp, tcp->u_arg[1]);
262 printclockname(tcp->u_arg[0]);
267 SYS_FUNC(timer_create)
270 printclockname(tcp->u_arg[0]);
272 print_sigevent(tcp, tcp->u_arg[1]);
275 printnum_int(tcp, tcp->u_arg[2], "%d");
280 SYS_FUNC(timer_settime)
283 tprintf("%d, ", (int) tcp->u_arg[0]);
284 printflags(clockflags, tcp->u_arg[1], "TIMER_???");
286 print_itimerspec(tcp, tcp->u_arg[2]);
289 print_itimerspec(tcp, tcp->u_arg[3]);
294 SYS_FUNC(timer_gettime)
297 tprintf("%d, ", (int) tcp->u_arg[0]);
299 print_itimerspec(tcp, tcp->u_arg[1]);
304 #include "xlat/timerfdflags.h"
308 tprintf("%ld, ", tcp->u_arg[0]);
309 printclockname(tcp->u_arg[0]);
311 printflags(timerfdflags, tcp->u_arg[2], "TFD_???");
313 print_itimerspec(tcp, tcp->u_arg[3]);
315 return RVAL_DECODED | RVAL_FD;
318 SYS_FUNC(timerfd_create)
320 printclockname(tcp->u_arg[0]);
322 printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
324 return RVAL_DECODED | RVAL_FD;
327 SYS_FUNC(timerfd_settime)
329 printfd(tcp, tcp->u_arg[0]);
331 printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
333 print_itimerspec(tcp, tcp->u_arg[2]);
335 print_itimerspec(tcp, tcp->u_arg[3]);
340 SYS_FUNC(timerfd_gettime)
343 printfd(tcp, tcp->u_arg[0]);
346 print_itimerspec(tcp, tcp->u_arg[1]);