Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Feb 2000 10:53:57 -0500
From:      Jim C <jconner@enterit.com>
To:        Roman Shterenzon <roman@xpert.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: truss
Message-ID:  <4.2.0.58.20000224104248.00a84dc0@mail.enterit.com>
In-Reply-To: <Pine.GSO.4.21.0002241707530.25545-100000@sun262.hai.iec.co .il>

next in thread | previous in thread | raw e-mail | index | archive | help
I will take a stab at this:

AFAIK there are a lot of programs that start children processes and the 
parent dies (or goes bg - not sure how to splain that one, lucy).  Truss 
won't follow this and won't give you a good trace of the program being 
executed unless you tell it to follow the child processes.

My best example of this is the Channel Services Bot for Othernet.  If you 
edit $SOURCE_ROOT/bot.c there is some code:

if (fork()) exit(0);
load_cfg();
.
.
.

To my knowledge this is forking (or executing) a child process.  If you 
were to leave this piece of code here and compile the program, then truss 
it, you would only see the truss to this point of the execution and then 
truss would exit (exit(0)) (which needless to say this is toward the 
beginning of the execution of this program).

So, in short, -f allows you to follow the fork.

I know this isn't the greatest explanation.  I am not a full blown 
programmer or anything.  I tinker.  But I hope this helps a little 
bit.  Anyone interested in correcting me (I know there is some correction 
that needs to be made) please correct me.  I need to learn as much as I can.

At 17.09 24.02.00 +0200, you wrote:
>I miss the -f functionality in freebsd truss..
>
>      -f             Follow all  children  created  by  fork()  or
>                     vfork()  and  include  their signals, faults,
>                     and system calls in the trace  output.   Nor-
>                     mally,  only  the first-level command or pro-
>                     cess is traced.  When -f  is  specified,  the
>                     process-id  is  included  with  each  line of
>                     trace output to indicate which  process  exe-
>                     cuted the system call or received the signal.
>
>
>--Roman Shterenzon, UNIX System Administrator and Consultant
>[ Xpert UNIX Systems Ltd., Herzlia, Israel. Tel: +972-9-9522361 ]
>
>
>
>To Unsubscribe: send mail to majordomo@FreeBSD.org
>with "unsubscribe freebsd-questions" in the body of the message



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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