Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 May 2009 22:26:49 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r191861 - stable/7/usr.bin/truss
Message-ID:  <200905062226.n46MQnGK031773@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Wed May  6 22:26:49 2009
New Revision: 191861
URL: http://svn.freebsd.org/changeset/base/191861

Log:
  MFC r191005:
  
  Don't exit until all truss children were exit.

Modified:
  stable/7/usr.bin/truss/   (props changed)
  stable/7/usr.bin/truss/main.c

Modified: stable/7/usr.bin/truss/main.c
==============================================================================
--- stable/7/usr.bin/truss/main.c	Wed May  6 22:26:04 2009	(r191860)
+++ stable/7/usr.bin/truss/main.c	Wed May  6 22:26:49 2009	(r191861)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copryight 1997 Sean Eric Fagan
  *
  * Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/sysctl.h>
+#include <sys/wait.h>
 
 #include <ctype.h>
 #include <err.h>
@@ -159,6 +160,8 @@ main(int ac, char **av)
 {
 	int c;
 	int i;
+	pid_t childpid;
+	int status;
 	char **command;
 	struct ex_types *funcs;
 	int initial_open;
@@ -283,8 +286,6 @@ START_TRACE:
 
 			if (trussinfo->curthread->in_fork &&
 			    (trussinfo->flags & FOLLOWFORKS)) {
-				int childpid;
-
 				trussinfo->curthread->in_fork = 0;
 				childpid =
 				    funcs->exit_syscall(trussinfo,
@@ -355,6 +356,11 @@ START_TRACE:
 		}
 	} while (trussinfo->pr_why != S_EXIT);
 	fflush(trussinfo->outfile);
-	
+
+	if (trussinfo->flags & FOLLOWFORKS)
+		do {
+			childpid = wait(&status);
+		} while (childpid != -1);
+
 	return (0);
 }



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