truss issue

Alexander Nedotsukov bland at mail.ru
Mon Jun 16 07:40:37 PDT 2003


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.

-------------- next part --------------
--- 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;
 }


More information about the freebsd-current mailing list