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