2 * Copyright (c) 2004 Ulrich Drepper <drepper@redhat.com>
3 * Copyright (c) 2004-2016 Dmitry V. Levin <ldv@altlinux.org>
4 * Copyright (c) 2015-2018 The strace developers.
7 * SPDX-License-Identifier: LGPL-2.1-or-later
12 #include DEF_MPERS_TYPE(struct_rtc_pll_info)
14 #include <linux/ioctl.h>
15 #include <linux/rtc.h>
17 typedef struct rtc_pll_info struct_rtc_pll_info;
22 print_rtc_time(struct tcb *tcp, const struct rtc_time *rt)
24 tprintf("{tm_sec=%d, tm_min=%d, tm_hour=%d, "
25 "tm_mday=%d, tm_mon=%d, tm_year=%d, ",
26 rt->tm_sec, rt->tm_min, rt->tm_hour,
27 rt->tm_mday, rt->tm_mon, rt->tm_year);
29 tprintf("tm_wday=%d, tm_yday=%d, tm_isdst=%d}",
30 rt->tm_wday, rt->tm_yday, rt->tm_isdst);
36 decode_rtc_time(struct tcb *const tcp, const kernel_ulong_t addr)
40 if (!umove_or_printaddr(tcp, addr, &rt))
41 print_rtc_time(tcp, &rt);
45 decode_rtc_wkalrm(struct tcb *const tcp, const kernel_ulong_t addr)
49 if (!umove_or_printaddr(tcp, addr, &wk)) {
50 tprintf("{enabled=%d, pending=%d, time=", wk.enabled, wk.pending);
51 print_rtc_time(tcp, &wk.time);
57 decode_rtc_pll_info(struct tcb *const tcp, const kernel_ulong_t addr)
59 struct_rtc_pll_info pll;
61 if (!umove_or_printaddr(tcp, addr, &pll))
62 tprintf("{pll_ctrl=%d, pll_value=%d, pll_max=%d, pll_min=%d"
63 ", pll_posmult=%d, pll_negmult=%d, pll_clock=%ld}",
64 pll.pll_ctrl, pll.pll_value, pll.pll_max, pll.pll_min,
65 pll.pll_posmult, pll.pll_negmult, (long) pll.pll_clock);
68 MPERS_PRINTER_DECL(int, rtc_ioctl, struct tcb *const tcp,
69 const unsigned int code, const kernel_ulong_t arg)
76 ATTRIBUTE_FALLTHROUGH;
80 decode_rtc_time(tcp, arg);
84 tprintf(", %" PRI_klu, arg);
91 printnum_ulong(tcp, arg);
96 ATTRIBUTE_FALLTHROUGH;
99 decode_rtc_wkalrm(tcp, arg);
104 ATTRIBUTE_FALLTHROUGH;
107 decode_rtc_pll_info(tcp, arg);
114 printnum_int(tcp, arg, "%d");
134 return RVAL_IOCTL_DECODED;