1.\" Copyright (c) 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)ktrace.1 5.4 (Berkeley) 03/14/91 7.\" 8.Vx 9.Vx 10.Dd 11.Dt KTRACE 1 12.Sh NAME 13.Nm ktrace 14.Nd enable kernel process tracing 15.Sh SYNOPSIS 16.Nm ktrace 17.Op Fl aCcdi 18.Op Fl f Ar trfile 19.Op Fl g Ar pgrp 20.Op Fl p Ar pid 21.Op Fl t Ar trstr 22.Nm ktrace 23.Op Fl adi 24.Op Fl f Ar trfile 25.Op Fl t Ar trstr 26command 27.Sh DESCRIPTION 28.Nm Ktrace 29enables kernel trace logging for the specified processes. 30Kernel trace data is logged to the file ``ktrace.out''. 31The kernel operations that are traced include system calls, namei 32translations, signal processing, and I/O. 33.Pp 34Once tracing is enabled on a process, trace data will be logged until 35either the process exits or the trace point is cleared. 36A traced process can generate enormous amounts of log data quickly; 37It is strongly suggested that users memorize how to disable tracing before 38attempting to trace a process. 39The following command is sufficient to disable tracing on all user owned 40processes, and, if executed by root, all processes: 41.Pp 42.Dl \&$ trace -C 43.Pp 44The trace file is not human readable; use 45.Xr kdump 1 46to decode it. 47.Pp 48The options are as follows: 49.Tw Ds 50.Tp Fl a 51Append to the trace file instead of truncating it. 52.Tp Fl C 53Disable tracing on all user owned processes, and, if executed by root, all 54processes in the system. 55.Tp Fl c 56Clear the trace points associated with the specified file or processes. 57.Tp Fl d 58Descendants; perform the operation for all current children of the 59designated processes. 60.Tc Fl f 61.Ws 62.Ar file 63.Cx 64Log trace records to 65.Ar file 66instead of ``ktrace.out''. 67.Tc Fl g 68.Ws 69.Ar pgid 70.Cx 71Enable (disable) tracing on all processes in the process group (only one 72.Fl g 73flag is permitted). 74.Tp Fl i 75Inherit; pass the trace flags to all future children of the designated 76processes. 77.Tc Fl p 78.Ws 79.Ar pid 80.Cx 81Enable (disable) tracing on the indicated process id (only one 82.Fl p 83flag is permitted). 84.Tc Fl t 85.Ws 86.Ar trstr 87.Cx 88The string argument represents the kernel trace points, one per letter. 89The following table equates the letters with the tracepoints: 90.Dw Dp 91.Dp Cm c 92trace system calls 93.Dp Cm n 94trace namei translations 95.Dp Cm i 96trace I/O 97.Dp Cm s 98trace signal processing 99.Dp 100.Tp Ar command 101Execute 102.Ar command 103with the specified trace flags. 104.Tp 105.Pp 106The 107.Fl p , 108.Fl g , 109and command options are mutually exclusive. 110.Sh EXAMPLES 111# trace all kernel operations of process id 34 112.Dl $ ktrace -p 34 113.sp 114.nf 115# trace all kernel operations of processes in process group 15 and 116# pass the trace flags to all current and future children 117.fi 118.Dl $ ktrace -idg 15 119.sp 120# disable all tracing of process 65 121.Dl $ ktrace -cp 65 122.sp 123# disable tracing signals on process 70 and all current children 124.Dl $ ktrace -t s -cdp 70 125.sp 126# enable tracing of i/o on process 67 127.Dl $ ktrace -ti -p 67 128.sp 129# run the command "w", tracing only system calls 130.Dl $ ktrace -tc w 131.sp 132# disable all tracing to the file "tracedata" 133.Dl $ ktrace -c -f tracedata 134.sp 135# disable tracing of all processes owned by the user 136.Dl $ ktrace -C 137.Sh SEE ALSO 138.Xr kdump 1 139.Sh HISTORY 1404.4 BSD. 141