Re: truss issue

From: John-Mark Gurney <gurney_j_at_efn.org>
Date: Mon, 15 Dec 2003 18:13:19 -0800
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."
Received on Mon Dec 15 2003 - 17:13:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:34 UTC