1999-02-19 03:21:36 +03:00
/*
* Copyright ( c ) 1991 , 1992 Paul Kranenburg < pk @ cs . few . eur . nl >
* Copyright ( c ) 1993 Branko Lankester < branko @ hacktic . nl >
* Copyright ( c ) 1993 , 1994 , 1995 , 1996 Rick Sladkey < jrs @ world . std . com >
* 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"
2014-12-31 03:08:50 +03:00
# include <fcntl.h>
1999-02-19 03:21:36 +03:00
# include <linux/version.h>
2000-10-13 16:47:12 +04:00
# include <sys/timex.h>
2004-10-07 02:27:43 +04:00
# include <linux/ioctl.h>
# include <linux/rtc.h>
2007-07-24 05:57:11 +04:00
# ifndef UTIME_NOW
# define UTIME_NOW ((1l << 30) - 1l)
# endif
# ifndef UTIME_OMIT
# define UTIME_OMIT ((1l << 30) - 2l)
# endif
1999-02-19 03:21:36 +03:00
2006-12-13 20:10:11 +03:00
struct timeval32
1999-02-19 03:21:36 +03:00
{
2006-12-13 20:10:11 +03:00
u_int32_t tv_sec , tv_usec ;
} ;
1999-02-19 03:21:36 +03:00
2006-12-13 20:14:36 +03:00
static void
tprint_timeval32 ( struct tcb * tcp , const struct timeval32 * tv )
{
tprintf ( " {%u, %u} " , tv - > tv_sec , tv - > tv_usec ) ;
}
static void
tprint_timeval ( struct tcb * tcp , const struct timeval * tv )
{
tprintf ( " {%lu, %lu} " ,
( unsigned long ) tv - > tv_sec , ( unsigned long ) tv - > tv_usec ) ;
}
2006-12-13 20:10:11 +03:00
void
2007-07-24 05:57:11 +04:00
printtv_bitness ( struct tcb * tcp , long addr , enum bitness_t bitness , int special )
2006-12-13 20:10:11 +03:00
{
2012-01-20 14:04:04 +04:00
char buf [ TIMEVAL_TEXT_BUFSIZE ] ;
sprinttv ( buf , tcp , addr , bitness , special ) ;
tprints ( buf ) ;
2006-12-13 20:10:11 +03:00
}
1999-11-18 20:26:45 +03:00
2014-12-27 02:55:38 +03:00
static char *
do_sprinttv ( char * buf , const unsigned long sec , const unsigned long usec ,
const int special )
{
if ( special ) {
switch ( usec ) {
case UTIME_NOW :
return stpcpy ( buf , " UTIME_NOW " ) ;
case UTIME_OMIT :
return stpcpy ( buf , " UTIME_OMIT " ) ;
}
}
return buf + sprintf ( buf , " {%lu, %lu} " , sec , usec ) ;
}
2011-08-31 14:26:03 +04:00
char *
2012-01-20 14:04:04 +04:00
sprinttv ( char * buf , struct tcb * tcp , long addr , enum bitness_t bitness , int special )
1999-11-18 20:09:47 +03:00
{
2006-12-13 20:10:11 +03:00
if ( addr = = 0 )
2011-08-31 14:26:03 +04:00
return stpcpy ( buf , " NULL " ) ;
2006-12-13 20:10:11 +03:00
2011-09-01 13:40:40 +04:00
if ( ! verbose ( tcp ) )
return buf + sprintf ( buf , " %#lx " , addr ) ;
2011-08-31 14:26:03 +04:00
if ( bitness = = BITNESS_32
2012-02-25 05:38:52 +04:00
# if SUPPORTED_PERSONALITIES > 1
2012-03-19 12:36:42 +04:00
| | current_wordsize = = 4
1999-11-18 20:09:47 +03:00
# endif
2011-08-31 14:26:03 +04:00
)
{
struct timeval32 tv ;
2014-12-27 02:55:38 +03:00
if ( umove ( tcp , addr , & tv ) > = 0 )
return do_sprinttv ( buf , tv . tv_sec , tv . tv_usec , special ) ;
2011-08-31 14:26:03 +04:00
} else {
struct timeval tv ;
2014-12-27 02:55:38 +03:00
if ( umove ( tcp , addr , & tv ) > = 0 )
return do_sprinttv ( buf , tv . tv_sec , tv . tv_usec , special ) ;
2006-12-13 20:10:11 +03:00
}
2011-08-31 14:26:03 +04:00
2011-09-01 13:40:40 +04:00
return stpcpy ( buf , " {...} " ) ;
2006-12-13 20:10:11 +03:00
}
1999-11-18 20:09:47 +03:00
2012-01-20 14:04:04 +04:00
void
print_timespec ( struct tcb * tcp , long addr )
2007-11-02 00:50:54 +03:00
{
2012-01-20 14:04:04 +04:00
char buf [ TIMESPEC_TEXT_BUFSIZE ] ;
sprint_timespec ( buf , tcp , addr ) ;
tprints ( buf ) ;
2007-11-02 00:50:54 +03:00
}
2012-01-20 14:04:04 +04:00
void
sprint_timespec ( char * buf , struct tcb * tcp , long addr )
2007-11-02 00:50:54 +03:00
{
if ( addr = = 0 )
strcpy ( buf , " NULL " ) ;
else if ( ! verbose ( tcp ) )
sprintf ( buf , " %#lx " , addr ) ;
else {
2009-04-14 16:51:00 +04:00
int rc ;
2007-11-02 00:50:54 +03:00
2012-02-25 05:38:52 +04:00
# if SUPPORTED_PERSONALITIES > 1
2012-03-19 12:36:42 +04:00
if ( current_wordsize = = 4 ) {
2007-11-02 00:50:54 +03:00
struct timeval32 tv ;
2011-08-20 14:48:18 +04:00
rc = umove ( tcp , addr , & tv ) ;
if ( rc > = 0 )
2007-11-02 00:50:54 +03:00
sprintf ( buf , " {%u, %u} " ,
tv . tv_sec , tv . tv_usec ) ;
} else
# endif
2009-04-14 16:51:00 +04:00
{
2007-11-02 00:50:54 +03:00
struct timespec ts ;
2011-08-20 14:48:18 +04:00
rc = umove ( tcp , addr , & ts ) ;
if ( rc > = 0 )
2007-11-02 00:50:54 +03:00
sprintf ( buf , " {%lu, %lu} " ,
( unsigned long ) ts . tv_sec ,
( unsigned long ) ts . tv_nsec ) ;
}
if ( rc < 0 )
strcpy ( buf , " {...} " ) ;
}
}
1999-02-19 03:21:36 +03:00
int
2011-05-30 16:00:14 +04:00
sys_time ( struct tcb * tcp )
1999-02-19 03:21:36 +03:00
{
if ( exiting ( tcp ) ) {
printnum ( tcp , tcp - > u_arg [ 0 ] , " %ld " ) ;
}
return 0 ;
}
int
2011-05-30 16:00:14 +04:00
sys_gettimeofday ( struct tcb * tcp )
1999-02-19 03:21:36 +03:00
{
if ( exiting ( tcp ) ) {
if ( syserror ( tcp ) ) {
tprintf ( " %#lx, %#lx " ,
tcp - > u_arg [ 0 ] , tcp - > u_arg [ 1 ] ) ;
return 0 ;
}
printtv ( tcp , tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
1999-02-19 03:21:36 +03:00
printtv ( tcp , tcp - > u_arg [ 1 ] ) ;
}
return 0 ;
}
1999-11-18 20:09:47 +03:00
# ifdef ALPHA
int
2011-05-30 16:00:14 +04:00
sys_osf_gettimeofday ( struct tcb * tcp )
1999-11-18 20:09:47 +03:00
{
2009-04-14 16:51:00 +04:00
if ( exiting ( tcp ) ) {
if ( syserror ( tcp ) ) {
tprintf ( " %#lx, %#lx " , tcp - > u_arg [ 0 ] , tcp - > u_arg [ 1 ] ) ;
return 0 ;
}
printtv_bitness ( tcp , tcp - > u_arg [ 0 ] , BITNESS_32 , 0 ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2009-04-14 16:51:00 +04:00
printtv_bitness ( tcp , tcp - > u_arg [ 1 ] , BITNESS_32 , 0 ) ;
}
return 0 ;
1999-11-18 20:09:47 +03:00
}
# endif
1999-02-19 03:21:36 +03:00
int
2011-05-30 16:00:14 +04:00
sys_settimeofday ( struct tcb * tcp )
1999-02-19 03:21:36 +03:00
{
if ( entering ( tcp ) ) {
printtv ( tcp , tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
1999-02-19 03:21:36 +03:00
printtv ( tcp , tcp - > u_arg [ 1 ] ) ;
}
return 0 ;
}
1999-11-18 20:09:47 +03:00
# ifdef ALPHA
int
2011-05-30 16:00:14 +04:00
sys_osf_settimeofday ( struct tcb * tcp )
1999-11-18 20:09:47 +03:00
{
2009-04-14 16:51:00 +04:00
if ( entering ( tcp ) ) {
printtv_bitness ( tcp , tcp - > u_arg [ 0 ] , BITNESS_32 , 0 ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2009-04-14 16:51:00 +04:00
printtv_bitness ( tcp , tcp - > u_arg [ 1 ] , BITNESS_32 , 0 ) ;
}
return 0 ;
1999-11-18 20:09:47 +03:00
}
# endif
1999-02-19 03:21:36 +03:00
int
2011-05-30 16:00:14 +04:00
sys_adjtime ( struct tcb * tcp )
1999-02-19 03:21:36 +03:00
{
if ( entering ( tcp ) ) {
printtv ( tcp , tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
1999-02-19 03:21:36 +03:00
} else {
if ( syserror ( tcp ) )
tprintf ( " %#lx " , tcp - > u_arg [ 1 ] ) ;
else
printtv ( tcp , tcp - > u_arg [ 1 ] ) ;
}
return 0 ;
}
2008-09-03 05:02:46 +04:00
int
sys_nanosleep ( struct tcb * tcp )
{
if ( entering ( tcp ) ) {
print_timespec ( tcp , tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2008-09-03 05:02:46 +04:00
} else {
2012-01-28 05:29:36 +04:00
/* Second (returned) timespec is only significant
2013-07-01 01:53:49 +04:00
* if syscall was interrupted . On success , we print
* only its address , since kernel doesn ' t modify it ,
* and printing the value may show uninitialized data .
2012-01-28 05:29:36 +04:00
*/
2013-07-01 01:53:49 +04:00
switch ( tcp - > u_error ) {
default :
/* Not interrupted (slept entire interval) */
if ( tcp - > u_arg [ 1 ] ) {
tprintf ( " %#lx " , tcp - > u_arg [ 1 ] ) ;
break ;
}
/* Fall through: print_timespec(NULL) prints "NULL" */
case ERESTARTSYS :
case ERESTARTNOINTR :
case ERESTARTNOHAND :
case ERESTART_RESTARTBLOCK :
/* Interrupted */
2008-09-03 05:02:46 +04:00
print_timespec ( tcp , tcp - > u_arg [ 1 ] ) ;
2013-07-01 01:53:49 +04:00
}
2008-09-03 05:02:46 +04:00
}
return 0 ;
}
2014-04-26 03:30:54 +04:00
# include "xlat/itimer_which.h"
1999-02-19 03:21:36 +03:00
static void
2006-12-13 20:14:36 +03:00
printitv_bitness ( struct tcb * tcp , long addr , enum bitness_t bitness )
1999-02-19 03:21:36 +03:00
{
if ( addr = = 0 )
2011-09-01 12:00:28 +04:00
tprints ( " NULL " ) ;
1999-02-19 03:21:36 +03:00
else if ( ! verbose ( tcp ) )
tprintf ( " %#lx " , addr ) ;
2009-04-14 16:51:00 +04:00
else {
int rc ;
1999-02-19 03:21:36 +03:00
2006-12-13 20:14:36 +03:00
if ( bitness = = BITNESS_32
2012-02-25 05:38:52 +04:00
# if SUPPORTED_PERSONALITIES > 1
2012-03-19 12:36:42 +04:00
| | current_wordsize = = 4
2006-12-13 20:14:36 +03:00
# endif
)
{
2009-04-14 16:51:00 +04:00
struct {
2006-12-13 20:14:36 +03:00
struct timeval32 it_interval , it_value ;
} itv ;
2011-08-20 14:48:18 +04:00
rc = umove ( tcp , addr , & itv ) ;
if ( rc > = 0 ) {
2011-09-01 12:00:28 +04:00
tprints ( " {it_interval= " ) ;
2006-12-13 20:14:36 +03:00
tprint_timeval32 ( tcp , & itv . it_interval ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , it_value= " ) ;
2006-12-13 20:14:36 +03:00
tprint_timeval32 ( tcp , & itv . it_value ) ;
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
2007-08-02 05:25:34 +04:00
}
2009-04-14 16:51:00 +04:00
} else {
2006-12-13 20:14:36 +03:00
struct itimerval itv ;
2011-08-20 14:48:18 +04:00
rc = umove ( tcp , addr , & itv ) ;
if ( rc > = 0 ) {
2011-09-01 12:00:28 +04:00
tprints ( " {it_interval= " ) ;
2006-12-13 20:14:36 +03:00
tprint_timeval ( tcp , & itv . it_interval ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , it_value= " ) ;
2006-12-13 20:14:36 +03:00
tprint_timeval ( tcp , & itv . it_value ) ;
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
2007-08-02 05:25:34 +04:00
}
2006-12-13 20:14:36 +03:00
}
if ( rc < 0 )
2011-09-01 12:00:28 +04:00
tprints ( " {...} " ) ;
2006-12-13 20:14:36 +03:00
}
1999-11-18 20:09:47 +03:00
}
2006-12-13 20:14:36 +03:00
# define printitv(tcp, addr) \
printitv_bitness ( ( tcp ) , ( addr ) , BITNESS_CURRENT )
1999-11-18 20:09:47 +03:00
1999-02-19 03:21:36 +03:00
int
2011-05-30 16:00:14 +04:00
sys_getitimer ( struct tcb * tcp )
1999-02-19 03:21:36 +03:00
{
if ( entering ( tcp ) ) {
2014-04-26 03:39:20 +04:00
printxval ( itimer_which , tcp - > u_arg [ 0 ] , " ITIMER_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
1999-02-19 03:21:36 +03:00
} else {
if ( syserror ( tcp ) )
tprintf ( " %#lx " , tcp - > u_arg [ 1 ] ) ;
else
printitv ( tcp , tcp - > u_arg [ 1 ] ) ;
}
return 0 ;
}
1999-11-18 20:09:47 +03:00
# ifdef ALPHA
int
2011-05-30 16:00:14 +04:00
sys_osf_getitimer ( struct tcb * tcp )
1999-11-18 20:09:47 +03:00
{
2009-04-14 16:51:00 +04:00
if ( entering ( tcp ) ) {
2014-04-26 03:39:20 +04:00
printxval ( itimer_which , tcp - > u_arg [ 0 ] , " ITIMER_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2009-04-14 16:51:00 +04:00
} else {
if ( syserror ( tcp ) )
tprintf ( " %#lx " , tcp - > u_arg [ 1 ] ) ;
else
printitv_bitness ( tcp , tcp - > u_arg [ 1 ] , BITNESS_32 ) ;
}
return 0 ;
1999-11-18 20:09:47 +03:00
}
# endif
1999-02-19 03:21:36 +03:00
int
2011-05-30 16:00:14 +04:00
sys_setitimer ( struct tcb * tcp )
1999-02-19 03:21:36 +03:00
{
if ( entering ( tcp ) ) {
2014-04-26 03:39:20 +04:00
printxval ( itimer_which , tcp - > u_arg [ 0 ] , " ITIMER_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
1999-02-19 03:21:36 +03:00
printitv ( tcp , tcp - > u_arg [ 1 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
1999-02-19 03:21:36 +03:00
} else {
if ( syserror ( tcp ) )
tprintf ( " %#lx " , tcp - > u_arg [ 2 ] ) ;
else
printitv ( tcp , tcp - > u_arg [ 2 ] ) ;
}
return 0 ;
}
1999-11-18 20:09:47 +03:00
# ifdef ALPHA
int
2011-05-30 16:00:14 +04:00
sys_osf_setitimer ( struct tcb * tcp )
1999-11-18 20:09:47 +03:00
{
2009-04-14 16:51:00 +04:00
if ( entering ( tcp ) ) {
2014-04-26 03:39:20 +04:00
printxval ( itimer_which , tcp - > u_arg [ 0 ] , " ITIMER_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2009-04-14 16:51:00 +04:00
printitv_bitness ( tcp , tcp - > u_arg [ 1 ] , BITNESS_32 ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2009-04-14 16:51:00 +04:00
} else {
if ( syserror ( tcp ) )
tprintf ( " %#lx " , tcp - > u_arg [ 2 ] ) ;
else
printitv_bitness ( tcp , tcp - > u_arg [ 2 ] , BITNESS_32 ) ;
}
return 0 ;
1999-11-18 20:09:47 +03:00
}
# endif
2014-04-26 03:30:54 +04:00
# include "xlat/adjtimex_modes.h"
# include "xlat/adjtimex_status.h"
# include "xlat/adjtimex_state.h"
2006-12-13 20:42:32 +03:00
2006-12-13 20:43:45 +03:00
# if SUPPORTED_PERSONALITIES > 1
static int
tprint_timex32 ( struct tcb * tcp , long addr )
{
2009-04-14 16:51:00 +04:00
struct {
2006-12-13 20:43:45 +03:00
unsigned int modes ;
int offset ;
int freq ;
int maxerror ;
int esterror ;
int status ;
int constant ;
int precision ;
int tolerance ;
struct timeval32 time ;
int tick ;
int ppsfreq ;
int jitter ;
int shift ;
int stabil ;
int jitcnt ;
int calcnt ;
int errcnt ;
int stbcnt ;
} tx ;
if ( umove ( tcp , addr , & tx ) < 0 )
return - 1 ;
2011-09-01 12:00:28 +04:00
tprints ( " {modes= " ) ;
2007-01-13 14:17:38 +03:00
printflags ( adjtimex_modes , tx . modes , " ADJ_??? " ) ;
2006-12-13 20:43:45 +03:00
tprintf ( " , offset=%d, freq=%d, maxerror=%d, " ,
tx . offset , tx . freq , tx . maxerror ) ;
tprintf ( " esterror=%u, status= " , tx . esterror ) ;
printflags ( adjtimex_status , tx . status , " STA_??? " ) ;
tprintf ( " , constant=%d, precision=%u, " ,
tx . constant , tx . precision ) ;
tprintf ( " tolerance=%d, time= " , tx . tolerance ) ;
tprint_timeval32 ( tcp , & tx . time ) ;
tprintf ( " , tick=%d, ppsfreq=%d, jitter=%d " ,
tx . tick , tx . ppsfreq , tx . jitter ) ;
tprintf ( " , shift=%d, stabil=%d, jitcnt=%d " ,
tx . shift , tx . stabil , tx . jitcnt ) ;
tprintf ( " , calcnt=%d, errcnt=%d, stbcnt=%d " ,
tx . calcnt , tx . errcnt , tx . stbcnt ) ;
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
2006-12-13 20:43:45 +03:00
return 0 ;
}
# endif /* SUPPORTED_PERSONALITIES > 1 */
static int
tprint_timex ( struct tcb * tcp , long addr )
1999-02-19 03:21:36 +03:00
{
2006-12-13 20:42:32 +03:00
struct timex tx ;
1999-02-19 03:21:36 +03:00
2006-12-13 20:43:45 +03:00
# if SUPPORTED_PERSONALITIES > 1
2012-03-19 12:36:42 +04:00
if ( current_wordsize = = 4 )
2006-12-13 20:43:45 +03:00
return tprint_timex32 ( tcp , addr ) ;
# endif
if ( umove ( tcp , addr , & tx ) < 0 )
return - 1 ;
# if LINUX_VERSION_CODE < 66332
tprintf ( " {mode=%d, offset=%ld, frequency=%ld, " ,
tx . mode , tx . offset , tx . frequency ) ;
tprintf ( " maxerror=%ld, esterror=%lu, status=%u, " ,
tx . maxerror , tx . esterror , tx . status ) ;
tprintf ( " time_constant=%ld, precision=%lu, " ,
tx . time_constant , tx . precision ) ;
tprintf ( " tolerance=%ld, time= " , tx . tolerance ) ;
tprint_timeval ( tcp , & tx . time ) ;
# else
2011-09-01 12:00:28 +04:00
tprints ( " {modes= " ) ;
2007-01-13 14:17:38 +03:00
printflags ( adjtimex_modes , tx . modes , " ADJ_??? " ) ;
2006-12-13 20:43:45 +03:00
tprintf ( " , offset=%ld, freq=%ld, maxerror=%ld, " ,
2012-02-03 22:16:03 +04:00
( long ) tx . offset , ( long ) tx . freq , ( long ) tx . maxerror ) ;
tprintf ( " esterror=%lu, status= " , ( long ) tx . esterror ) ;
2006-12-13 20:43:45 +03:00
printflags ( adjtimex_status , tx . status , " STA_??? " ) ;
tprintf ( " , constant=%ld, precision=%lu, " ,
2012-02-03 22:16:03 +04:00
( long ) tx . constant , ( long ) tx . precision ) ;
tprintf ( " tolerance=%ld, time= " , ( long ) tx . tolerance ) ;
2006-12-13 20:43:45 +03:00
tprint_timeval ( tcp , & tx . time ) ;
tprintf ( " , tick=%ld, ppsfreq=%ld, jitter=%ld " ,
2012-02-03 22:16:03 +04:00
( long ) tx . tick , ( long ) tx . ppsfreq , ( long ) tx . jitter ) ;
2006-12-13 20:43:45 +03:00
tprintf ( " , shift=%d, stabil=%ld, jitcnt=%ld " ,
2012-02-03 22:16:03 +04:00
tx . shift , ( long ) tx . stabil , ( long ) tx . jitcnt ) ;
2006-12-13 20:43:45 +03:00
tprintf ( " , calcnt=%ld, errcnt=%ld, stbcnt=%ld " ,
2012-02-03 22:16:03 +04:00
( long ) tx . calcnt , ( long ) tx . errcnt , ( long ) tx . stbcnt ) ;
2006-12-13 20:43:45 +03:00
# endif
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
2006-12-13 20:43:45 +03:00
return 0 ;
}
2012-03-12 01:25:51 +04:00
static int
do_adjtimex ( struct tcb * tcp , long addr )
{
if ( addr = = 0 )
tprints ( " NULL " ) ;
else if ( syserror ( tcp ) | | ! verbose ( tcp ) )
tprintf ( " %#lx " , addr ) ;
else if ( tprint_timex ( tcp , addr ) < 0 )
tprints ( " {...} " ) ;
if ( syserror ( tcp ) )
return 0 ;
tcp - > auxstr = xlookup ( adjtimex_state , tcp - > u_rval ) ;
if ( tcp - > auxstr )
return RVAL_STR ;
return 0 ;
}
2006-12-13 20:43:45 +03:00
int
sys_adjtimex ( struct tcb * tcp )
{
2012-03-12 01:25:51 +04:00
if ( exiting ( tcp ) )
return do_adjtimex ( tcp , tcp - > u_arg [ 0 ] ) ;
1999-02-19 03:21:36 +03:00
return 0 ;
}
2003-03-31 03:52:28 +04:00
2014-04-26 03:30:54 +04:00
# include "xlat/clockflags.h"
# include "xlat/clocknames.h"
2004-08-31 10:52:45 +04:00
2014-02-03 13:01:27 +04:00
static void
printclockname ( int clockid )
{
# ifdef CLOCKID_TO_FD
2014-04-26 22:10:19 +04:00
# include "xlat / cpuclocknames.h"
2014-02-03 13:01:27 +04:00
if ( clockid < 0 ) {
if ( ( clockid & CLOCKFD_MASK ) = = CLOCKFD )
tprintf ( " FD_TO_CLOCKID(%d) " , CLOCKID_TO_FD ( clockid ) ) ;
else {
if ( CPUCLOCK_PERTHREAD ( clockid ) )
tprintf ( " MAKE_THREAD_CPUCLOCK(%d, " , CPUCLOCK_PID ( clockid ) ) ;
else
tprintf ( " MAKE_PROCESS_CPUCLOCK(%d, " , CPUCLOCK_PID ( clockid ) ) ;
printxval ( cpuclocknames , clockid & CLOCKFD_MASK , " CPUCLOCK_??? " ) ;
tprints ( " ) " ) ;
}
}
else
# endif
printxval ( clocknames , clockid , " CLOCK_??? " ) ;
}
2003-03-31 03:52:28 +04:00
int
2011-05-30 16:00:14 +04:00
sys_clock_settime ( struct tcb * tcp )
2003-03-31 03:52:28 +04:00
{
if ( entering ( tcp ) ) {
2014-02-03 13:01:27 +04:00
printclockname ( tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2003-03-31 03:52:28 +04:00
printtv ( tcp , tcp - > u_arg [ 1 ] ) ;
}
return 0 ;
}
int
2011-05-30 16:00:14 +04:00
sys_clock_gettime ( struct tcb * tcp )
2003-03-31 03:52:28 +04:00
{
if ( entering ( tcp ) ) {
2014-02-03 13:01:27 +04:00
printclockname ( tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2003-03-31 03:52:28 +04:00
} else {
if ( syserror ( tcp ) )
tprintf ( " %#lx " , tcp - > u_arg [ 1 ] ) ;
else
printtv ( tcp , tcp - > u_arg [ 1 ] ) ;
}
return 0 ;
}
int
2011-05-30 16:00:14 +04:00
sys_clock_nanosleep ( struct tcb * tcp )
2003-03-31 03:52:28 +04:00
{
if ( entering ( tcp ) ) {
2014-02-03 13:01:27 +04:00
printclockname ( tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
* util.c (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument, "const char *", with similar
meaning to the third argument of printxval().
* defs.h (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument.
* bjm.c (sys_query_module) [LINUX]: Pass third argument to
printflags().
* desc.c (sys_fcntl): Likewise.
(sys_flock) [LOCK_SH]: Likewise.
(print_epoll_event) [HAVE_SYS_EPOLL_H]: Likewise.
* file.c (sys_open): Likewise.
(solaris_open) [LINUXSPARC]: Likewise.
(sys_access): Likewise.
(sys_chflags, sys_fchflags) [FREEBSD]: Likewise.
(realprintstat) [HAVE_LONG_LONG_OFF_T &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(printstat64) [HAVE_STAT64 &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(sys_setxattr, sys_fsetxattr): Likewise.
* ipc.c (sys_msgget, sys_msgsnd, sys_msgrcv, sys_semget,
sys_shmget, sys_shmat) [LINUX || SUNOS4 || FREEBSD]: Likewise.
(sys_mq_open) [LINUX]: Likewise.
(printmqattr) [HAVE_MQUEUE_H]: Likewise.
* mem.c (print_mmap) [!HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mmap64) [_LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mprotect): Likewise.
(sys_mremap, sys_madvise, sys_mlockall) [LINUX]: Likewise.
(sys_msync) [MS_ASYNC]: Likewise.
(sys_mctl) [MC_SYNC]: Likewise.
(sys_remap_file_pages, sys_mbind, sys_get_mempolicy) [LINUX]:
Likewise.
* net.c (printmsghdr) [HAVE_STRUCT_MSGHDR_MSG_CONTROL]: Likewise.
(sys_send, sys_sendto): Likewise.
(sys_sendmsg) [HAVE_SENDMSG]: Likewise.
(sys_recv, sys_recvfrom): Likewise.
(sys_recvmsg) [HAVE_SENDMSG]: Likewise.
(printicmpfilter) [ICMP_FILTER]: Likewise.
* proc.c (proc_ioctl) [SVR4 && !HAVE_MP_PROCFS || FREEBSD]: Likewise.
* process.c (sys_clone) [LINUX]: Likewise.
(printwaitn): Likewise.
(sys_waitid) [SVR4 || LINUX]: Likewise.
* signal.c (sys_sigvec) [SUNOS4 || FREEBSD]: Likewise.
(sys_sigaction): Likewise.
(printcontext) [SVR4]: Likewise.
(print_stack_t) [LINUX) || FREEBSD]: Likewise.
(sys_rt_sigaction) [LINUX]: Likewise.
* sock.c (sock_ioctl) [LINUX]: Likewise.
* stream.c (sys_putmsg, sys_getmsg): Likewise.
(sys_putpmsg) [SYS_putpmsg]: Likewise.
(sys_getpmsg) [SYS_getpmsg]: Likewise.
(sys_poll): Likewise.
(print_transport_message) [TI_BIND]: Likewise.
(stream_ioctl): Likewise.
* system.c (sys_mount, sys_reboot): Likewise.
(sys_cacheflush) [LINUX && M68K]: Likewise.
(sys_capget, sys_capset) [SYS_capget]: Likewise.
* term.c (term_ioctl) [TIOCMGET]: Likewise.
* time.c (sys_clock_nanosleep, sys_timer_settime) [LINUX]:
Likewise.
Fixes RH#159310.
2005-06-01 23:02:36 +04:00
printflags ( clockflags , tcp - > u_arg [ 1 ] , " TIMER_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2003-03-31 03:52:28 +04:00
printtv ( tcp , tcp - > u_arg [ 2 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2003-03-31 03:52:28 +04:00
} else {
if ( syserror ( tcp ) )
tprintf ( " %#lx " , tcp - > u_arg [ 3 ] ) ;
else
printtv ( tcp , tcp - > u_arg [ 3 ] ) ;
}
return 0 ;
}
2012-03-12 01:25:51 +04:00
int
sys_clock_adjtime ( struct tcb * tcp )
{
if ( exiting ( tcp ) )
return do_adjtimex ( tcp , tcp - > u_arg [ 1 ] ) ;
2014-02-03 13:01:27 +04:00
printclockname ( tcp - > u_arg [ 0 ] ) ;
2012-03-12 01:25:51 +04:00
tprints ( " , " ) ;
return 0 ;
}
2003-03-31 03:52:28 +04:00
# ifndef SIGEV_THREAD_ID
# define SIGEV_THREAD_ID 4
# endif
2014-04-26 03:30:54 +04:00
# include "xlat/sigev_value.h"
2003-03-31 03:52:28 +04:00
2006-12-13 20:45:02 +03:00
# if SUPPORTED_PERSONALITIES > 1
static void
printsigevent32 ( struct tcb * tcp , long arg )
{
2009-04-14 16:51:00 +04:00
struct {
2006-12-13 20:45:02 +03:00
int sigev_value ;
int sigev_signo ;
int sigev_notify ;
2009-04-14 16:51:00 +04:00
union {
2006-12-13 20:45:02 +03:00
int tid ;
2009-04-14 16:51:00 +04:00
struct {
2006-12-13 20:45:02 +03:00
int function , attribute ;
} thread ;
} un ;
} sev ;
if ( umove ( tcp , arg , & sev ) < 0 )
2011-09-01 12:00:28 +04:00
tprints ( " {...} " ) ;
2009-04-14 16:51:00 +04:00
else {
2006-12-13 20:45:02 +03:00
tprintf ( " {%#x, " , sev . sigev_value ) ;
if ( sev . sigev_notify = = SIGEV_SIGNAL )
tprintf ( " %s, " , signame ( sev . sigev_signo ) ) ;
else
tprintf ( " %u, " , sev . sigev_signo ) ;
2014-02-05 05:46:10 +04:00
printxval ( sigev_value , sev . sigev_notify , " SIGEV_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2006-12-13 20:45:02 +03:00
if ( sev . sigev_notify = = SIGEV_THREAD_ID )
tprintf ( " {%d} " , sev . un . tid ) ;
else if ( sev . sigev_notify = = SIGEV_THREAD )
tprintf ( " {%#x, %#x} " ,
sev . un . thread . function ,
sev . un . thread . attribute ) ;
else
2011-09-01 12:00:28 +04:00
tprints ( " {...} " ) ;
tprints ( " } " ) ;
2006-12-13 20:45:02 +03:00
}
}
# endif
2003-03-31 03:52:28 +04:00
void
2006-12-13 20:45:02 +03:00
printsigevent ( struct tcb * tcp , long arg )
2003-03-31 03:52:28 +04:00
{
struct sigevent sev ;
2006-12-13 20:45:02 +03:00
# if SUPPORTED_PERSONALITIES > 1
2012-03-19 12:36:42 +04:00
if ( current_wordsize = = 4 ) {
2006-12-13 20:45:02 +03:00
printsigevent32 ( tcp , arg ) ;
return ;
}
# endif
2011-06-07 14:13:24 +04:00
if ( umove ( tcp , arg , & sev ) < 0 )
2011-09-01 12:00:28 +04:00
tprints ( " {...} " ) ;
2003-03-31 03:52:28 +04:00
else {
2004-09-11 12:12:45 +04:00
tprintf ( " {%p, " , sev . sigev_value . sival_ptr ) ;
if ( sev . sigev_notify = = SIGEV_SIGNAL )
tprintf ( " %s, " , signame ( sev . sigev_signo ) ) ;
else
tprintf ( " %u, " , sev . sigev_signo ) ;
2014-02-05 05:46:10 +04:00
printxval ( sigev_value , sev . sigev_notify , " SIGEV_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2003-03-31 03:52:28 +04:00
if ( sev . sigev_notify = = SIGEV_THREAD_ID )
2013-11-12 03:54:30 +04:00
# if defined(HAVE_STRUCT_SIGEVENT__SIGEV_UN__PAD)
2003-03-31 03:52:28 +04:00
/* _pad[0] is the _tid field which might not be
present in the userlevel definition of the
struct . */
tprintf ( " {%d} " , sev . _sigev_un . _pad [ 0 ] ) ;
2013-11-12 03:54:30 +04:00
# elif defined(HAVE_STRUCT_SIGEVENT___PAD)
tprintf ( " {%d} " , sev . __pad [ 0 ] ) ;
# else
# warning unfamiliar struct sigevent => incomplete SIGEV_THREAD_ID decoding
tprints ( " {...} " ) ;
# endif
2004-04-17 01:48:44 +04:00
else if ( sev . sigev_notify = = SIGEV_THREAD )
tprintf ( " {%p, %p} " , sev . sigev_notify_function ,
sev . sigev_notify_attributes ) ;
2003-03-31 03:52:28 +04:00
else
2011-09-01 12:00:28 +04:00
tprints ( " {...} " ) ;
tprints ( " } " ) ;
2003-03-31 03:52:28 +04:00
}
}
int
2011-05-30 16:00:14 +04:00
sys_timer_create ( struct tcb * tcp )
2003-03-31 03:52:28 +04:00
{
if ( entering ( tcp ) ) {
2014-02-03 13:01:27 +04:00
printclockname ( tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2003-03-31 03:52:28 +04:00
printsigevent ( tcp , tcp - > u_arg [ 1 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2003-03-31 03:52:28 +04:00
} else {
2011-06-14 01:37:40 +04:00
int timer_id ;
2006-12-13 20:03:02 +03:00
2011-06-14 01:37:40 +04:00
if ( syserror ( tcp ) | | umove ( tcp , tcp - > u_arg [ 2 ] , & timer_id ) < 0 )
2003-03-31 03:52:28 +04:00
tprintf ( " %#lx " , tcp - > u_arg [ 2 ] ) ;
2006-12-13 20:03:02 +03:00
else
2011-06-14 01:37:40 +04:00
tprintf ( " {%d} " , timer_id ) ;
2003-03-31 03:52:28 +04:00
}
return 0 ;
}
int
2011-05-30 16:00:14 +04:00
sys_timer_settime ( struct tcb * tcp )
2003-03-31 03:52:28 +04:00
{
if ( entering ( tcp ) ) {
tprintf ( " %#lx, " , tcp - > u_arg [ 0 ] ) ;
2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
* util.c (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument, "const char *", with similar
meaning to the third argument of printxval().
* defs.h (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument.
* bjm.c (sys_query_module) [LINUX]: Pass third argument to
printflags().
* desc.c (sys_fcntl): Likewise.
(sys_flock) [LOCK_SH]: Likewise.
(print_epoll_event) [HAVE_SYS_EPOLL_H]: Likewise.
* file.c (sys_open): Likewise.
(solaris_open) [LINUXSPARC]: Likewise.
(sys_access): Likewise.
(sys_chflags, sys_fchflags) [FREEBSD]: Likewise.
(realprintstat) [HAVE_LONG_LONG_OFF_T &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(printstat64) [HAVE_STAT64 &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(sys_setxattr, sys_fsetxattr): Likewise.
* ipc.c (sys_msgget, sys_msgsnd, sys_msgrcv, sys_semget,
sys_shmget, sys_shmat) [LINUX || SUNOS4 || FREEBSD]: Likewise.
(sys_mq_open) [LINUX]: Likewise.
(printmqattr) [HAVE_MQUEUE_H]: Likewise.
* mem.c (print_mmap) [!HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mmap64) [_LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mprotect): Likewise.
(sys_mremap, sys_madvise, sys_mlockall) [LINUX]: Likewise.
(sys_msync) [MS_ASYNC]: Likewise.
(sys_mctl) [MC_SYNC]: Likewise.
(sys_remap_file_pages, sys_mbind, sys_get_mempolicy) [LINUX]:
Likewise.
* net.c (printmsghdr) [HAVE_STRUCT_MSGHDR_MSG_CONTROL]: Likewise.
(sys_send, sys_sendto): Likewise.
(sys_sendmsg) [HAVE_SENDMSG]: Likewise.
(sys_recv, sys_recvfrom): Likewise.
(sys_recvmsg) [HAVE_SENDMSG]: Likewise.
(printicmpfilter) [ICMP_FILTER]: Likewise.
* proc.c (proc_ioctl) [SVR4 && !HAVE_MP_PROCFS || FREEBSD]: Likewise.
* process.c (sys_clone) [LINUX]: Likewise.
(printwaitn): Likewise.
(sys_waitid) [SVR4 || LINUX]: Likewise.
* signal.c (sys_sigvec) [SUNOS4 || FREEBSD]: Likewise.
(sys_sigaction): Likewise.
(printcontext) [SVR4]: Likewise.
(print_stack_t) [LINUX) || FREEBSD]: Likewise.
(sys_rt_sigaction) [LINUX]: Likewise.
* sock.c (sock_ioctl) [LINUX]: Likewise.
* stream.c (sys_putmsg, sys_getmsg): Likewise.
(sys_putpmsg) [SYS_putpmsg]: Likewise.
(sys_getpmsg) [SYS_getpmsg]: Likewise.
(sys_poll): Likewise.
(print_transport_message) [TI_BIND]: Likewise.
(stream_ioctl): Likewise.
* system.c (sys_mount, sys_reboot): Likewise.
(sys_cacheflush) [LINUX && M68K]: Likewise.
(sys_capget, sys_capset) [SYS_capget]: Likewise.
* term.c (term_ioctl) [TIOCMGET]: Likewise.
* time.c (sys_clock_nanosleep, sys_timer_settime) [LINUX]:
Likewise.
Fixes RH#159310.
2005-06-01 23:02:36 +04:00
printflags ( clockflags , tcp - > u_arg [ 1 ] , " TIMER_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2003-03-31 03:52:28 +04:00
printitv ( tcp , tcp - > u_arg [ 2 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2003-03-31 03:52:28 +04:00
} else {
if ( syserror ( tcp ) )
tprintf ( " %#lx " , tcp - > u_arg [ 3 ] ) ;
else
printitv ( tcp , tcp - > u_arg [ 3 ] ) ;
}
return 0 ;
}
int
2011-05-30 16:00:14 +04:00
sys_timer_gettime ( struct tcb * tcp )
2003-03-31 03:52:28 +04:00
{
if ( entering ( tcp ) ) {
tprintf ( " %#lx, " , tcp - > u_arg [ 0 ] ) ;
} else {
if ( syserror ( tcp ) )
tprintf ( " %#lx " , tcp - > u_arg [ 1 ] ) ;
else
printitv ( tcp , tcp - > u_arg [ 1 ] ) ;
}
return 0 ;
}
2004-10-07 02:27:43 +04:00
static void
2011-05-30 16:00:14 +04:00
print_rtc ( struct tcb * tcp , const struct rtc_time * rt )
2004-10-07 02:27:43 +04: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
2011-09-01 12:00:28 +04:00
tprints ( " ...} " ) ;
2004-10-07 02:27:43 +04:00
}
int
ioctl: assume that all ioctl commands have unsigned int type
In linux, ioctl command number has a 32-bit unsigned integer type:
fs/ioctl.c:SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
If the kernel completely ignores other bits on 64-bit architectures,
why should strace care?
Let's follow the kernel and treat it as unsigned int.
* defs.h (struct_ioctlent): Change "code" type to "unsigned int".
(ioctl_decode, ioctl_lookup, block_ioctl, loop_ioctl, mtd_ioctl,
ubi_ioctl, ptp_ioctl, scsi_ioctl, sock_ioctl, term_ioctl, rtc_ioctl,
v4l2_ioctl): Likewise.
* ioctl.c (ioctl_decode, ioctl_lookup, compare, ioctl_next_match):
Likewise.
* block.c (block_ioctl): Likewise.
* loop.c (loop_ioctl): Likewise.
* mtd.c (mtd_ioctl, ubi_ioctl): Likewise.
* ptp.c (ptp_ioctl): Likewise.
* scsi.c (scsi_ioctl): Likewise.
* sock.c (sock_ioctl): Likewise.
* term.c (term_ioctl): Likewise.
* time.c (rtc_ioctl): Likewise.
* v4l2.c (v4l2_ioctl): Likewise.
* ioctlsort.c (struct ioctlent, compare, main): Likewise.
2015-01-19 21:44:21 +03:00
rtc_ioctl ( struct tcb * tcp , const unsigned int code , long arg )
2004-10-07 02:27:43 +04:00
{
switch ( code ) {
case RTC_ALM_SET :
case RTC_SET_TIME :
if ( entering ( tcp ) ) {
struct rtc_time rt ;
if ( umove ( tcp , arg , & rt ) < 0 )
tprintf ( " , %#lx " , arg ) ;
else {
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2004-10-07 02:27:43 +04:00
print_rtc ( tcp , & rt ) ;
}
}
break ;
case RTC_ALM_READ :
case RTC_RD_TIME :
if ( exiting ( tcp ) ) {
struct rtc_time rt ;
if ( syserror ( tcp ) | | umove ( tcp , arg , & rt ) < 0 )
tprintf ( " , %#lx " , arg ) ;
else {
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2004-10-07 02:27:43 +04:00
print_rtc ( tcp , & rt ) ;
}
}
break ;
case RTC_IRQP_SET :
case RTC_EPOCH_SET :
if ( entering ( tcp ) )
tprintf ( " , %lu " , arg ) ;
break ;
case RTC_IRQP_READ :
case RTC_EPOCH_READ :
if ( exiting ( tcp ) )
tprintf ( " , %lu " , arg ) ;
break ;
case RTC_WKALM_SET :
if ( entering ( tcp ) ) {
struct rtc_wkalrm wk ;
if ( umove ( tcp , arg , & wk ) < 0 )
tprintf ( " , %#lx " , arg ) ;
else {
tprintf ( " , {enabled=%d, pending=%d, " ,
wk . enabled , wk . pending ) ;
print_rtc ( tcp , & wk . time ) ;
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
2004-10-07 02:27:43 +04:00
}
}
break ;
case RTC_WKALM_RD :
if ( exiting ( tcp ) ) {
struct rtc_wkalrm wk ;
if ( syserror ( tcp ) | | umove ( tcp , arg , & wk ) < 0 )
tprintf ( " , %#lx " , arg ) ;
else {
tprintf ( " , {enabled=%d, pending=%d, " ,
wk . enabled , wk . pending ) ;
print_rtc ( tcp , & wk . time ) ;
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
2004-10-07 02:27:43 +04:00
}
}
break ;
default :
if ( entering ( tcp ) )
tprintf ( " , %#lx " , arg ) ;
break ;
}
return 1 ;
}
2007-08-02 05:25:34 +04:00
2014-04-26 03:30:54 +04:00
# include "xlat/timerfdflags.h"
2007-08-02 05:25:34 +04:00
int
2011-05-30 16:00:14 +04:00
sys_timerfd ( struct tcb * tcp )
2007-08-02 05:25:34 +04:00
{
if ( entering ( tcp ) ) {
/* It does not matter that the kernel uses itimerspec. */
tprintf ( " %ld, " , tcp - > u_arg [ 0 ] ) ;
2014-02-03 13:01:27 +04:00
printclockname ( tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2007-08-02 05:25:34 +04:00
printflags ( timerfdflags , tcp - > u_arg [ 2 ] , " TFD_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2007-08-02 05:25:34 +04:00
printitv ( tcp , tcp - > u_arg [ 3 ] ) ;
}
return 0 ;
}
2008-05-20 08:56:13 +04:00
int
sys_timerfd_create ( struct tcb * tcp )
{
if ( entering ( tcp ) ) {
2014-02-03 13:01:27 +04:00
printclockname ( tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2008-05-20 08:56:13 +04:00
printflags ( timerfdflags , tcp - > u_arg [ 1 ] , " TFD_??? " ) ;
}
return 0 ;
}
int
sys_timerfd_settime ( struct tcb * tcp )
{
if ( entering ( tcp ) ) {
Fix decoding of file descriptors
* defs.h (printfd): New function prototype.
* util.c (printfd): New function.
* file.c (print_dirfd): Update prototype to use printfd().
(sys_openat, sys_faccessat, sys_newfstatat, sys_mkdirat, sys_linkat,
sys_unlinkat, sys_readlinkat, sys_renameat, sys_fchownat, sys_fchmodat,
sys_futimesat, sys_utimensat, sys_mknodat): Update use of print_dirfd().
(sys_lseek, sys_llseek, sys_readahead, sys_ftruncate, sys_ftruncate64,
sys_fstat, sys_fstat64, sys_oldfstat, sys_fstatfs, sys_fstatfs64,
sys_fchdir, sys_fchroot, sys_linkat, sys_fchown, sys_fchmod, sys_fsync,
sys_readdir, sys_getdents, sys_getdirentries, sys_fsetxattr,
sys_fgetxattr, sys_flistxattr, sys_fremovexattr, sys_fadvise64,
sys_fadvise64_64, sys_inotify_add_watch, sys_inotify_rm_watch,
sys_fallocate): Use printfd() for decoding of file descriptors.
* desc.c (sys_fcntl, sys_flock, sys_close, sys_dup, do_dup2,
decode_select, sys_epoll_ctl, epoll_wait_common): Use printfd() for
decoding of file descriptors.
* io.c (sys_read, sys_write, sys_readv, sys_writev, sys_pread,
sys_pwrite, sys_sendfile, sys_sendfile64, sys_pread64, sys_pwrite64,
sys_ioctl): Likewise.
* mem.c (print_mmap, sys_mmap64): Likewise.
* signal.c (do_signalfd): Likewise.
* stream.c (decode_poll): Likewise.
* time.c (sys_timerfd_settime, sys_timerfd_gettime): Likewise.
Based on patch from Grant Edwards <grant.b.edwards@gmail.com>.
2011-03-04 05:08:02 +03:00
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2008-05-20 08:56:13 +04:00
printflags ( timerfdflags , tcp - > u_arg [ 1 ] , " TFD_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2008-05-20 08:56:13 +04:00
printitv ( tcp , tcp - > u_arg [ 2 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2008-05-20 08:56:13 +04:00
printitv ( tcp , tcp - > u_arg [ 3 ] ) ;
}
return 0 ;
}
int
sys_timerfd_gettime ( struct tcb * tcp )
{
if ( entering ( tcp ) ) {
Fix decoding of file descriptors
* defs.h (printfd): New function prototype.
* util.c (printfd): New function.
* file.c (print_dirfd): Update prototype to use printfd().
(sys_openat, sys_faccessat, sys_newfstatat, sys_mkdirat, sys_linkat,
sys_unlinkat, sys_readlinkat, sys_renameat, sys_fchownat, sys_fchmodat,
sys_futimesat, sys_utimensat, sys_mknodat): Update use of print_dirfd().
(sys_lseek, sys_llseek, sys_readahead, sys_ftruncate, sys_ftruncate64,
sys_fstat, sys_fstat64, sys_oldfstat, sys_fstatfs, sys_fstatfs64,
sys_fchdir, sys_fchroot, sys_linkat, sys_fchown, sys_fchmod, sys_fsync,
sys_readdir, sys_getdents, sys_getdirentries, sys_fsetxattr,
sys_fgetxattr, sys_flistxattr, sys_fremovexattr, sys_fadvise64,
sys_fadvise64_64, sys_inotify_add_watch, sys_inotify_rm_watch,
sys_fallocate): Use printfd() for decoding of file descriptors.
* desc.c (sys_fcntl, sys_flock, sys_close, sys_dup, do_dup2,
decode_select, sys_epoll_ctl, epoll_wait_common): Use printfd() for
decoding of file descriptors.
* io.c (sys_read, sys_write, sys_readv, sys_writev, sys_pread,
sys_pwrite, sys_sendfile, sys_sendfile64, sys_pread64, sys_pwrite64,
sys_ioctl): Likewise.
* mem.c (print_mmap, sys_mmap64): Likewise.
* signal.c (do_signalfd): Likewise.
* stream.c (decode_poll): Likewise.
* time.c (sys_timerfd_settime, sys_timerfd_gettime): Likewise.
Based on patch from Grant Edwards <grant.b.edwards@gmail.com>.
2011-03-04 05:08:02 +03:00
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2008-05-20 08:56:13 +04:00
printitv ( tcp , tcp - > u_arg [ 1 ] ) ;
}
return 0 ;
}