From owner-freebsd-current@FreeBSD.ORG Mon Dec 15 18:13:26 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 50F9A16A4CF for ; Mon, 15 Dec 2003 18:13:26 -0800 (PST) Received: from mail1.speakeasy.net (mail1.speakeasy.net [216.254.0.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 248AF43D46 for ; Mon, 15 Dec 2003 18:13:22 -0800 (PST) (envelope-from jmg@hydrogen.funkthat.com) Received: (qmail 15913 invoked from network); 16 Dec 2003 02:13:21 -0000 Received: from dsl017-045-168.spk4.dsl.speakeasy.net (HELO hydrogen.funkthat.com) ([69.17.45.168]) (envelope-sender ) by mail1.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 16 Dec 2003 02:13:21 -0000 Received: from hydrogen.funkthat.com (ytmlif@localhost.funkthat.com [127.0.0.1])hBG2DKgP032005; Mon, 15 Dec 2003 18:13:20 -0800 (PST) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.12.10/8.12.10/Submit) id hBG2DJto032004; Mon, 15 Dec 2003 18:13:19 -0800 (PST) Date: Mon, 15 Dec 2003 18:13:19 -0800 From: John-Mark Gurney To: Don Lewis Message-ID: <20031216021319.GB25767@funkthat.com> Mail-Followup-To: Don Lewis , cracauer@cons.org, cracauer@freebsd.org, current@freebsd.org, bland@mail.ru References: <20031215161928.A68001@cons.org> <200312152128.hBFLSoeF068231@gw.catspoiler.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200312152128.hBFLSoeF068231@gw.catspoiler.org> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.2-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html cc: cracauer@freebsd.org cc: cracauer@cons.org cc: current@freebsd.org cc: bland@mail.ru Subject: Re: truss issue X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: John-Mark Gurney List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2003 02:13:26 -0000 Don Lewis wrote this message on Mon, Dec 15, 2003 at 13:28 -0800: > > I think I misunderstand. The parent is usually your login shell, you > > don't want that one to exec() anything. > > If you type "truss foo" at the shell prompt, the shell will fork and > exec truss, which forks and execs foo. When truss forks, the child > process is the one that execs foo, and the parent process watches what > the child process does. My suggestion is to swap the roles of the > parent and child truss processes. The parent truss process would be the > one that calls exec(), and the child process would be the one doing the > monitoring. When the process being traced exits, the shell would > automagically get the correct exit status. > > There are probably some complications that I'm overlooking, but ... The one major problem is that when the parent (or foo) exits, the child will continue to spew junk on the terminal. This may/will break std* redirection along with other races such as when using -o as the file may not be stable immediately after. In such a case something like: truss -o bar foo cp bar last.run could end up with incorrect/stale data in it. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."