diff options
Diffstat (limited to 'usr.bin/truss/ia64-fbsd.c')
-rw-r--r-- | usr.bin/truss/ia64-fbsd.c | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/usr.bin/truss/ia64-fbsd.c b/usr.bin/truss/ia64-fbsd.c index e233505..471e834 100644 --- a/usr.bin/truss/ia64-fbsd.c +++ b/usr.bin/truss/ia64-fbsd.c @@ -43,8 +43,7 @@ static const char rcsid[] = */ #include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/pioctl.h> +#include <sys/ptrace.h> #include <sys/syscall.h> #include <machine/reg.h> @@ -62,7 +61,6 @@ static const char rcsid[] = #include "syscall.h" #include "extern.h" -static int fd = -1; static int cpid = -1; #include "syscalls.h" @@ -112,26 +110,16 @@ clear_fsc(void) { void ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) { - char buf[32]; struct reg regs; int syscall_num; int i; unsigned long *parm_offset; struct syscall *sc; - if (fd == -1 || trussinfo->pid != cpid) { - sprintf(buf, "/proc/%d/regs", trussinfo->pid); - fd = open(buf, O_RDWR); - if (fd == -1) { - fprintf(trussinfo->outfile, "-- CANNOT OPEN REGISTERS --\n"); - return; - } - cpid = trussinfo->pid; - } + cpid = trussinfo->curthread->tid; clear_fsc(); - lseek(fd, 0L, 0); - if (read(fd, ®s, sizeof(regs)) != sizeof(regs)) { + if (ptrace(PT_GETREGS, cpid, (caddr_t)®s, 0) < 0) { fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); return; } @@ -158,7 +146,7 @@ ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) { || !strcmp(fsc.name, "rfork") || !strcmp(fsc.name, "vfork")))) { - trussinfo->in_fork = 1; + trussinfo->curthread->in_fork = 1; } if (nargs == 0) @@ -204,7 +192,7 @@ ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) { i < (fsc.nargs - 1) ? "," : ""); #endif if (sc && !(sc->args[i].type & OUT)) { - fsc.s_args[i] = print_arg(Procfd, &sc->args[i], fsc.args, 0, trussinfo); + fsc.s_args[i] = print_arg(&sc->args[i], fsc.args, 0, trussinfo); } } #if DEBUG @@ -260,25 +248,15 @@ ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) { long ia64_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) { - char buf[32]; struct reg regs; long retval; int i; int errorp; struct syscall *sc; - if (fd == -1 || trussinfo->pid != cpid) { - sprintf(buf, "/proc/%d/regs", trussinfo->pid); - fd = open(buf, O_RDONLY); - if (fd == -1) { - fprintf(trussinfo->outfile, "-- CANNOT OPEN REGISTERS --\n"); - return (-1); - } - cpid = trussinfo->pid; - } + cpid = trussinfo->curthread->tid; - lseek(fd, 0L, 0); - if (read(fd, ®s, sizeof(regs)) != sizeof(regs)) { + if (ptrace(PT_GETREGS, cpid, (caddr_t)®s, 0) < 0) { fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); return (-1); } @@ -309,7 +287,7 @@ ia64_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) if (errorp) asprintf(&temp, "0x%lx", fsc.args[sc->args[i].offset]); else - temp = print_arg(Procfd, &sc->args[i], fsc.args, retval, trussinfo); + temp = print_arg(&sc->args[i], fsc.args, retval, trussinfo); fsc.s_args[i] = temp; } } |