Date: Mon, 15 Dec 2003 13:28:50 -0800 (PST) From: Don Lewis <truckman@FreeBSD.org> To: cracauer@cons.org Cc: bland@mail.ru Subject: Re: truss issue Message-ID: <200312152128.hBFLSoeF068231@gw.catspoiler.org> In-Reply-To: <20031215161928.A68001@cons.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 15 Dec, Martin Cracauer wrote: > Don Lewis wrote on Mon, Dec 15, 2003 at 01:13:58PM -0800: >> Hmn, I wonder if it would be cleaner to exec() the executable to be >> traced in the parent process and run truss in the child ... > > 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 ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200312152128.hBFLSoeF068231>