From: Roland McGrath Date: Tue, 24 Jul 2007 01:57:11 +0000 (+0000) Subject: 2007-07-23 Ulrich Drepper X-Git-Tag: v4.5.18~178 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6afc5659acc3df3d2e446ba4aa3a76bdd7264e1b;p=strace 2007-07-23 Ulrich Drepper * defs.h: Add new parameter to printtv_bitness prototype. (printttv): Pass zero for the new parameter. (printtv_special): New macro. * desc.c (decode_select): Pass zero for the new parameter of printtv_bitness. * file.c (utimensatflags): New macro. (sys_osf_utimes): Pass zero for the new parameter of printtv_bitness. (sys_utimes): Likewise. (sys_futimesat): Likewise. (decode_utimes): Add new parameter. Pass it to the printtv_bitness calls. Fix printing of time values. (sys_utimensat): New function. * time.c (UTIME_NOW, UTIME_OMIT): Define if not already happened. (printtv_bitness): Add new parameter. Print special UTIME_* values as strings if set. (sys_osf_gettimeofday): Pass zero for the new parameter of printtv_bitness. (sys_osf_settimeofday): Likewise. * linux/syscall.h: Declare sys_utimensat. * linux/syscallent.h: Add utimensat entry. * linux/x86_64/syscallent.h: Likewise. --- diff --git a/defs.h b/defs.h index 7f9af82c..99f496ce 100644 --- a/defs.h +++ b/defs.h @@ -453,7 +453,7 @@ extern void printnum P((struct tcb *, long, char *)); extern void printnum_int P((struct tcb *, long, char *)); extern void printpath P((struct tcb *, long)); extern void printpathn P((struct tcb *, long, int)); -extern void printtv_bitness P((struct tcb *, long, enum bitness_t)); +extern void printtv_bitness P((struct tcb *, long, enum bitness_t, int)); extern void sprinttv P((struct tcb *, long, enum bitness_t, char *)); #ifdef HAVE_SIGINFO_T extern void printsiginfo P((siginfo_t *, int)); @@ -519,7 +519,9 @@ extern int proc_open P((struct tcb *tcp, int attaching)); umoven((pid), (addr), sizeof *(objp), (char *) (objp)) #define printtv(tcp, addr) \ - printtv_bitness((tcp), (addr), BITNESS_CURRENT) + printtv_bitness((tcp), (addr), BITNESS_CURRENT, 0) +#define printtv_special(tcp, addr) \ + printtv_bitness((tcp), (addr), BITNESS_CURRENT, 1) #ifdef __STDC__ #ifdef __GNUC__ diff --git a/desc.c b/desc.c index caa7ccfc..31af6c19 100644 --- a/desc.c +++ b/desc.c @@ -476,7 +476,7 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness) } free(fds); tprintf(", "); - printtv_bitness(tcp, args[4], bitness); + printtv_bitness(tcp, args[4], bitness, 0); } else { diff --git a/file.c b/file.c index 7c17063f..5eb67657 100644 --- a/file.c +++ b/file.c @@ -1184,6 +1184,7 @@ static const struct xlat fstatatflags[] = { { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" }, { 0, NULL }, }; +#define utimensatflags fstatatflags int sys_newfstatat(struct tcb *tcp) @@ -2087,19 +2088,30 @@ struct tcb *tcp; if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); - printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32); + printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); } return 0; } #endif static int -decode_utimes(struct tcb *tcp, int offset) +decode_utimes(struct tcb *tcp, int offset, int special) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[offset]); tprintf(", "); - printtv(tcp, tcp->u_arg[offset + 1]); + if (tcp->u_arg[offset + 1] == 0) + tprintf("NULL"); + else { + tprintf("{"); + printtv_bitness(tcp, tcp->u_arg[offset + 1], + BITNESS_CURRENT, special); + tprintf(", "); + printtv_bitness(tcp, tcp->u_arg[offset + 1] + + sizeof (struct timeval), + BITNESS_CURRENT, special); + tprintf("}"); + } } return 0; } @@ -2107,7 +2119,7 @@ decode_utimes(struct tcb *tcp, int offset) int sys_utimes(struct tcb *tcp) { - return decode_utimes(tcp, 0); + return decode_utimes(tcp, 0, 0); } #ifdef LINUX @@ -2116,7 +2128,19 @@ sys_futimesat(struct tcb *tcp) { if (entering(tcp)) print_dirfd(tcp->u_arg[0]); - return decode_utimes(tcp, 1); + return decode_utimes(tcp, 1, 0); +} + +int +sys_utimensat(struct tcb *tcp) +{ + if (entering(tcp)) { + print_dirfd(tcp->u_arg[0]); + decode_utimes(tcp, 1, 1); + tprintf(", "); + printflags(utimensatflags, tcp->u_arg[3], "AT_???"); + } + return 0; } #endif diff --git a/linux/syscall.h b/linux/syscall.h index dbb7a847..1922ee01 100644 --- a/linux/syscall.h +++ b/linux/syscall.h @@ -102,6 +102,7 @@ int sys_waitid(), sys_fadvise64(), sys_fadvise64_64(); int sys_mbind(), sys_get_mempolicy(), sys_set_mempolicy(), sys_move_pages(); int sys_arch_prctl(); int sys_io_setup(), sys_io_submit(), sys_io_cancel(), sys_io_getevents(), sys_io_destroy(); +int sys_utimensat(); /* sys_socketcall subcalls */ diff --git a/linux/syscallent.h b/linux/syscallent.h index df1f607e..581f5b65 100644 --- a/linux/syscallent.h +++ b/linux/syscallent.h @@ -350,7 +350,7 @@ { 6, 0, sys_move_pages, "move_pages" }, /* 317 */ { 5, 0, printargs, "SYS_318" }, /* 318 */ { 5, 0, printargs, "SYS_319" }, /* 319 */ - { 5, 0, printargs, "SYS_320" }, /* 320 */ + { 4, TD|TF, sys_utimensat, "utimensat" }, /* 320 */ { 5, 0, printargs, "SYS_321" }, /* 321 */ { 5, 0, printargs, "SYS_322" }, /* 322 */ { 5, 0, printargs, "SYS_323" }, /* 323 */ diff --git a/linux/x86_64/syscallent.h b/linux/x86_64/syscallent.h index 83dad868..fb68ec30 100644 --- a/linux/x86_64/syscallent.h +++ b/linux/x86_64/syscallent.h @@ -278,3 +278,4 @@ { 4, TD, printargs, "tee" }, /* 277 */ { 4, TD, printargs, "vmsplice" }, /* 278 */ { 6, 0, sys_move_pages, "move_pages" }, /* 279 */ + { 4, TD|TF, sys_utimensat, "utimensat" }, /* 280 */ diff --git a/time.c b/time.c index 3d2f6c99..b4c6acf2 100644 --- a/time.c +++ b/time.c @@ -36,6 +36,13 @@ #include #include #include + +#ifndef UTIME_NOW +#define UTIME_NOW ((1l << 30) - 1l) +#endif +#ifndef UTIME_OMIT +#define UTIME_OMIT ((1l << 30) - 2l) +#endif #endif /* LINUX */ struct timeval32 @@ -57,7 +64,7 @@ tprint_timeval(struct tcb *tcp, const struct timeval *tv) } void -printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness) +printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special) { if (addr == 0) tprintf("NULL"); @@ -75,14 +82,26 @@ printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness) { struct timeval32 tv; - if ((rc = umove(tcp, addr, &tv)) >= 0) - tprint_timeval32(tcp, &tv); + if ((rc = umove(tcp, addr, &tv)) >= 0) { + if (special && tv.tv_usec == UTIME_NOW) + tprintf("UTIME_NOW"); + else if (special && tv.tv_usec == UTIME_OMIT) + tprintf("UTIME_OMIT"); + else + tprint_timeval32(tcp, &tv); + } } else { struct timeval tv; - if ((rc = umove(tcp, addr, &tv)) >= 0) - tprint_timeval(tcp, &tv); + if ((rc = umove(tcp, addr, &tv)) >= 0) { + if (special && tv.tv_usec == UTIME_NOW) + tprintf("UTIME_NOW"); + else if (special && tv.tv_usec == UTIME_OMIT) + tprintf("UTIME_OMIT"); + else + tprint_timeval(tcp, &tv); + } } if (rc < 0) @@ -180,10 +199,10 @@ struct tcb *tcp; tcp->u_arg[0], tcp->u_arg[1]); return 0; } - printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32); + printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); #ifndef SVR4 tprintf(", "); - printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32); + printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); #endif /* !SVR4 */ } return 0; @@ -210,10 +229,10 @@ sys_osf_settimeofday(tcp) struct tcb *tcp; { if (entering(tcp)) { - printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32); + printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); #ifndef SVR4 tprintf(", "); - printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32); + printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); #endif /* !SVR4 */ } return 0;