Annotation of src/usr.bin/ktrace/ktrace.1, Revision 1.5
1.5 ! deraadt 1: .\" $OpenBSD: ktrace.1,v 1.4 1997/05/28 21:59:03 deraadt Exp $
1.1 deraadt 2: .\" Copyright (c) 1990, 1993
3: .\" The Regents of the University of California. All rights reserved.
4: .\"
5: .\" Redistribution and use in source and binary forms, with or without
6: .\" modification, are permitted provided that the following conditions
7: .\" are met:
8: .\" 1. Redistributions of source code must retain the above copyright
9: .\" notice, this list of conditions and the following disclaimer.
10: .\" 2. Redistributions in binary form must reproduce the above copyright
11: .\" notice, this list of conditions and the following disclaimer in the
12: .\" documentation and/or other materials provided with the distribution.
13: .\" 3. All advertising materials mentioning features or use of this software
14: .\" must display the following acknowledgement:
15: .\" This product includes software developed by the University of
16: .\" California, Berkeley and its contributors.
17: .\" 4. Neither the name of the University nor the names of its contributors
18: .\" may be used to endorse or promote products derived from this software
19: .\" without specific prior written permission.
20: .\"
21: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31: .\" SUCH DAMAGE.
32: .\"
33: .\" from: @(#)ktrace.1 8.1 (Berkeley) 6/6/93
34: .\"
35: .Dd June 6, 1993
36: .Dt KTRACE 1
37: .Os BSD 4.4
38: .Sh NAME
39: .Nm ktrace
40: .Nd enable kernel process tracing
41: .Sh SYNOPSIS
42: .Nm ktrace
43: .Op Fl aCcdi
44: .Op Fl f Ar trfile
45: .Op Fl g Ar pgrp
46: .Op Fl p Ar pid
47: .Op Fl t Ar trstr
48: .Nm ktrace
49: .Op Fl adi
50: .Op Fl f Ar trfile
51: .Op Fl t Ar trstr
52: command
53: .Sh DESCRIPTION
54: .Nm Ktrace
55: enables kernel trace logging for the specified processes.
56: Kernel trace data is logged to the file
57: .Pa ktrace.out .
58: The kernel operations that are traced include system calls, namei
59: translations, signal processing, and
60: .Tn I/O .
61: .Pp
62: Once tracing is enabled on a process, trace data will be logged until
63: either the process exits or the trace point is cleared.
64: A traced process can generate enormous amounts of log data quickly;
65: It is strongly suggested that users memorize how to disable tracing before
66: attempting to trace a process.
67: The following command is sufficient to disable tracing on all user owned
68: processes, and, if executed by root, all processes:
69: .Pp
1.3 millert 70: .Dl \&$ ktrace -C
1.1 deraadt 71: .Pp
72: The trace file is not human readable; use
73: .Xr kdump 1
74: to decode it.
75: .Pp
76: The options are as follows:
77: .Bl -tag -width indent
78: .It Fl a
1.5 ! deraadt 79: Append to the trace file instead of recreating it.
1.1 deraadt 80: .It Fl C
81: Disable tracing on all user owned processes, and, if executed by root, all
82: processes in the system.
83: .It Fl c
84: Clear the trace points associated with the specified file or processes.
85: .It Fl d
86: Descendants; perform the operation for all current children of the
87: designated processes.
88: .It Fl f Ar file
89: Log trace records to
90: .Ar file
91: instead of
92: .Pa ktrace.out .
93: .It Fl g Ar pgid
94: Enable (disable) tracing on all processes in the process group (only one
95: .Fl g
96: flag is permitted).
97: .It Fl i
98: Inherit; pass the trace flags to all future children of the designated
99: processes.
100: .It Fl p Ar pid
101: Enable (disable) tracing on the indicated process id (only one
102: .Fl p
103: flag is permitted).
104: .It Fl t Ar trstr
105: The string argument represents the kernel trace points, one per letter.
106: The following table equates the letters with the tracepoints:
107: .Pp
108: .Bl -tag -width flag -compact
109: .It Cm c
110: trace system calls
111: .It Cm e
112: trace emulation changes
113: .It Cm n
114: trace namei translations
115: .It Cm i
116: trace
117: .Tn I/O
118: .It Cm s
119: trace signal processing
120: .El
121: .It Ar command
122: Execute
123: .Ar command
124: with the specified trace flags.
125: .El
126: .Pp
127: The
128: .Fl p ,
129: .Fl g ,
130: and
131: .Ar command
132: options are mutually exclusive.
133: .Sh EXAMPLES
134: # trace all kernel operations of process id 34
135: .Dl $ ktrace -p 34
136: .Pp
1.4 deraadt 137: .Bd -literal
1.1 deraadt 138: # trace all kernel operations of processes in process group 15 and
139: # pass the trace flags to all current and future children
1.4 deraadt 140: .Ed
1.1 deraadt 141: .Dl $ ktrace -idg 15
142: .Pp
143: # disable all tracing of process 65
144: .Dl $ ktrace -cp 65
145: .Pp
146: # disable tracing signals on process 70 and all current children
147: .Dl $ ktrace -t s -cdp 70
148: .Pp
149: # enable tracing of
150: .Tn I/O
151: on process 67
152: .Dl $ ktrace -ti -p 67
153: .Pp
154: # run the command "w", tracing only system calls
155: .Dl $ ktrace -tc w
156: .Pp
157: # disable all tracing to the file "tracedata"
158: .Dl $ ktrace -c -f tracedata
159: .Pp
160: # disable tracing of all processes owned by the user
161: .Dl $ ktrace -C
162: .Sh SEE ALSO
163: .Xr kdump 1
164: .Sh HISTORY
165: The
166: .Nm ktrace
167: command appears in
168: .Bx 4.4 .