From owner-svn-src-all@FreeBSD.ORG Mon Feb 8 15:53:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B92B1065672; Mon, 8 Feb 2010 15:53:28 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B0788FC33; Mon, 8 Feb 2010 15:53:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o18FrSf1087671; Mon, 8 Feb 2010 15:53:28 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o18FrSMk087667; Mon, 8 Feb 2010 15:53:28 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201002081553.o18FrSMk087667@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 8 Feb 2010 15:53:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203668 - stable/8/usr.bin/truss X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Feb 2010 15:53:28 -0000 Author: jh Date: Mon Feb 8 15:53:28 2010 New Revision: 203668 URL: http://svn.freebsd.org/changeset/base/203668 Log: 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 Modified: stable/8/usr.bin/truss/amd64-fbsd32.c stable/8/usr.bin/truss/i386-fbsd.c stable/8/usr.bin/truss/syscalls.c Directory Properties: stable/8/usr.bin/truss/ (props changed) Modified: stable/8/usr.bin/truss/amd64-fbsd32.c ============================================================================== --- stable/8/usr.bin/truss/amd64-fbsd32.c Mon Feb 8 15:50:51 2010 (r203667) +++ stable/8/usr.bin/truss/amd64-fbsd32.c Mon Feb 8 15:53:28 2010 (r203668) @@ -315,19 +315,6 @@ amd64_fbsd32_syscall_exit(struct trussin } } - /* - * 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; Modified: stable/8/usr.bin/truss/i386-fbsd.c ============================================================================== --- stable/8/usr.bin/truss/i386-fbsd.c Mon Feb 8 15:50:51 2010 (r203667) +++ stable/8/usr.bin/truss/i386-fbsd.c Mon Feb 8 15:53:28 2010 (r203668) @@ -305,19 +305,6 @@ i386_syscall_exit(struct trussinfo *trus } } - /* - * 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; Modified: stable/8/usr.bin/truss/syscalls.c ============================================================================== --- stable/8/usr.bin/truss/syscalls.c Mon Feb 8 15:50:51 2010 (r203667) +++ stable/8/usr.bin/truss/syscalls.c Mon Feb 8 15:53:28 2010 (r203668) @@ -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 *trus 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); } }