xref: /freebsd/usr.bin/truss/truss.1 (revision 6af83ee0d2941d18880b6aaa2b4facd1d30c6106)
1.\" $FreeBSD$
2.\"
3.Dd September 3, 2004
4.Dt TRUSS 1
5.Os
6.Sh NAME
7.Nm truss
8.Nd trace system calls
9.Sh SYNOPSIS
10.Nm
11.Op Fl faedDS
12.Op Fl o Ar file
13.Fl p Ar pid
14.Nm
15.Op Fl faedDS
16.Op Fl o Ar file
17command
18.Op args
19.Sh DESCRIPTION
20The
21.Nm
22utility traces the system calls called by the specified process or program.
23Output is to the specified output file, or standard error by default.
24It does this by stopping and restarting the process being monitored via
25.Xr procfs 5 .
26.Pp
27The options are as follows:
28.Bl -tag -width indent
29.It Fl f
30Trace decendants of the original traced process created by
31.Xr fork 2 ,
32.Xr vfork 2 ,
33etc.
34.It Fl a
35Show the argument strings that are passed in each
36.Xr execve 2
37system call.
38.It Fl e
39Show the environment strings that are passed in each
40.Xr execve 2
41system call.
42.It Fl d
43Include timestamps in the output showing the time elapsed
44since the trace was started.
45.It Fl D
46Include timestamps in the output showing the time elapsed
47since the last recorded event.
48.It Fl S
49Do not display information about signals received by the process.
50(Normally,
51.Nm
52displays signal as well as system call events.)
53.It Fl o Ar file
54Print the output to the specified
55.Ar file
56instead of standard error.
57.It Fl p Ar pid
58Follow the process specified by
59.Ar pid
60instead of a new command.
61.It Ar command Op args
62Execute
63.Ar command
64and trace the system calls of it.
65(The
66.Fl p
67and
68.Ar command
69options are mutually exclusive.)
70.El
71.Pp
72The
73.Xr procctl 8
74utility can be used to clear tracepoints in a stuck process
75left behind if
76.Nm
77terminates abnormally.
78.Sh EXAMPLES
79# Follow the system calls used in echoing "hello"
80.Dl $ truss /bin/echo hello
81# Do the same, but put the output into a file
82.Dl $ truss -o /tmp/truss.out /bin/echo hello
83# Follow an already-running process
84.Dl $ truss -p 1
85.Sh SEE ALSO
86.Xr kdump 1 ,
87.Xr ktrace 1 ,
88.Xr procfs 5 ,
89.Xr procctl 8
90.Sh HISTORY
91The
92.Nm
93command was written by
94.An Sean Eric Fagan
95for
96.Fx .
97It was modeled after
98similar commands available for System V Release 4 and SunOS.
99