diff --git a/defs.h b/defs.h index 6c7734ed..a06acde6 100644 --- a/defs.h +++ b/defs.h @@ -390,7 +390,7 @@ struct tcb { int flags; /* See below for TCB_ values */ int pid; /* Process Id of this entry */ long scno; /* System call number */ - int u_nargs; /* System call arguments */ + int u_nargs; /* System call argument count */ long u_arg[MAX_ARGS]; /* System call arguments */ #if defined (LINUX_MIPSN32) long long ext_arg[MAX_ARGS]; /* System call arguments */ @@ -409,17 +409,19 @@ struct tcb { /* Support for tracing forked processes */ long baddr; /* `Breakpoint' address */ long inst[2]; /* Instructions on above */ + int ptrace_errno; +#ifdef USE_PROCFS int pfd; /* proc file descriptor */ +#endif #ifdef SVR4 -#ifdef HAVE_MP_PROCFS +# ifdef HAVE_MP_PROCFS int pfd_stat; int pfd_as; pstatus_t status; -#else +# else prstatus_t status; /* procfs status structure */ +# endif #endif -#endif - int ptrace_errno; #ifdef FREEBSD struct procfs_status status; int pfd_reg; diff --git a/strace.c b/strace.c index 127275c0..7e59b083 100644 --- a/strace.c +++ b/strace.c @@ -1256,7 +1256,9 @@ alloc_tcb(int pid, int command_options_parsed) tcp->pid = pid; tcp->flags = TCB_INUSE | TCB_STARTUP; tcp->outf = outf; /* Initialise to current out file */ +#ifdef USE_PROCFS tcp->pfd = -1; +#endif nprocs++; if (debug) fprintf(stderr, "new tcb for pid %d, active tcbs:%d\n", tcp->pid, nprocs); @@ -1613,10 +1615,11 @@ droptcb(struct tcb *tcp) if (debug) fprintf(stderr, "dropped tcb for pid %d, %d remain\n", tcp->pid, nprocs); +#ifdef USE_PROCFS if (tcp->pfd != -1) { close(tcp->pfd); tcp->pfd = -1; -#ifdef FREEBSD +# ifdef FREEBSD if (tcp->pfd_reg != -1) { close(tcp->pfd_reg); tcp->pfd_reg = -1; @@ -1625,12 +1628,11 @@ droptcb(struct tcb *tcp) close(tcp->pfd_status); tcp->pfd_status = -1; } -#endif /* !FREEBSD */ -#ifdef USE_PROCFS +# endif tcp->flags = 0; /* rebuild_pollv needs it */ rebuild_pollv(); -#endif } +#endif if (outfname && followfork > 1 && tcp->outf) fclose(tcp->outf);