summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--defs.h14
-rw-r--r--syscall.c28
-rw-r--r--time.c24
3 files changed, 30 insertions, 36 deletions
diff --git a/defs.h b/defs.h
index 56467ff..3b027e8 100644
--- a/defs.h
+++ b/defs.h
@@ -174,6 +174,19 @@ extern long ptrace(int, int, char *, long);
# include <asm/ptrace.h> /* struct pt_regs */
#endif
+#ifndef ERESTARTSYS
+# define ERESTARTSYS 512
+#endif
+#ifndef ERESTARTNOINTR
+# define ERESTARTNOINTR 513
+#endif
+#ifndef ERESTARTNOHAND
+# define ERESTARTNOHAND 514
+#endif
+#ifndef ERESTART_RESTARTBLOCK
+# define ERESTART_RESTARTBLOCK 516
+#endif
+
#if !HAVE_DECL_PTRACE_SETOPTIONS
# define PTRACE_SETOPTIONS 0x4200
#endif
@@ -621,7 +634,6 @@ extern int setbpt(struct tcb *);
extern int clearbpt(struct tcb *);
extern const char *signame(int);
-extern int is_restart_error(struct tcb *);
extern void pathtrace_select(const char *);
extern int pathtrace_match(struct tcb *);
extern int getfdpath(struct tcb *, int, char *, unsigned);
diff --git a/syscall.c b/syscall.c
index 8220906..105b28c 100644
--- a/syscall.c
+++ b/syscall.c
@@ -80,19 +80,6 @@
# include <asm/ptrace.h>
#endif
-#ifndef ERESTARTSYS
-# define ERESTARTSYS 512
-#endif
-#ifndef ERESTARTNOINTR
-# define ERESTARTNOINTR 513
-#endif
-#ifndef ERESTARTNOHAND
-# define ERESTARTNOHAND 514 /* restart if no handler */
-#endif
-#ifndef ERESTART_RESTARTBLOCK
-# define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */
-#endif
-
#ifndef NSIG
# warning: NSIG is not defined, using 32
# define NSIG 32
@@ -694,21 +681,6 @@ getrval2(struct tcb *tcp)
}
#endif
-int
-is_restart_error(struct tcb *tcp)
-{
- switch (tcp->u_error) {
- case ERESTARTSYS:
- case ERESTARTNOINTR:
- case ERESTARTNOHAND:
- case ERESTART_RESTARTBLOCK:
- return 1;
- default:
- break;
- }
- return 0;
-}
-
#if defined(I386)
struct user_regs_struct i386_regs;
# define ARCH_REGS_FOR_GETREGSET i386_regs
diff --git a/time.c b/time.c
index e457a5f..49ebcea 100644
--- a/time.c
+++ b/time.c
@@ -256,15 +256,25 @@ sys_nanosleep(struct tcb *tcp)
tprints(", ");
} else {
/* Second (returned) timespec is only significant
- * if syscall was interrupted. We print only its address
- * on _success_, since kernel doesn't modify its value.
+ * 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.
*/
- if (is_restart_error(tcp) || !tcp->u_arg[1])
- /* Interrupted (or NULL) */
+ 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 */
print_timespec(tcp, tcp->u_arg[1]);
- else
- /* Success */
- tprintf("%#lx", tcp->u_arg[1]);
+ }
}
return 0;
}