2008-04-19  Dmitry V. Levin <[EMAIL PROTECTED]>

        * syscall.c (is_restart_error): New function.
        * defs.h (is_restart_error): Declare it.

        * linux/dummy.h (sys_nanosleep): Uncouple from sys_adjtime.
        * time.c (sys_nanosleep): New function, based on is_restart_error.
---
 strace/defs.h        |    1 +
 strace/linux/dummy.h |    1 -
 strace/syscall.c     |   19 +++++++++++++++++++
 strace/time.c        |   15 +++++++++++++++
 4 files changed, 35 insertions(+), 1 deletions(-)

--- a/strace/defs.h
+++ b/strace/defs.h
@@ -503,6 +503,7 @@ extern void tabto P((int));
 extern void call_summary P((FILE *));
 extern void tprint_iov P((struct tcb *, unsigned long, unsigned long));
 extern void tprint_open_modes P((struct tcb *, mode_t));
+extern int is_restart_error P((struct tcb *));
 
 #ifdef LINUX
 extern int internal_clone P((struct tcb *));
--- a/strace/linux/dummy.h
+++ b/strace/linux/dummy.h
@@ -58,7 +58,6 @@
 #define        sys_fchdir              sys_close
 #define        sys_setfsuid            sys_setuid
 #define        sys_setfsgid            sys_setgid
-#define sys_nanosleep          sys_adjtime
 #define        sys_acct                sys_chdir
 #define sys_fdatasync          sys_close
 #define sys_mlock              sys_munmap
--- a/strace/syscall.c
+++ b/strace/syscall.c
@@ -2640,3 +2640,22 @@ struct tcb *tcp;
        return 0;
 }
 #endif /* SUNOS4 */
+
+int
+is_restart_error(struct tcb *tcp)
+{
+#ifdef LINUX
+       if (!syserror(tcp))
+               return 0;
+       switch (tcp->u_error) {
+               case ERESTARTSYS:
+               case ERESTARTNOINTR:
+               case ERESTARTNOHAND:
+               case ERESTART_RESTARTBLOCK:
+                       return 1;
+               default:
+                       break;
+       }
+#endif /* LINUX */
+       return 0;
+}
--- a/strace/time.c
+++ b/strace/time.c
@@ -329,6 +329,21 @@ struct tcb *tcp;
        return 0;
 }
 
+int
+sys_nanosleep(struct tcb *tcp)
+{
+       if (entering(tcp)) {
+               print_timespec(tcp, tcp->u_arg[0]);
+               tprintf(", ");
+       } else {
+               if (!tcp->u_arg[1] || is_restart_error(tcp))
+                       print_timespec(tcp, tcp->u_arg[1]);
+               else
+                       tprintf("%#lx", tcp->u_arg[1]);
+       }
+       return 0;
+}
+
 static const struct xlat which[] = {
        { ITIMER_REAL,  "ITIMER_REAL"   },
        { ITIMER_VIRTUAL,"ITIMER_VIRTUAL"},

-- 
ldv

Attachment: pgpATypqNhdTZ.pgp
Description: PGP signature

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to