xref: /freebsd/usr.bin/truss/truss.1 (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
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 ptrace 2 .
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.Sh EXAMPLES
83# Follow the system calls used in echoing "hello"
84.Dl $ truss /bin/echo hello
85# Do the same, but put the output into a file
86.Dl $ truss -o /tmp/truss.out /bin/echo hello
87# Follow an already-running process
88.Dl $ truss -p 1
89.Sh SEE ALSO
90.Xr kdump 1 ,
91.Xr ktrace 1 ,
92.Xr ptrace 2
93.Sh HISTORY
94The
95.Nm
96command was written by
97.An Sean Eric Fagan
98for
99.Fx .
100It was modeled after
101similar commands available for System V Release 4 and SunOS.
102