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 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 struct xlat clockflags[] = {
363 { TIMER_ABSTIME, "TIMER_ABSTIME" },
368 sys_clock_settime(tcp)
372 tprintf("%#lx, ", tcp->u_arg[0]);
373 printtv(tcp, tcp->u_arg[1]);
379 sys_clock_gettime(tcp)
383 tprintf("%#lx, ", tcp->u_arg[0]);
386 tprintf("%#lx", tcp->u_arg[1]);
388 printtv(tcp, tcp->u_arg[1]);
394 sys_clock_nanosleep(tcp)
398 tprintf("%#lx, ", tcp->u_arg[0]);
399 printflags(clockflags, tcp->u_arg[1]);
401 printtv(tcp, tcp->u_arg[2]);
405 tprintf("%#lx", tcp->u_arg[3]);
407 printtv(tcp, tcp->u_arg[3]);
412 #ifndef SIGEV_THREAD_ID
413 # define SIGEV_THREAD_ID 4
415 static struct xlat sigev_value[] = {
416 { SIGEV_SIGNAL+1, "SIGEV_SIGNAL" },
417 { SIGEV_NONE+1, "SIGEV_NONE" },
418 { SIGEV_THREAD+1, "SIGEV_THREAD" },
419 { SIGEV_THREAD_ID+1, "SIGEV_THREAD_ID" },
424 printsigevent(tcp, arg)
429 if (umove (tcp, arg, &sev) < 0)
432 tprintf("{%p, %u, ", sev.sigev_value.sival_ptr,
434 printxval(sigev_value, sev.sigev_notify+1, "SIGEV_???");
436 if (sev.sigev_notify == SIGEV_THREAD_ID)
437 /* _pad[0] is the _tid field which might not be
438 present in the userlevel definition of the
440 tprintf("{%d}", sev._sigev_un._pad[0]);
448 sys_timer_create(tcp)
452 tprintf("%#lx, ", tcp->u_arg[0]);
453 printsigevent(tcp, tcp->u_arg[1]);
457 tprintf("%#lx", tcp->u_arg[2]);
460 umove(tcp, tcp->u_arg[2], &p);
468 sys_timer_settime(tcp)
472 tprintf("%#lx, ", tcp->u_arg[0]);
473 printflags(clockflags, tcp->u_arg[1]);
475 printitv(tcp, tcp->u_arg[2]);
479 tprintf("%#lx", tcp->u_arg[3]);
481 printitv(tcp, tcp->u_arg[3]);
487 sys_timer_gettime(tcp)
491 tprintf("%#lx, ", tcp->u_arg[0]);
494 tprintf("%#lx", tcp->u_arg[1]);
496 printitv(tcp, tcp->u_arg[1]);