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