Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

print_timex.c 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  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>
  5. * Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
  6. * Copyright (c) 2015-2018 The strace developers.
  7. * All rights reserved.
  8. *
  9. * SPDX-License-Identifier: LGPL-2.1-or-later
  10. */
  11. #include "defs.h"
  12. #include DEF_MPERS_TYPE(struct_timex)
  13. #include <sys/timex.h>
  14. typedef struct timex struct_timex;
  15. #include MPERS_DEFS
  16. #include "xlat/adjtimex_modes.h"
  17. #include "xlat/adjtimex_status.h"
  18. MPERS_PRINTER_DECL(int, print_timex,
  19. struct tcb *const tcp, const kernel_ulong_t addr)
  20. {
  21. struct_timex tx;
  22. if (umove_or_printaddr(tcp, addr, &tx))
  23. return -1;
  24. tprints("{modes=");
  25. printflags(adjtimex_modes, tx.modes, "ADJ_???");
  26. tprintf(", offset=%jd, freq=%jd, maxerror=%ju, esterror=%ju, status=",
  27. (intmax_t) tx.offset, (intmax_t) tx.freq,
  28. (uintmax_t) tx.maxerror, (uintmax_t) tx.esterror);
  29. printflags(adjtimex_status, tx.status, "STA_???");
  30. tprintf(", constant=%jd, precision=%ju, tolerance=%jd, time=",
  31. (intmax_t) tx.constant, (uintmax_t) tx.precision,
  32. (intmax_t) tx.tolerance);
  33. MPERS_FUNC_NAME(print_struct_timeval)(&tx.time);
  34. tprintf(", tick=%jd, ppsfreq=%jd, jitter=%jd",
  35. (intmax_t) tx.tick, (intmax_t) tx.ppsfreq, (intmax_t) tx.jitter);
  36. tprintf(", shift=%d, stabil=%jd, jitcnt=%jd",
  37. tx.shift, (intmax_t) tx.stabil, (intmax_t) tx.jitcnt);
  38. tprintf(", calcnt=%jd, errcnt=%jd, stbcnt=%jd",
  39. (intmax_t) tx.calcnt, (intmax_t) tx.errcnt, (intmax_t) tx.stbcnt);
  40. #ifdef HAVE_STRUCT_TIMEX_TAI
  41. tprintf(", tai=%d", tx.tai);
  42. #endif
  43. tprints("}");
  44. return 0;
  45. }