diff options
-rw-r--r-- | defs.h | 14 | ||||
-rw-r--r-- | syscall.c | 28 | ||||
-rw-r--r-- | time.c | 24 |
3 files changed, 30 insertions, 36 deletions
@@ -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); @@ -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 @@ -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; } |