2015-07-04 11:56:21 +03:00
/*
* Copyright ( c ) 2004 Ulrich Drepper < drepper @ redhat . com >
2016-05-25 18:59:27 +03:00
* Copyright ( c ) 2004 - 2016 Dmitry V . Levin < ldv @ altlinux . org >
2015-07-04 11:56:21 +03:00
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions
* are met :
* 1. Redistributions of source code must retain the above copyright
* notice , this list of conditions and the following disclaimer .
* 2. Redistributions in binary form must reproduce the above copyright
* notice , this list of conditions and the following disclaimer in the
* documentation and / or other materials provided with the distribution .
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` ` AS IS ' ' AND ANY EXPRESS OR
* IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED .
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT , INDIRECT ,
* INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT
* NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE ,
* DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
* ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
*/
# include "defs.h"
2016-05-25 18:59:27 +03:00
# include DEF_MPERS_TYPE(struct_rtc_pll_info)
2015-07-04 11:56:21 +03:00
# include <linux/ioctl.h>
# include <linux/rtc.h>
2016-05-25 18:59:27 +03:00
typedef struct rtc_pll_info struct_rtc_pll_info ;
# include MPERS_DEFS
2015-07-04 11:56:21 +03:00
static void
2015-07-04 15:07:35 +03:00
print_rtc_time ( struct tcb * tcp , const struct rtc_time * rt )
2015-07-04 11:56:21 +03:00
{
tprintf ( " {tm_sec=%d, tm_min=%d, tm_hour=%d, "
" tm_mday=%d, tm_mon=%d, tm_year=%d, " ,
rt - > tm_sec , rt - > tm_min , rt - > tm_hour ,
rt - > tm_mday , rt - > tm_mon , rt - > tm_year ) ;
if ( ! abbrev ( tcp ) )
tprintf ( " tm_wday=%d, tm_yday=%d, tm_isdst=%d} " ,
rt - > tm_wday , rt - > tm_yday , rt - > tm_isdst ) ;
else
tprints ( " ...} " ) ;
}
2015-07-04 15:07:35 +03:00
static void
2016-12-26 13:26:03 +03:00
decode_rtc_time ( struct tcb * const tcp , const kernel_ulong_t addr )
2015-07-04 15:07:35 +03:00
{
struct rtc_time rt ;
if ( ! umove_or_printaddr ( tcp , addr , & rt ) )
print_rtc_time ( tcp , & rt ) ;
}
static void
2016-12-26 13:26:03 +03:00
decode_rtc_wkalrm ( struct tcb * const tcp , const kernel_ulong_t addr )
2015-07-04 15:07:35 +03:00
{
struct rtc_wkalrm wk ;
if ( ! umove_or_printaddr ( tcp , addr , & wk ) ) {
2016-05-25 18:28:23 +03:00
tprintf ( " {enabled=%d, pending=%d, time= " , wk . enabled , wk . pending ) ;
2015-07-04 15:07:35 +03:00
print_rtc_time ( tcp , & wk . time ) ;
tprints ( " } " ) ;
}
}
2016-05-25 10:43:15 +03:00
static void
2016-12-26 13:26:03 +03:00
decode_rtc_pll_info ( struct tcb * const tcp , const kernel_ulong_t addr )
2016-05-25 10:43:15 +03:00
{
2016-05-25 18:59:27 +03:00
struct_rtc_pll_info pll ;
2016-05-25 10:43:15 +03:00
if ( ! umove_or_printaddr ( tcp , addr , & pll ) )
tprintf ( " {pll_ctrl=%d, pll_value=%d, pll_max=%d, pll_min=%d "
" , pll_posmult=%d, pll_negmult=%d, pll_clock=%ld} " ,
pll . pll_ctrl , pll . pll_value , pll . pll_max , pll . pll_min ,
2016-05-25 18:59:27 +03:00
pll . pll_posmult , pll . pll_negmult , ( long ) pll . pll_clock ) ;
2016-05-25 10:43:15 +03:00
}
2016-12-21 16:23:35 +03:00
MPERS_PRINTER_DECL ( int , rtc_ioctl , struct tcb * const tcp ,
2016-12-26 13:26:03 +03:00
const unsigned int code , const kernel_ulong_t arg )
2015-07-04 11:56:21 +03:00
{
switch ( code ) {
case RTC_ALM_READ :
case RTC_RD_TIME :
2015-07-04 15:07:35 +03:00
if ( entering ( tcp ) )
return 0 ;
2016-05-25 10:37:44 +03:00
/* fall through */
case RTC_ALM_SET :
case RTC_SET_TIME :
tprints ( " , " ) ;
2015-07-04 15:07:35 +03:00
decode_rtc_time ( tcp , arg ) ;
2015-07-04 11:56:21 +03:00
break ;
case RTC_IRQP_SET :
case RTC_EPOCH_SET :
2016-12-26 13:16:35 +03:00
tprintf ( " , % " PRI_klu , arg ) ;
2015-07-04 11:56:21 +03:00
break ;
case RTC_IRQP_READ :
case RTC_EPOCH_READ :
2015-07-04 15:07:35 +03:00
if ( entering ( tcp ) )
return 0 ;
tprints ( " , " ) ;
Fix printing tracee's long integers
Replace ambiguous printnum_long that used to fetch native long integers
from tracee's memory with printnum_ptr, printnum_slong, and printnum_ulong
that fetch tracee's pointer, signed long, and unsigned long integers.
* defs.h (printnum_long, printpair_long): Remove prototypes.
(printnum_int64, printpair_int64): Remove macros, declare functions
unconditionally.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
New prototype.
(printnum_ptr, printnum_slong, printnum_ulong): New macros.
* aio.c (sys_io_setup): Use printnum_ulong.
* block.c (block_ioctl): Use printnum_slong and printnum_ulong.
* get_robust_list.c (sys_get_robust_list): Use printnum_ptr
and printnum_ulong.
* io.c (print_off_t): Remove.
(sys_sendfile): Use printnum_ulong.
* ipc.c (sys_semctl): Use printnum_ptr.
* prctl.c (sys_prctl): Likewise.
* process.c (sys_ptrace): Likewise.
* rtc.c (rtc_ioctl): Use printnum_ulong.
* util.c (printnum_long, printpair_long): Remove.
(printnum_int64, printpair_int64): Define unconditionally.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
New function.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Elvira Khabirova <lineprinter0@gmail.com>
2015-08-18 17:58:27 +03:00
printnum_ulong ( tcp , arg ) ;
2015-07-04 11:56:21 +03:00
break ;
case RTC_WKALM_RD :
2015-07-04 15:07:35 +03:00
if ( entering ( tcp ) )
return 0 ;
2016-05-25 10:37:44 +03:00
/* fall through */
case RTC_WKALM_SET :
tprints ( " , " ) ;
2015-07-04 15:07:35 +03:00
decode_rtc_wkalrm ( tcp , arg ) ;
break ;
2016-05-25 10:43:15 +03:00
case RTC_PLL_GET :
if ( entering ( tcp ) )
return 0 ;
/* fall through */
case RTC_PLL_SET :
tprints ( " , " ) ;
decode_rtc_pll_info ( tcp , arg ) ;
break ;
2015-07-04 15:07:35 +03:00
# ifdef RTC_VL_READ
case RTC_VL_READ :
if ( entering ( tcp ) )
return 0 ;
tprints ( " , " ) ;
printnum_int ( tcp , arg , " %d " ) ;
2015-07-04 11:56:21 +03:00
break ;
2015-07-04 15:07:35 +03:00
# endif
2016-05-25 10:44:19 +03:00
case RTC_AIE_ON :
case RTC_AIE_OFF :
case RTC_UIE_ON :
case RTC_UIE_OFF :
case RTC_PIE_ON :
case RTC_PIE_OFF :
case RTC_WIE_ON :
case RTC_WIE_OFF :
# ifdef RTC_VL_CLR
case RTC_VL_CLR :
# endif
/* no args */
break ;
2015-07-04 11:56:21 +03:00
default :
2015-07-04 15:07:35 +03:00
return RVAL_DECODED ;
2015-07-04 11:56:21 +03:00
}
2015-07-04 15:07:35 +03:00
return RVAL_DECODED | 1 ;
2015-07-04 11:56:21 +03:00
}