Remove UNDEFINED_SCNO

Since UNDEFINED_SCNO is set if and only if !SCNO_IS_VALID
and since tcp->s_ent can only be set to &sysent[tcp->scno]
(or to &unknown, but only when !SCNO_IS_VALID), there is no need
to check for UNDEFINED_SCNO before calling syscall_name(tcp->scno).

* defs.h (UNDEFINED_SCNO): Remove.
* syscall.c (get_scno, trace_syscall_entering, trace_syscall_exiting):
Remove checks for UNDEFINED_SCNO.
This commit is contained in:
Elvira Khabirova 2016-06-12 19:11:43 +03:00 committed by Dmitry V. Levin
parent 21e3ff8d46
commit ed37c8d64b
2 changed files with 4 additions and 13 deletions

1
defs.h
View File

@ -356,7 +356,6 @@ struct tcb {
#define QUAL_READ 0x020 /* dump data read on this file descriptor */
#define QUAL_WRITE 0x040 /* dump data written to this file descriptor */
typedef uint8_t qualbits_t;
#define UNDEFINED_SCNO 0x100 /* Used only in tcp->qual_flg */
#define DEFAULT_QUAL_FLAGS (QUAL_TRACE | QUAL_ABBREV | QUAL_VERBOSE)

View File

@ -770,10 +770,8 @@ trace_syscall_entering(struct tcb *tcp)
printleader(tcp);
if (scno_good != 1)
tprints("????" /* anti-trigraph gap */ "(");
else if (tcp->qual_flg & UNDEFINED_SCNO)
tprintf("%s(", syscall_name(tcp->scno));
else
tprintf("%s(", tcp->s_ent->sys_name);
tprintf("%s(", syscall_name(tcp->scno));
/*
* " <unavailable>" will be added later by the code which
* detects ptrace errors.
@ -832,10 +830,7 @@ trace_syscall_entering(struct tcb *tcp)
#endif
printleader(tcp);
if (tcp->qual_flg & UNDEFINED_SCNO)
tprintf("%s(", syscall_name(tcp->scno));
else
tprintf("%s(", tcp->s_ent->sys_name);
tprintf("%s(", syscall_name(tcp->scno));
if ((tcp->qual_flg & QUAL_RAW) && SEN_exit != tcp->s_ent->sen)
res = printargs(tcp);
else
@ -896,10 +891,7 @@ trace_syscall_exiting(struct tcb *tcp)
if ((followfork < 2 && printing_tcp != tcp) || (tcp->flags & TCB_REPRINT)) {
tcp->flags &= ~TCB_REPRINT;
printleader(tcp);
if (tcp->qual_flg & UNDEFINED_SCNO)
tprintf("<... %s resumed> ", syscall_name(tcp->scno));
else
tprintf("<... %s resumed> ", tcp->s_ent->sys_name);
tprintf("<... %s resumed> ", syscall_name(tcp->scno));
}
printing_tcp = tcp;
@ -1291,7 +1283,7 @@ get_scno(struct tcb *tcp)
.sys_name = "system call",
};
tcp->s_ent = &unknown;
tcp->qual_flg = UNDEFINED_SCNO | QUAL_RAW | DEFAULT_QUAL_FLAGS;
tcp->qual_flg = QUAL_RAW | DEFAULT_QUAL_FLAGS;
if (debug_flag)
error_msg("pid %d invalid syscall %ld", tcp->pid, tcp->scno);
}