2 * Copyright (c) 2004 Ulrich Drepper <drepper@redhat.com>
3 * Copyright (c) 2004-2016 Dmitry V. Levin <ldv@altlinux.org>
4 * Copyright (c) 2015-2017 The strace developers.
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.
32 #include DEF_MPERS_TYPE(struct_rtc_pll_info)
34 #include <linux/ioctl.h>
35 #include <linux/rtc.h>
37 typedef struct rtc_pll_info struct_rtc_pll_info;
42 print_rtc_time(struct tcb *tcp, const struct rtc_time *rt)
44 tprintf("{tm_sec=%d, tm_min=%d, tm_hour=%d, "
45 "tm_mday=%d, tm_mon=%d, tm_year=%d, ",
46 rt->tm_sec, rt->tm_min, rt->tm_hour,
47 rt->tm_mday, rt->tm_mon, rt->tm_year);
49 tprintf("tm_wday=%d, tm_yday=%d, tm_isdst=%d}",
50 rt->tm_wday, rt->tm_yday, rt->tm_isdst);
56 decode_rtc_time(struct tcb *const tcp, const kernel_ulong_t addr)
60 if (!umove_or_printaddr(tcp, addr, &rt))
61 print_rtc_time(tcp, &rt);
65 decode_rtc_wkalrm(struct tcb *const tcp, const kernel_ulong_t addr)
69 if (!umove_or_printaddr(tcp, addr, &wk)) {
70 tprintf("{enabled=%d, pending=%d, time=", wk.enabled, wk.pending);
71 print_rtc_time(tcp, &wk.time);
77 decode_rtc_pll_info(struct tcb *const tcp, const kernel_ulong_t addr)
79 struct_rtc_pll_info pll;
81 if (!umove_or_printaddr(tcp, addr, &pll))
82 tprintf("{pll_ctrl=%d, pll_value=%d, pll_max=%d, pll_min=%d"
83 ", pll_posmult=%d, pll_negmult=%d, pll_clock=%ld}",
84 pll.pll_ctrl, pll.pll_value, pll.pll_max, pll.pll_min,
85 pll.pll_posmult, pll.pll_negmult, (long) pll.pll_clock);
88 MPERS_PRINTER_DECL(int, rtc_ioctl, struct tcb *const tcp,
89 const unsigned int code, const kernel_ulong_t arg)
100 decode_rtc_time(tcp, arg);
104 tprintf(", %" PRI_klu, arg);
111 printnum_ulong(tcp, arg);
119 decode_rtc_wkalrm(tcp, arg);
127 decode_rtc_pll_info(tcp, arg);
134 printnum_int(tcp, arg, "%d");
154 return RVAL_IOCTL_DECODED;