Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Feb 2008 12:20:03 GMT
From:      Jaakko Heinonen <jh@saunalahti.fi>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/120870: truss(1) shows 'pipe' system call as having 6 arguments when it only has one
Message-ID:  <200802231220.m1NCK3p2091037@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/120870; it has been noted by GNATS.

From: Jaakko Heinonen <jh@saunalahti.fi>
To: bug-followup@FreeBSD.org, yuri@tsoft.com
Cc: alfred@FreeBSD.org
Subject: Re: bin/120870: truss(1) shows 'pipe' system call as having 6
	arguments when it only has one
Date: Sat, 23 Feb 2008 14:12:23 +0200

 --BOKacYhQ+x31HxR3
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 
 Hi,
 
 The following patch fixes truss output for geteuid, getpid, getuid and
 pipe system calls for me. (Tested on i386 only.) The pipe case probably
 needs a better fix because the special case is handled only in
 i386-fbsd.c.
 
 (alfred@ cc'd because you are listed in src/MAINTAINERS for truss.)
 
 -- 
 Jaakko
 
 --BOKacYhQ+x31HxR3
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="truss-arguments.diff"
 
 Index: i386-fbsd.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/truss/i386-fbsd.c,v
 retrieving revision 1.29
 diff -u -r1.29 i386-fbsd.c
 --- i386-fbsd.c	28 Jul 2007 23:15:04 -0000	1.29
 +++ i386-fbsd.c	23 Feb 2008 12:05:34 -0000
 @@ -309,10 +309,8 @@
    /*
     * 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) {
 +  if (!errorp && 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);
 Index: syscalls.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/truss/syscalls.c,v
 retrieving revision 1.56
 diff -u -r1.56 syscalls.c
 --- syscalls.c	3 Jan 2008 00:18:03 -0000	1.56
 +++ syscalls.c	23 Feb 2008 12:05:35 -0000
 @@ -93,6 +93,12 @@
  struct syscall syscalls[] = {
  	{ "fcntl", 1, 3,
  	  { { Int, 0 } , { Fcntl, 1 }, { Fcntlflag | OUT, 2 }}},
 +	{ "geteuid", 1, 0,
 +	  { { None, 0 }}},
 +	{ "getpid", 1, 0,
 +	  { { None, 0 }}},
 +	{ "getuid", 1, 0,
 +	  { { None, 0 }}},
  	{ "readlink", 1, 3,
  	  { { Name, 0 } , { Readlinkres | OUT, 1 }, { Int, 2 }}},
  	{ "lseek", 2, 3,
 
 --BOKacYhQ+x31HxR3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802231220.m1NCK3p2091037>