diff options
author | jh <jh@FreeBSD.org> | 2010-02-08 15:53:28 +0000 |
---|---|---|
committer | jh <jh@FreeBSD.org> | 2010-02-08 15:53:28 +0000 |
commit | 6cbfef4ad32ce22bc05fb86fbdb1c59429986ffb (patch) | |
tree | eb47e12b09ec4f72b9a4db2a34ddf9cd18ecd417 /usr.bin/truss | |
parent | 000376f24e6eac64c54f0693ac3b6730c0e446b9 (diff) | |
download | FreeBSD-src-6cbfef4ad32ce22bc05fb86fbdb1c59429986ffb.zip FreeBSD-src-6cbfef4ad32ce22bc05fb86fbdb1c59429986ffb.tar.gz |
MFC r200780:
Remove non-working special case for pipe(2) from amd64-fbsd32.c and
i386-fbsd.c. Add pipe(2) to syscall table to decode it's pointer
argument properly and re-add special handling for pipe(2) return value
to print_syscall_ret().
PR: bin/120870
Diffstat (limited to 'usr.bin/truss')
-rw-r--r-- | usr.bin/truss/amd64-fbsd32.c | 13 | ||||
-rw-r--r-- | usr.bin/truss/i386-fbsd.c | 13 | ||||
-rw-r--r-- | usr.bin/truss/syscalls.c | 8 |
3 files changed, 8 insertions, 26 deletions
diff --git a/usr.bin/truss/amd64-fbsd32.c b/usr.bin/truss/amd64-fbsd32.c index eab841c..3b1b882 100644 --- a/usr.bin/truss/amd64-fbsd32.c +++ b/usr.bin/truss/amd64-fbsd32.c @@ -315,19 +315,6 @@ amd64_fbsd32_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) } } - /* - * The pipe syscall returns its fds in two registers and has assembly glue - * to provide the libc API, so it cannot be handled like regular syscalls. - * The nargs check is so we don't have to do yet another strcmp on every - * syscall. - */ - if (!errorp && fsc.nargs == 0 && fsc.name && strcmp(fsc.name, "pipe") == 0) { - fsc.nargs = 1; - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - asprintf(&fsc.s_args[0], "[%d,%d]", (int)retval, (int)regs.r_rdx); - retval = 0; - } - if (fsc.name != NULL && (!strcmp(fsc.name, "freebsd32_execve") || !strcmp(fsc.name, "exit"))) { trussinfo->curthread->in_syscall = 1; diff --git a/usr.bin/truss/i386-fbsd.c b/usr.bin/truss/i386-fbsd.c index 8500f32..3a81392 100644 --- a/usr.bin/truss/i386-fbsd.c +++ b/usr.bin/truss/i386-fbsd.c @@ -305,19 +305,6 @@ i386_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) } } - /* - * The pipe syscall returns its fds in two registers and has assembly glue - * to provide the libc API, so it cannot be handled like regular syscalls. - * The nargs check is so we don't have to do yet another strcmp on every - * syscall. - */ - if (!errorp && fsc.nargs == 0 && fsc.name && strcmp(fsc.name, "pipe") == 0) { - fsc.nargs = 1; - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - asprintf(&fsc.s_args[0], "[%d,%d]", (int)retval, regs.r_edx); - retval = 0; - } - if (fsc.name != NULL && (!strcmp(fsc.name, "execve") || !strcmp(fsc.name, "exit"))) { trussinfo->curthread->in_syscall = 1; diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index f514649..6541d9a 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -242,6 +242,8 @@ struct syscall syscalls[] = { .args = { { Name | IN, 0 }, { Hex, 1 } } }, { .name = "pathconf", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Pathconf, 1 } } }, + { .name = "pipe", .ret_type = 1, .nargs = 1, + .args = { { Ptr, 0 } } }, { .name = "truncate", .ret_type = 1, .nargs = 3, .args = { { Name | IN, 0 }, { Int | IN, 1 }, { Quad | IN, 2 } } }, { .name = "ftruncate", .ret_type = 1, .nargs = 3, @@ -1137,6 +1139,12 @@ print_syscall_ret(struct trussinfo *trussinfo, const char *name, int nargs, if (errorp) { fprintf(trussinfo->outfile, " ERR#%ld '%s'\n", retval, strerror(retval)); } else { + /* + * Because pipe(2) has a special assembly glue to provide the + * libc API, we have to adjust retval. + */ + if (name != NULL && !strcmp(name, "pipe")) + retval = 0; fprintf(trussinfo->outfile, " = %ld (0x%lx)\n", retval, retval); } } |