Tue Apr 14 13:36:26 2015 UTC ()
Pull up following revision(s) (requested by riastradh in ticket #1276):
	usr.bin/ktrace/ktrace.1: revision 1.43
Omit no longer existing l, m from default trace points.


(msaitoh)
diff -r1.42 -r1.42.4.1 src/usr.bin/ktrace/ktrace.1

cvs diff -r1.42 -r1.42.4.1 src/usr.bin/ktrace/ktrace.1 (switch to unified diff)

--- src/usr.bin/ktrace/ktrace.1 2011/06/01 22:17:43 1.42
+++ src/usr.bin/ktrace/ktrace.1 2015/04/14 13:36:26 1.42.4.1
@@ -1,281 +1,281 @@ @@ -1,281 +1,281 @@
1.\" $NetBSD: ktrace.1,v 1.42 2011/06/01 22:17:43 wiz Exp $ 1.\" $NetBSD: ktrace.1,v 1.42.4.1 2015/04/14 13:36:26 msaitoh Exp $
2.\" 2.\"
3.\" Copyright (c) 1990, 1993 3.\" Copyright (c) 1990, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
5.\" 5.\"
6.\" Redistribution and use in source and binary forms, with or without 6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions 7.\" modification, are permitted provided that the following conditions
8.\" are met: 8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright 9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer. 10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the 12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution. 13.\" documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors 14.\" 3. Neither the name of the University nor the names of its contributors
15.\" may be used to endorse or promote products derived from this software 15.\" may be used to endorse or promote products derived from this software
16.\" without specific prior written permission. 16.\" without specific prior written permission.
17.\" 17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE. 28.\" SUCH DAMAGE.
29.\" 29.\"
30.\" @(#)ktrace.1 8.1 (Berkeley) 6/6/93 30.\" @(#)ktrace.1 8.1 (Berkeley) 6/6/93
31.\" 31.\"
32.Dd June 1, 2011 32.Dd January 8, 2015
33.Dt KTRACE 1 33.Dt KTRACE 1
34.Os 34.Os
35.Sh NAME 35.Sh NAME
36.Nm ktrace , ktruss 36.Nm ktrace , ktruss
37.Nd enable kernel process tracing 37.Nd enable kernel process tracing
38.Sh SYNOPSIS 38.Sh SYNOPSIS
39.Nm 39.Nm
40.Op Fl aCcdins 40.Op Fl aCcdins
41.Op Fl f Ar trfile 41.Op Fl f Ar trfile
42.Op Fl g Ar pgrp 42.Op Fl g Ar pgrp
43.Op Fl p Ar pid 43.Op Fl p Ar pid
44.Op Fl t Ar trstr 44.Op Fl t Ar trstr
45.Nm 45.Nm
46.Op Fl adis 46.Op Fl adis
47.Op Fl f Ar trfile 47.Op Fl f Ar trfile
48.Op Fl t Ar trstr 48.Op Fl t Ar trstr
49.Ar command 49.Ar command
50.Nm ktruss 50.Nm ktruss
51.Op Fl aCcdilnRT 51.Op Fl aCcdilnRT
52.Op Fl e Ar emulation 52.Op Fl e Ar emulation
53.Op Fl f Ar infile 53.Op Fl f Ar infile
54.Op Fl g Ar pgrp 54.Op Fl g Ar pgrp
55.Op Fl m Ar maxdata 55.Op Fl m Ar maxdata
56.Op Fl o Ar outfile 56.Op Fl o Ar outfile
57.Op Fl p Ar pid 57.Op Fl p Ar pid
58.Op Fl t Ar trstr 58.Op Fl t Ar trstr
59.Nm ktruss 59.Nm ktruss
60.Op Fl adinRT 60.Op Fl adinRT
61.Op Fl e Ar emulation 61.Op Fl e Ar emulation
62.Op Fl m Ar maxdata 62.Op Fl m Ar maxdata
63.Op Fl o Ar outfile 63.Op Fl o Ar outfile
64.Op Fl t Ar trstr 64.Op Fl t Ar trstr
65.Op Fl v Ar vers 65.Op Fl v Ar vers
66command 66command
67.Sh DESCRIPTION 67.Sh DESCRIPTION
68.Nm 68.Nm
69enables kernel trace logging for the specified processes. 69enables kernel trace logging for the specified processes.
70Kernel trace data is logged to the file 70Kernel trace data is logged to the file
71.Pa ktrace.out . 71.Pa ktrace.out .
72The kernel operations that are traced include system calls, namei 72The kernel operations that are traced include system calls, namei
73translations, signal processing, and 73translations, signal processing, and
74.Tn I/O . 74.Tn I/O .
75.Pp 75.Pp
76Once tracing is enabled on a process, trace data will be logged until 76Once tracing is enabled on a process, trace data will be logged until
77either the process exits or the trace point is cleared. 77either the process exits or the trace point is cleared.
78A traced process can generate enormous amounts of log data quickly; 78A traced process can generate enormous amounts of log data quickly;
79It is strongly suggested that users memorize how to disable tracing before 79It is strongly suggested that users memorize how to disable tracing before
80attempting to trace a process. 80attempting to trace a process.
81The following command is sufficient to disable tracing on all user owned 81The following command is sufficient to disable tracing on all user owned
82processes, and, if executed by root, all processes: 82processes, and, if executed by root, all processes:
83.Pp 83.Pp
84.Dl \&$ ktrace -C 84.Dl \&$ ktrace -C
85.Pp 85.Pp
86The trace file is not human readable; use 86The trace file is not human readable; use
87.Xr kdump 1 87.Xr kdump 1
88to decode it. 88to decode it.
89.Pp 89.Pp
90.Nm ktruss 90.Nm ktruss
91is functionally the same as 91is functionally the same as
92.Nm ktrace 92.Nm ktrace
93except that trace output is printed 93except that trace output is printed
94on standard output or to the file specified with the 94on standard output or to the file specified with the
95.Fl o 95.Fl o
96option. 96option.
97.Nm ktruss 97.Nm ktruss
98is useful to see the kernel operations interleaved with 98is useful to see the kernel operations interleaved with
99the program output. 99the program output.
100.Pp 100.Pp
101The options are as follows: 101The options are as follows:
102.Bl -tag -width indent 102.Bl -tag -width indent
103.It Fl a 103.It Fl a
104Append to the trace file instead of truncating it. 104Append to the trace file instead of truncating it.
105.It Fl C 105.It Fl C
106Disable tracing on all user owned processes, and, if executed by root, all 106Disable tracing on all user owned processes, and, if executed by root, all
107processes in the system. 107processes in the system.
108.It Fl c 108.It Fl c
109Clear the trace points associated with the specified file or processes. 109Clear the trace points associated with the specified file or processes.
110.It Fl d 110.It Fl d
111Descendants; perform the operation for all current children of the 111Descendants; perform the operation for all current children of the
112designated processes. 112designated processes.
113.It Fl f Ar trfile 113.It Fl f Ar trfile
114Log trace records to 114Log trace records to
115.Ar trfile 115.Ar trfile
116instead of 116instead of
117.Pa ktrace.out . 117.Pa ktrace.out .
118.It Fl f Ar infile 118.It Fl f Ar infile
119Read the trace records from 119Read the trace records from
120.Ar infile 120.Ar infile
121and print them in a human readable format to standard out. 121and print them in a human readable format to standard out.
122.It Fl g Ar pgid 122.It Fl g Ar pgid
123Enable (disable) tracing on all processes in the process group (only one 123Enable (disable) tracing on all processes in the process group (only one
124.Fl g 124.Fl g
125flag is permitted). 125flag is permitted).
126.It Fl i 126.It Fl i
127Inherit; pass the trace flags to all future children of the designated 127Inherit; pass the trace flags to all future children of the designated
128processes. 128processes.
129.It Fl l 129.It Fl l
130Poll the trace file for new data and print it to standard out. 130Poll the trace file for new data and print it to standard out.
131Only for use together with the 131Only for use together with the
132.Fl f 132.Fl f
133option. 133option.
134.It Fl m Ar maxdata 134.It Fl m Ar maxdata
135Print at most 135Print at most
136.Ar maxdata 136.Ar maxdata
137bytes of data. 137bytes of data.
138This is used for pointer type arguments, e.g., strings. 138This is used for pointer type arguments, e.g., strings.
139The data will be escaped in C-style unless 139The data will be escaped in C-style unless
140.Fl x 140.Fl x
141is specified when it will be output in hex and ascii. 141is specified when it will be output in hex and ascii.
142.It Fl n 142.It Fl n
143Stop tracing if attempts to write to the trace file would block. 143Stop tracing if attempts to write to the trace file would block.
144This option always affects 144This option always affects
145.Nm ktruss 145.Nm ktruss
146and only affects 146and only affects
147.Nm ktrace 147.Nm ktrace
148when writing to 148when writing to
149.Dv stdout . 149.Dv stdout .
150If this flag is not set, then the traced program will block until it can 150If this flag is not set, then the traced program will block until it can
151write more data to the trace file descriptor. 151write more data to the trace file descriptor.
152.It Fl o Ar outfile 152.It Fl o Ar outfile
153Log trace records to 153Log trace records to
154.Ar outfile . 154.Ar outfile .
155Without this option 155Without this option
156.Nm ktruss 156.Nm ktruss
157will print its output in a human 157will print its output in a human
158readable format to standard out. 158readable format to standard out.
159.It Fl p Ar pid 159.It Fl p Ar pid
160Enable (disable) tracing on the indicated process id (only one 160Enable (disable) tracing on the indicated process id (only one
161.Fl p 161.Fl p
162flag is permitted). 162flag is permitted).
163.It Fl s 163.It Fl s
164Write to the trace file with synchronized I/O. 164Write to the trace file with synchronized I/O.
165.It Fl R 165.It Fl R
166Display relative time stamps to output. 166Display relative time stamps to output.
167.It Fl T 167.It Fl T
168Same as the 168Same as the
169.Fl R 169.Fl R
170option, but use absolute timestamps instead. 170option, but use absolute timestamps instead.
171.It Fl t Ar trstr 171.It Fl t Ar trstr
172The string argument represents the kernel trace points, one per letter. 172The string argument represents the kernel trace points, one per letter.
173The following table equates the letters with the tracepoints: 173The following table equates the letters with the tracepoints:
174.Pp 174.Pp
175.Bl -tag -width flag -compact 175.Bl -tag -width flag -compact
176.It Cm A 176.It Cm A
177trace all tracepoints 177trace all tracepoints
178.It Cm a 178.It Cm a
179trace exec arguments 179trace exec arguments
180.It Cm c 180.It Cm c
181trace system calls 181trace system calls
182.It Cm e 182.It Cm e
183trace emulation changes 183trace emulation changes
184.It Cm f 184.It Cm f
185trace open file descriptors after exec 185trace open file descriptors after exec
186.It Cm i 186.It Cm i
187trace 187trace
188.Tn I/O 188.Tn I/O
189.It Cm n 189.It Cm n
190trace namei translations 190trace namei translations
191.It Cm S 191.It Cm S
192trace MIB access (sysctl) 192trace MIB access (sysctl)
193.It Cm s 193.It Cm s
194trace signal processing 194trace signal processing
195.\" .It Cm U 195.\" .It Cm U
196.\" trace scheduler activations upcall data 196.\" trace scheduler activations upcall data
197.It Cm u 197.It Cm u
198trace user data 198trace user data
199.It Cm v 199.It Cm v
200trace exec environment 200trace exec environment
201.It Cm w 201.It Cm w
202trace context switches 202trace context switches
203.It Cm + 203.It Cm +
204trace the default set of trace points (c, e, i, l, m, n, s, u) 204trace the default set of trace points (c, e, i, n, s, u)
205.It Cm - 205.It Cm -
206do not trace following trace points 206do not trace following trace points
207.El 207.El
208.It Fl e Ar emulation 208.It Fl e Ar emulation
209If an emulation of a process is unknown, 209If an emulation of a process is unknown,
210interpret system call maps assuming the named emulation instead of 210interpret system call maps assuming the named emulation instead of
211default "netbsd". 211default "netbsd".
212.It Ar command 212.It Ar command
213Execute 213Execute
214.Ar command 214.Ar command
215with the specified trace flags. 215with the specified trace flags.
216.It Fl v Ar version 216.It Fl v Ar version
217Determines the 217Determines the
218.Ar version 218.Ar version
219of the file generated. 219of the file generated.
220Version 0 is the compatible ktrace format, and 220Version 0 is the compatible ktrace format, and
221version 1 is the new format with lwp IDs and nanosecond (instead of 221version 1 is the new format with lwp IDs and nanosecond (instead of
222microsecond) timestamps. 222microsecond) timestamps.
223.El 223.El
224.Pp 224.Pp
225The 225The
226.Fl p , 226.Fl p ,
227.Fl g , 227.Fl g ,
228and 228and
229.Ar command 229.Ar command
230options are mutually exclusive. 230options are mutually exclusive.
231The 231The
232.Fl R 232.Fl R
233and 233and
234.Fl T 234.Fl T
235options are also mutually exclusive. 235options are also mutually exclusive.
236.Sh EXAMPLES 236.Sh EXAMPLES
237# trace all kernel operations of process id 34 237# trace all kernel operations of process id 34
238.Dl $ ktrace -p 34 238.Dl $ ktrace -p 34
239.Pp 239.Pp
240.Bd -literal 240.Bd -literal
241# trace all kernel operations of processes in process group 15 and 241# trace all kernel operations of processes in process group 15 and
242# pass the trace flags to all current and future children 242# pass the trace flags to all current and future children
243.Ed 243.Ed
244.Dl $ ktrace -idg 15 244.Dl $ ktrace -idg 15
245.Pp 245.Pp
246# disable all tracing of process 65 246# disable all tracing of process 65
247.Dl $ ktrace -cp 65 247.Dl $ ktrace -cp 65
248.Pp 248.Pp
249# disable tracing signals on process 70 and all current children 249# disable tracing signals on process 70 and all current children
250.Dl $ ktrace -t s -cdp 70 250.Dl $ ktrace -t s -cdp 70
251.Pp 251.Pp
252# enable tracing of 252# enable tracing of
253.Tn I/O 253.Tn I/O
254on process 67 254on process 67
255.Dl $ ktrace -ti -p 67 255.Dl $ ktrace -ti -p 67
256.Pp 256.Pp
257# run the command "w", tracing only system calls 257# run the command "w", tracing only system calls
258.Dl $ ktrace -tc w 258.Dl $ ktrace -tc w
259.Pp 259.Pp
260# disable all tracing to the file "tracedata" 260# disable all tracing to the file "tracedata"
261.Dl $ ktrace -c -f tracedata 261.Dl $ ktrace -c -f tracedata
262.Pp 262.Pp
263# disable tracing of all processes owned by the user 263# disable tracing of all processes owned by the user
264.Dl $ ktrace -C 264.Dl $ ktrace -C
265.Pp 265.Pp
266# run the command "w", displaying to standard output 266# run the command "w", displaying to standard output
267.Dl $ ktruss w 267.Dl $ ktruss w
268.Pp 268.Pp
269# trace process 42 and log the records to "ktruss.out" 269# trace process 42 and log the records to "ktruss.out"
270.Dl $ ktruss -p 42 -o ktruss.out 270.Dl $ ktruss -p 42 -o ktruss.out
271.Pp 271.Pp
272# poll ktruss.out for available records and print them 272# poll ktruss.out for available records and print them
273.Dl $ ktruss -lf ktruss.out 273.Dl $ ktruss -lf ktruss.out
274.Sh SEE ALSO 274.Sh SEE ALSO
275.Xr kdump 1 , 275.Xr kdump 1 ,
276.Xr ktrace 2 276.Xr ktrace 2
277.Sh HISTORY 277.Sh HISTORY
278The 278The
279.Nm 279.Nm
280command appears in 280command appears in
281.Bx 4.4 . 281.Bx 4.4 .