int
sys_indir(struct tcb *tcp)
{
- int i, scno, nargs;
+ int i, nargs;
+ long scno;
if (entering(tcp)) {
scno = tcp->u_arg[0];
- if (scno > nsyscalls) {
+ if (!SCNO_IN_RANGE(scno)) {
fprintf(stderr, "Bogus syscall: %u\n", scno);
return 0;
}
r2 = regs[REG_V0];
scno = r2;
- if (scno < 0 || scno > nsyscalls) {
+ if (!SCNO_IN_RANGE(scno)) {
if (a3 == 0 || a3 == -1) {
if (debug)
fprintf(stderr, "stray syscall exit: v0 = %ld\n", scno);
if (upeek(tcp, REG_V0, &scno) < 0)
return -1;
- if (scno < 0 || scno > nsyscalls) {
+ if (!SCNO_IN_RANGE(scno)) {
if (a3 == 0 || a3 == -1) {
if (debug)
fprintf(stderr, "stray syscall exit: v0 = %ld\n", scno);
* Do some sanity checks to figure out if it's
* really a syscall entry
*/
- if (scno < 0 || scno > nsyscalls) {
+ if (!SCNO_IN_RANGE(scno)) {
if (a3 == 0 || a3 == -1) {
if (debug)
fprintf(stderr, "stray syscall exit: r0 = %ld\n", scno);
{
long scno = tcp->scno;
#if SUPPORTED_PERSONALITIES > 1
- if (scno >= 0 && scno < nsyscalls && sysent[scno].native_scno != 0)
+ if (SCNO_IN_RANGE(scno) && sysent[scno].native_scno != 0)
scno = sysent[scno].native_scno;
else
#endif
*/
int (*func)();
- if (tcp->scno < 0 || tcp->scno >= nsyscalls)
+ if (!SCNO_IN_RANGE(tcp->scno))
return 0;
func = sysent[tcp->scno].sys_func;
#ifdef LINUX
int i, nargs;
- if (tcp->scno >= 0 && tcp->scno < nsyscalls)
+ if (SCNO_IN_RANGE(tcp->scno))
nargs = tcp->u_nargs = sysent[tcp->scno].nargs;
else
nargs = tcp->u_nargs = MAX_ARGS;
#endif /* LINUX */
#ifdef SUNOS4
int i, nargs;
- if (tcp->scno >= 0 && tcp->scno < nsyscalls)
+ if (SCNO_IN_RANGE(tcp->scno))
nargs = tcp->u_nargs = sysent[tcp->scno].nargs;
else
nargs = tcp->u_nargs = MAX_ARGS;
* SGI is broken: even though it has pr_sysarg, it doesn't
* set them on system call entry. Get a clue.
*/
- if (tcp->scno >= 0 && tcp->scno < nsyscalls)
+ if (SCNO_IN_RANGE(tcp->scno))
tcp->u_nargs = sysent[tcp->scno].nargs;
else
tcp->u_nargs = tcp->status.pr_nsysarg;
/*
* Like SGI, UnixWare doesn't set pr_sysarg until system call exit
*/
- if (tcp->scno >= 0 && tcp->scno < nsyscalls)
+ if (SCNO_IN_RANGE(tcp->scno))
tcp->u_nargs = sysent[tcp->scno].nargs;
else
tcp->u_nargs = tcp->status.pr_lwp.pr_nsysarg;
tcp->u_nargs * sizeof(tcp->u_arg[0]), (char *) tcp->u_arg);
# elif defined(HAVE_PR_SYSCALL)
int i;
- if (tcp->scno >= 0 && tcp->scno < nsyscalls)
+ if (SCNO_IN_RANGE(tcp->scno))
tcp->u_nargs = sysent[tcp->scno].nargs;
else
tcp->u_nargs = tcp->status.pr_nsysarg;
for (i = 0; i < tcp->u_nargs; i++)
tcp->u_arg[i] = tcp->status.pr_sysarg[i];
# elif defined(I386)
- if (tcp->scno >= 0 && tcp->scno < nsyscalls)
+ if (SCNO_IN_RANGE(tcp->scno))
tcp->u_nargs = sysent[tcp->scno].nargs;
else
tcp->u_nargs = 5;
# endif
#endif /* SVR4 */
#ifdef FREEBSD
- if (tcp->scno >= 0 && tcp->scno < nsyscalls &&
+ if (SCNO_IN_RANGE(tcp->scno) &&
sysent[tcp->scno].nargs > tcp->status.val)
tcp->u_nargs = sysent[tcp->scno].nargs;
else
tcp_last = tcp;
if (scno_good != 1)
tprintf("????" /* anti-trigraph gap */ "(");
- else if (tcp->scno >= nsyscalls || tcp->scno < 0)
+ else if (!SCNO_IN_RANGE(tcp->scno))
tprintf("syscall_%lu(", tcp->scno);
else
tprintf("%s(", sysent[tcp->scno].sys_name);
internal_syscall(tcp);
- if ((tcp->scno >= 0 && tcp->scno < nsyscalls &&
+ if ((SCNO_IN_RANGE(tcp->scno) &&
!(qual_flags[tcp->scno] & QUAL_TRACE)) ||
(tracing_paths && !pathtrace_match(tcp))) {
tcp->flags |= TCB_INSYSCALL | TCB_FILTERED;
printleader(tcp);
tcp->flags &= ~TCB_REPRINT;
tcp_last = tcp;
- if (tcp->scno >= nsyscalls || tcp->scno < 0)
+ if (!SCNO_IN_RANGE(tcp->scno))
tprintf("syscall_%lu(", tcp->scno);
else
tprintf("%s(", sysent[tcp->scno].sys_name);
- if (tcp->scno >= nsyscalls || tcp->scno < 0 ||
+ if (!SCNO_IN_RANGE(tcp->scno) ||
((qual_flags[tcp->scno] & QUAL_RAW) &&
sysent[tcp->scno].sys_func != sys_exit))
res = printargs(tcp);
int u_error = 0;
#ifdef LINUX
int check_errno = 1;
- if (tcp->scno >= 0 && tcp->scno < nsyscalls &&
+ if (SCNO_IN_RANGE(tcp->scno) &&
sysent[tcp->scno].sys_flags & SYSCALL_NEVER_FAILS) {
check_errno = 0;
}
return;
if (tcp->u_arg[0] < 0 || tcp->u_arg[0] >= MAX_QUALS)
return;
- if (tcp->scno < 0 || tcp->scno >= nsyscalls)
+ if (!SCNO_IN_RANGE(tcp->scno))
return;
if (sysent[tcp->scno].sys_func == printargs)
return;
if (tcp->flags & TCB_REPRINT) {
printleader(tcp);
- if (tcp->scno >= nsyscalls || tcp->scno < 0)
+ if (!SCNO_IN_RANGE(tcp->scno))
tprintf("<... syscall_%lu resumed> ", tcp->scno);
else
tprintf("<... %s resumed> ", sysent[tcp->scno].sys_name);
return res;
}
- if (tcp->scno >= nsyscalls || tcp->scno < 0
+ if (!SCNO_IN_RANGE(tcp->scno)
|| (qual_flags[tcp->scno] & QUAL_RAW))
sys_res = printargs(tcp);
else {
tprintf(") ");
tabto(acolumn);
u_error = tcp->u_error;
- if (tcp->scno >= nsyscalls || tcp->scno < 0 ||
+ if (!SCNO_IN_RANGE(tcp->scno) ||
qual_flags[tcp->scno] & QUAL_RAW) {
if (u_error)
tprintf("= -1 (errno %ld)", u_error);