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>
2015-07-18 02:56:54 +03:00
# include <signal.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>
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
2015-02-28 00:46:42 +03:00
# if SUPPORTED_PERSONALITIES > 1
# if defined X86_64 || defined X32
# define current_time_t_is_compat (current_personality == 1)
# else
# define current_time_t_is_compat (current_wordsize == 4)
# endif
# else
# define current_time_t_is_compat 0
# endif
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 )
{
2015-02-28 00:46:42 +03:00
tprintf ( " {%ju, %ju} " , ( uintmax_t ) tv - > tv_sec , ( uintmax_t ) tv - > tv_usec ) ;
2006-12-13 20:14:36 +03:00
}
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 *
2015-02-28 00:46:42 +03:00
do_sprinttv ( char * buf , const uintmax_t sec , const uintmax_t usec ,
2014-12-27 02:55:38 +03:00
const int special )
{
if ( special ) {
switch ( usec ) {
case UTIME_NOW :
return stpcpy ( buf , " UTIME_NOW " ) ;
case UTIME_OMIT :
return stpcpy ( buf , " UTIME_OMIT " ) ;
}
}
2015-02-28 00:46:42 +03:00
return buf + sprintf ( buf , " {%ju, %ju} " , sec , usec ) ;
2014-12-27 02:55:38 +03:00
}
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
2015-07-16 19:22:07 +03:00
if ( ! verbose ( tcp ) | | ( exiting ( tcp ) & & syserror ( tcp ) ) )
2011-09-01 13:40:40 +04:00
return buf + sprintf ( buf , " %#lx " , addr ) ;
2011-08-31 14:26:03 +04:00
2015-02-28 00:46:42 +03:00
if ( bitness = = BITNESS_32 | | current_time_t_is_compat )
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
2015-07-16 19:22:07 +03:00
return buf + sprintf ( buf , " %#lx " , addr ) ;
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
2015-02-28 00:46:42 +03:00
if ( current_time_t_is_compat ) {
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 )
2015-02-28 00:46:42 +03:00
sprintf ( buf , " {%ju, %ju} " ,
( uintmax_t ) ts . tv_sec ,
( uintmax_t ) ts . tv_nsec ) ;
2007-11-02 00:50:54 +03:00
}
if ( rc < 0 )
strcpy ( buf , " {...} " ) ;
}
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( time )
1999-02-19 03:21:36 +03:00
{
if ( exiting ( tcp ) ) {
2015-02-18 01:03:17 +03:00
printnum_long ( tcp , tcp - > u_arg [ 0 ] , " %ld " ) ;
1999-02-19 03:21:36 +03:00
}
return 0 ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( gettimeofday )
1999-02-19 03:21:36 +03:00
{
if ( exiting ( 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
2015-04-07 04:36:50 +03:00
SYS_FUNC ( osf_gettimeofday )
1999-11-18 20:09:47 +03:00
{
2009-04-14 16:51:00 +04:00
if ( exiting ( 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
2015-04-07 04:36:50 +03:00
SYS_FUNC ( settimeofday )
1999-02-19 03:21:36 +03:00
{
2015-07-17 00:07:06 +03:00
printtv ( tcp , tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
printtv ( tcp , tcp - > u_arg [ 1 ] ) ;
return RVAL_DECODED ;
1999-02-19 03:21:36 +03:00
}
1999-11-18 20:09:47 +03:00
# ifdef ALPHA
2015-04-07 04:36:50 +03:00
SYS_FUNC ( osf_settimeofday )
1999-11-18 20:09:47 +03:00
{
2015-07-17 00:07:06 +03:00
printtv_bitness ( tcp , tcp - > u_arg [ 0 ] , BITNESS_32 , 0 ) ;
tprints ( " , " ) ;
printtv_bitness ( tcp , tcp - > u_arg [ 1 ] , BITNESS_32 , 0 ) ;
return RVAL_DECODED ;
1999-11-18 20:09:47 +03:00
}
# endif
2015-04-07 04:36:50 +03:00
SYS_FUNC ( adjtime )
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 {
2015-07-16 19:22:07 +03:00
printtv ( tcp , tcp - > u_arg [ 1 ] ) ;
1999-02-19 03:21:36 +03:00
}
return 0 ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( nanosleep )
2008-09-03 05:02:46 +04:00
{
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) */
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
printaddr ( tcp - > u_arg [ 1 ] ) ;
break ;
2013-07-01 01:53:49 +04:00
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
{
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
if ( bitness = = BITNESS_32 | | current_time_t_is_compat ) {
struct {
struct timeval32 it_interval , it_value ;
} itv ;
if ( ! umove_or_printaddr ( tcp , addr , & itv ) ) {
tprints ( " {it_interval= " ) ;
tprint_timeval32 ( tcp , & itv . it_interval ) ;
tprints ( " , it_value= " ) ;
tprint_timeval32 ( tcp , & itv . it_value ) ;
tprints ( " } " ) ;
}
} else {
struct itimerval itv ;
if ( ! umove_or_printaddr ( tcp , addr , & itv ) ) {
tprints ( " {it_interval= " ) ;
tprint_timeval ( tcp , & itv . it_interval ) ;
tprints ( " , it_value= " ) ;
tprint_timeval ( tcp , & itv . it_value ) ;
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
2015-04-07 04:36:50 +03:00
SYS_FUNC ( getitimer )
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 {
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
printitv ( tcp , tcp - > u_arg [ 1 ] ) ;
1999-02-19 03:21:36 +03:00
}
return 0 ;
}
1999-11-18 20:09:47 +03:00
# ifdef ALPHA
2015-04-07 04:36:50 +03:00
SYS_FUNC ( osf_getitimer )
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 {
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
printitv_bitness ( tcp , tcp - > u_arg [ 1 ] , BITNESS_32 ) ;
2009-04-14 16:51:00 +04:00
}
return 0 ;
1999-11-18 20:09:47 +03:00
}
# endif
2015-04-07 04:36:50 +03:00
SYS_FUNC ( setitimer )
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 {
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
printitv ( tcp , tcp - > u_arg [ 2 ] ) ;
1999-02-19 03:21:36 +03:00
}
return 0 ;
}
1999-11-18 20:09:47 +03:00
# ifdef ALPHA
2015-04-07 04:36:50 +03:00
SYS_FUNC ( osf_setitimer )
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 {
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
printitv_bitness ( tcp , tcp - > u_arg [ 2 ] , BITNESS_32 ) ;
2009-04-14 16:51:00 +04:00
}
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 ;
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
if ( umove_or_printaddr ( tcp , addr , & tx ) )
2006-12-13 20:43:45 +03:00
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
2015-02-28 00:46:42 +03:00
if ( current_time_t_is_compat )
2006-12-13 20:43:45 +03:00
return tprint_timex32 ( tcp , addr ) ;
# endif
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
if ( umove_or_printaddr ( tcp , addr , & tx ) )
2006-12-13 20:43:45 +03:00
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_??? " ) ;
2015-02-28 00:46:42 +03:00
tprintf ( " , offset=%jd, freq=%jd, maxerror=%ju, esterror=%ju, status= " ,
( intmax_t ) tx . offset , ( intmax_t ) tx . freq ,
( uintmax_t ) tx . maxerror , ( uintmax_t ) tx . esterror ) ;
2006-12-13 20:43:45 +03:00
printflags ( adjtimex_status , tx . status , " STA_??? " ) ;
2015-02-28 00:46:42 +03:00
tprintf ( " , constant=%jd, precision=%ju, tolerance=%jd, time= " ,
( intmax_t ) tx . constant , ( uintmax_t ) tx . precision ,
( intmax_t ) tx . tolerance ) ;
2006-12-13 20:43:45 +03:00
tprint_timeval ( tcp , & tx . time ) ;
2015-02-28 00:46:42 +03:00
tprintf ( " , tick=%jd, ppsfreq=%jd, jitter=%jd " ,
( intmax_t ) tx . tick , ( intmax_t ) tx . ppsfreq , ( intmax_t ) tx . jitter ) ;
tprintf ( " , shift=%d, stabil=%jd, jitcnt=%jd " ,
tx . shift , ( intmax_t ) tx . stabil , ( intmax_t ) tx . jitcnt ) ;
tprintf ( " , calcnt=%jd, errcnt=%jd, stbcnt=%jd " ,
( intmax_t ) tx . calcnt , ( intmax_t ) tx . errcnt , ( intmax_t ) tx . stbcnt ) ;
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 )
{
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
if ( tprint_timex ( tcp , addr ) )
2012-03-12 01:25:51 +04:00
return 0 ;
tcp - > auxstr = xlookup ( adjtimex_state , tcp - > u_rval ) ;
if ( tcp - > auxstr )
return RVAL_STR ;
return 0 ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( adjtimex )
2006-12-13 20:43:45 +03:00
{
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_??? " ) ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( clock_settime )
2003-03-31 03:52:28 +04:00
{
2015-07-17 00:07:06 +03:00
printclockname ( tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
printtv ( tcp , tcp - > u_arg [ 1 ] ) ;
return RVAL_DECODED ;
2003-03-31 03:52:28 +04:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( clock_gettime )
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 {
2015-07-16 19:22:07 +03:00
printtv ( tcp , tcp - > u_arg [ 1 ] ) ;
2003-03-31 03:52:28 +04:00
}
return 0 ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( clock_nanosleep )
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 {
2015-07-16 19:22:07 +03:00
printtv ( tcp , tcp - > u_arg [ 3 ] ) ;
2003-03-31 03:52:28 +04:00
}
return 0 ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( clock_adjtime )
2012-03-12 01:25:51 +04:00
{
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 ;
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
if ( ! umove_or_printaddr ( tcp , arg , & sev ) ) {
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
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
if ( ! umove_or_printaddr ( tcp , arg , & sev ) ) {
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
}
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( timer_create )
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 {
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
printnum_int ( tcp , tcp - > u_arg [ 2 ] , " %d " ) ;
2003-03-31 03:52:28 +04:00
}
return 0 ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( timer_settime )
2003-03-31 03:52:28 +04:00
{
if ( entering ( tcp ) ) {
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
tprintf ( " %d, " , ( int ) 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 {
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
printitv ( tcp , tcp - > u_arg [ 3 ] ) ;
2003-03-31 03:52:28 +04:00
}
return 0 ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( timer_gettime )
2003-03-31 03:52:28 +04:00
{
if ( entering ( tcp ) ) {
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
tprintf ( " %d, " , ( int ) tcp - > u_arg [ 0 ] ) ;
2003-03-31 03:52:28 +04:00
} else {
time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 21:18:09 +03:00
printitv ( tcp , tcp - > u_arg [ 1 ] ) ;
2003-03-31 03:52:28 +04:00
}
return 0 ;
}
2004-10-07 02:27:43 +04:00
2014-04-26 03:30:54 +04:00
# include "xlat/timerfdflags.h"
2007-08-02 05:25:34 +04:00
2015-04-07 04:36:50 +03:00
SYS_FUNC ( timerfd )
2007-08-02 05:25:34 +04:00
{
2015-07-17 00:07:06 +03:00
/* It does not matter that the kernel uses itimerspec. */
tprintf ( " %ld, " , tcp - > u_arg [ 0 ] ) ;
printclockname ( tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
printflags ( timerfdflags , tcp - > u_arg [ 2 ] , " TFD_??? " ) ;
tprints ( " , " ) ;
printitv ( tcp , tcp - > u_arg [ 3 ] ) ;
return RVAL_DECODED ;
2007-08-02 05:25:34 +04:00
}
2008-05-20 08:56:13 +04:00
2015-04-07 04:36:50 +03:00
SYS_FUNC ( timerfd_create )
2008-05-20 08:56:13 +04:00
{
2015-07-17 00:07:06 +03:00
printclockname ( tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
printflags ( timerfdflags , tcp - > u_arg [ 1 ] , " TFD_??? " ) ;
return RVAL_DECODED ;
2008-05-20 08:56:13 +04:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( timerfd_settime )
2008-05-20 08:56:13 +04:00
{
2015-07-17 00:07:06 +03:00
printfd ( tcp , tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
printflags ( timerfdflags , tcp - > u_arg [ 1 ] , " TFD_??? " ) ;
tprints ( " , " ) ;
printitv ( tcp , tcp - > u_arg [ 2 ] ) ;
tprints ( " , " ) ;
printitv ( tcp , tcp - > u_arg [ 3 ] ) ;
return RVAL_DECODED ;
2008-05-20 08:56:13 +04:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( timerfd_gettime )
2008-05-20 08:56:13 +04:00
{
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 ( " , " ) ;
2015-07-17 00:07:06 +03:00
} else {
2008-05-20 08:56:13 +04:00
printitv ( tcp , tcp - > u_arg [ 1 ] ) ;
}
return 0 ;
}