]> granicus.if.org Git - strace/commitdiff
2007-07-23 Ulrich Drepper <drepper@redhat.com>
authorRoland McGrath <roland@redhat.com>
Tue, 24 Jul 2007 01:57:11 +0000 (01:57 +0000)
committerRoland McGrath <roland@redhat.com>
Tue, 24 Jul 2007 01:57:11 +0000 (01:57 +0000)
* 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.

defs.h
desc.c
file.c
linux/syscall.h
linux/syscallent.h
linux/x86_64/syscallent.h
time.c

diff --git a/defs.h b/defs.h
index 7f9af82c5fa02ac052672f3e72c639bdc9f051b7..99f496cedefd700c4f9305abb42e9c420527bdc8 100644 (file)
--- 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 caa7ccfc45734240e5cdcde24010fb81ebd29054..31af6c1949efe29a94d4bc77687b51330fe370ad 100644 (file)
--- 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 7c17063ff40d1289b2c5805889c825bdec07db17..5eb67657693768d43c2afa22eff7b3692802f8b3 100644 (file)
--- 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
 
index dbb7a847c56035f78f245e35d49337be801b379f..1922ee01fa12297f623d7519d3cde5d8622351ec 100644 (file)
@@ -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 */
 
index df1f607ec766b34c89ce1bb422ac53bad20ba691..581f5b6534ee8de6093a8d9947f1a0002de9b1b4 100644 (file)
        { 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 */
index 83dad868e73724c232778d4c5bb5e2462dae2d8d..fb68ec30b57f0ee400b81339226bb2633ba178e3 100644 (file)
        { 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 3d2f6c99c7b684889e596d3af72e8e809896738d..b4c6acf2abbcfecfb033953a3db232ab711dc60b 100644 (file)
--- a/time.c
+++ b/time.c
 #include <sys/timex.h>
 #include <linux/ioctl.h>
 #include <linux/rtc.h>
+
+#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;