Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jun 2003 23:40:34 +0900
From:      Alexander Nedotsukov <bland@mail.ru>
To:        current@freebsd.org
Subject:   truss issue
Message-ID:  <3EEDD6E2.6040505@mail.ru>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------090702080803070800000203
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

All,

I found current truss behaviour a bit strange. It coredumps always if 
trussed process do without any significant reason for my understanding. 
I also confused with comment for commit originally introduced this 
functionality 
http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/truss/main.c.diff?r1=1.9&r2=1.10. 
I propose patch attached to make truss always return result of trussed 
process and do not kill() itself. What do you think about it?

All the best,
Alexander.


--------------090702080803070800000203
Content-Type: text/plain;
 name="truss.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="truss.patch"

--- usr.bin/truss/main.c.orig	Mon Jun 16 23:00:35 2003
+++ usr.bin/truss/main.c	Mon Jun 16 23:05:03 2003
@@ -144,7 +144,7 @@
   struct ex_types *funcs;
   int in_exec = 0;
   char *fname = NULL;
-  int sigexit = 0;
+  int rval = 0;
   struct trussinfo *trussinfo;
 
   /* Initialize the trussinfo struct */
@@ -283,10 +283,10 @@
 	break;
       case S_SIG:
 	fprintf(trussinfo->outfile, "SIGNAL %lu\n", pfs.val);
-	sigexit = pfs.val;
 	break;
       case S_EXIT:
 	fprintf (trussinfo->outfile, "process exit, rval = %lu\n", pfs.val);
+	rval = pfs.val;
 	break;
       case S_EXEC:
 	funcs = set_etype(trussinfo);
@@ -305,11 +305,5 @@
     }
   } while (pfs.why != S_EXIT);
   fflush(trussinfo->outfile);
-  if (sigexit) {
-    if (sigexit == SIGQUIT)
-      exit(sigexit);
-    (void) signal(sigexit, SIG_DFL);
-    (void) kill(getpid(), sigexit);
-  }
-  return 0;
+  return rval;
 }

--------------090702080803070800000203--



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