Sohail Somani <firstname.lastname@example.org> wrote:
| Andreas Davour wrote:
| >> I would use strace to determine all the files slime is reading.
| > What do "strace" do? I don't seems to have a strace in the base
| > FreeBSD system.
| strace might be only on Linux. It is a program that lists all the
| system calls a program makes.
FreeBSD has "truss(1)" rather than "strace(1)". The man page says it
"was modeled after similar commands available for System V Release 4
and SunOS." Compare with the man page for Linux "strace", which says:
The original strace was written by Paul Kranenburg for SunOS
and was inspired by its trace utility. ... In 1993, Rick Sladkey
merged strace 2.5 for SunOS and the second release of strace
for Linux, added many of the features of truss(1) from SVR4,
and produced an strace that worked on both platforms. ...
In 1995 he ported strace to Irix...
[Note that SGI's Irix already had a native "truss/strace" equivalent,
"par(1)". See <http://faqs.org/faqs/sgi/faq/apps/section-19.html>.]
Anyway, they all do the same very useful thing -- trace system
calls and/or signals. Try "truss /bin/echo hello" and you'll be
stunned at how much goes on for such a trivial command! ;-}
Truss/strace can be run on a program that's already running by
specifying a PID instead of a command to run, which is convenient
when you don't have easy control of what started the program being
FreeBSD also has "ktrace(1)", which traces one or more processes
from the kernel's point of view, recording a slightly different set
of events -- "system calls, namei translations, signal processing,
and I/O". "Ktrace(1)" can also be told to trace current and/or future
children of a process, or even all processes in a process group.
This can be useful when tracing server processes. However, note
that "ktrace(1)" output is logged to a file, *not* printed to the
terminal, and that "The trace file is not human readable; use kdump(1)
to decode it."
Rob Warnock <email@example.com>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607