Fold is_restart_error() into its sole user

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
Denys Vlasenko 2013-06-30 23:53:49 +02:00
parent 254b5a7a97
commit 4793221a53
3 changed files with 30 additions and 36 deletions

14
defs.h
View File

@ -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);

View File

@ -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

24
time.c
View File

@ -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;
}