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.
35 #include <linux/version.h>
36 #include <sys/timex.h>
48 else if (!verbose(tcp))
49 tprintf("%#lx", addr);
50 else if (umove(tcp, addr, &tv) < 0)
53 tprintf("{%lu, %lu}", (long) tv.tv_sec, (long) tv.tv_usec);
72 else if (!verbose(tcp))
73 tprintf("%#lx", addr);
74 else if (umove(tcp, addr, &tv) < 0)
77 tprintf("{%u, %u}", tv.tv_sec, tv.tv_usec);
88 printnum(tcp, tcp->u_arg[0], "%ld");
99 printnum(tcp, tcp->u_arg[0], "%ld");
105 sys_gettimeofday(tcp)
110 tprintf("%#lx, %#lx",
111 tcp->u_arg[0], tcp->u_arg[1]);
114 printtv(tcp, tcp->u_arg[0]);
117 printtv(tcp, tcp->u_arg[1]);
126 sys_osf_gettimeofday(tcp)
131 tprintf("%#lx, %#lx",
132 tcp->u_arg[0], tcp->u_arg[1]);
135 printtv32(tcp, tcp->u_arg[0]);
138 printtv32(tcp, tcp->u_arg[1]);
146 sys_settimeofday(tcp)
150 printtv(tcp, tcp->u_arg[0]);
153 printtv(tcp, tcp->u_arg[1]);
161 sys_osf_settimeofday(tcp)
165 printtv32(tcp, tcp->u_arg[0]);
168 printtv32(tcp, tcp->u_arg[1]);
180 printtv(tcp, tcp->u_arg[0]);
184 tprintf("%#lx", tcp->u_arg[1]);
186 printtv(tcp, tcp->u_arg[1]);
191 static const struct xlat which[] = {
192 { ITIMER_REAL, "ITIMER_REAL" },
193 { ITIMER_VIRTUAL,"ITIMER_VIRTUAL"},
194 { ITIMER_PROF, "ITIMER_PROF" },
203 struct itimerval itv;
207 else if (!verbose(tcp))
208 tprintf("%#lx", addr);
209 else if (umove(tcp, addr, &itv) < 0)
212 tprintf("{it_interval={%lu, %lu}, it_value={%lu, %lu}}",
213 (long) itv.it_interval.tv_sec, (long) itv.it_interval.tv_usec,
214 (long) itv.it_value.tv_sec, (long) itv.it_value.tv_usec);
221 printitv32(tcp, addr)
227 struct timeval32 it_interval;
228 struct timeval32 it_value;
233 else if (!verbose(tcp))
234 tprintf("%#lx", addr);
235 else if (umove(tcp, addr, &itv) < 0)
238 tprintf("{it_interval={%u, %u}, it_value={%u, %u}}",
239 itv.it_interval.tv_sec, itv.it_interval.tv_usec,
240 itv.it_value.tv_sec, itv.it_value.tv_usec);
250 printxval(which, tcp->u_arg[0], "ITIMER_???");
254 tprintf("%#lx", tcp->u_arg[1]);
256 printitv(tcp, tcp->u_arg[1]);
264 sys_osf_getitimer(tcp)
268 printxval(which, tcp->u_arg[0], "ITIMER_???");
272 tprintf("%#lx", tcp->u_arg[1]);
274 printitv32(tcp, tcp->u_arg[1]);
285 printxval(which, tcp->u_arg[0], "ITIMER_???");
287 printitv(tcp, tcp->u_arg[1]);
291 tprintf("%#lx", tcp->u_arg[2]);
293 printitv(tcp, tcp->u_arg[2]);
300 sys_osf_setitimer(tcp)
304 printxval(which, tcp->u_arg[0], "ITIMER_???");
306 printitv32(tcp, tcp->u_arg[1]);
310 tprintf("%#lx", tcp->u_arg[2]);
312 printitv32(tcp, tcp->u_arg[2]);
327 if (tcp->u_arg[0] == 0)
329 else if (syserror(tcp) || !verbose(tcp))
330 tprintf("%#lx", tcp->u_arg[0]);
331 else if (umove(tcp, tcp->u_arg[0], &txc) < 0)
334 #if LINUX_VERSION_CODE < 66332
335 tprintf("{mode=%d, offset=%ld, frequency=%ld, ",
336 txc.mode, txc.offset, txc.frequency);
337 tprintf("maxerror=%ld, esterror=%lu, status=%u, ",
338 txc.maxerror, txc.esterror, txc.status);
339 tprintf("time_constant=%ld, precision=%lu, ",
340 txc.time_constant, txc.precision);
341 tprintf("tolerance=%ld, time={%lu, %lu}}",
342 txc.tolerance, (long) txc.time.tv_sec,
343 (long) txc.time.tv_usec);
345 tprintf("{modes=%d, offset=%ld, freq=%ld, ",
346 txc.modes, txc.offset, txc.freq);
347 tprintf("maxerror=%ld, esterror=%lu, status=%u, ",
348 txc.maxerror, txc.esterror, txc.status);
349 tprintf("constant=%ld, precision=%lu, ",
350 txc.constant, txc.precision);
351 tprintf("tolerance=%ld, time={%lu, %lu}}",
352 txc.tolerance, (long) txc.time.tv_sec,
353 (long) txc.time.tv_usec);
354 /* there's a bunch of other stuff, but it's not
355 * worth the time or the trouble to include */
362 static const struct xlat clockflags[] = {
363 { TIMER_ABSTIME, "TIMER_ABSTIME" },
367 static const struct xlat clocknames[] = {
368 #ifdef CLOCK_REALTIME
369 { CLOCK_REALTIME, "CLOCK_REALTIME" },
371 #ifdef CLOCK_MONOTONIC
372 { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" },
378 sys_clock_settime(tcp)
382 printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
384 printtv(tcp, tcp->u_arg[1]);
390 sys_clock_gettime(tcp)
394 printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
398 tprintf("%#lx", tcp->u_arg[1]);
400 printtv(tcp, tcp->u_arg[1]);
406 sys_clock_nanosleep(tcp)
410 printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
412 printflags(clockflags, tcp->u_arg[1]);
414 printtv(tcp, tcp->u_arg[2]);
418 tprintf("%#lx", tcp->u_arg[3]);
420 printtv(tcp, tcp->u_arg[3]);
425 #ifndef SIGEV_THREAD_ID
426 # define SIGEV_THREAD_ID 4
428 static const struct xlat sigev_value[] = {
429 { SIGEV_SIGNAL+1, "SIGEV_SIGNAL" },
430 { SIGEV_NONE+1, "SIGEV_NONE" },
431 { SIGEV_THREAD+1, "SIGEV_THREAD" },
432 { SIGEV_THREAD_ID+1, "SIGEV_THREAD_ID" },
437 printsigevent(tcp, arg)
442 if (umove (tcp, arg, &sev) < 0)
445 tprintf("{%p, %u, ", sev.sigev_value.sival_ptr,
447 printxval(sigev_value, sev.sigev_notify+1, "SIGEV_???");
449 if (sev.sigev_notify == SIGEV_THREAD_ID)
450 /* _pad[0] is the _tid field which might not be
451 present in the userlevel definition of the
453 tprintf("{%d}", sev._sigev_un._pad[0]);
454 else if (sev.sigev_notify == SIGEV_THREAD)
455 tprintf("{%p, %p}", sev.sigev_notify_function,
456 sev.sigev_notify_attributes);
464 sys_timer_create(tcp)
468 tprintf("%#lx, ", tcp->u_arg[0]);
469 printsigevent(tcp, tcp->u_arg[1]);
473 tprintf("%#lx", tcp->u_arg[2]);
476 umove(tcp, tcp->u_arg[2], &p);
484 sys_timer_settime(tcp)
488 tprintf("%#lx, ", tcp->u_arg[0]);
489 printflags(clockflags, tcp->u_arg[1]);
491 printitv(tcp, tcp->u_arg[2]);
495 tprintf("%#lx", tcp->u_arg[3]);
497 printitv(tcp, tcp->u_arg[3]);
503 sys_timer_gettime(tcp)
507 tprintf("%#lx, ", tcp->u_arg[0]);
510 tprintf("%#lx", tcp->u_arg[1]);
512 printitv(tcp, tcp->u_arg[1]);