Date: Mon, 13 Apr 2009 16:23:32 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r191005 - head/usr.bin/truss Message-ID: <200904131623.n3DGNWNh077031@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Mon Apr 13 16:23:32 2009 New Revision: 191005 URL: http://svn.freebsd.org/changeset/base/191005 Log: Don't exit until all truss children were exit. Modified: head/usr.bin/truss/main.c Modified: head/usr.bin/truss/main.c ============================================================================== --- head/usr.bin/truss/main.c Mon Apr 13 16:22:38 2009 (r191004) +++ head/usr.bin/truss/main.c Mon Apr 13 16:23:32 2009 (r191005) @@ -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> @@ -164,6 +165,8 @@ main(int ac, char **av) { int c; int i; + pid_t childpid; + int status; char **command; struct ex_types *funcs; int initial_open; @@ -288,8 +291,6 @@ START_TRACE: if (trussinfo->curthread->in_fork && (trussinfo->flags & FOLLOWFORKS)) { - int childpid; - trussinfo->curthread->in_fork = 0; childpid = funcs->exit_syscall(trussinfo, @@ -360,6 +361,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?200904131623.n3DGNWNh077031>