144955Scael.\" Copyright (c) 1990 The Regents of the University of California. 244955Scael.\" All rights reserved. 344955Scael.\" 444955Scael.\" %sccs.include.redist.man% 544955Scael.\" 6*47067Smarc.\" @(#)ktrace.1 5.3 (Berkeley) 03/07/91 744955Scael.\" 844955Scael.Dd 944955Scael.Dt KTRACE 1 1044955Scael.Sh NAME 1144955Scael.Nm ktrace 1244955Scael.Nd enable kernel process tracing 1344955Scael.Sh SYNOPSIS 1444955Scael.Nm ktrace 1545987Sbostic.Op Fl aCcdi 1645987Sbostic.Op Fl f Ar trfile 1745987Sbostic.Op Fl g Ar pgrp 1844955Scael.Op Fl p Ar pid 1944955Scael.Op Fl t Ar trstr 2044955Scael.Nm ktrace 2145987Sbostic.Op Fl adi 2244955Scael.Op Fl f Ar trfile 2345987Sbostic.Op Fl t Ar trstr 2445987Sbosticcommand 2544955Scael.Sh DESCRIPTION 2644955Scael.Nm Ktrace 2744955Scaelenables kernel trace logging for the specified processes. 2845987SbosticKernel trace data is logged to the file ``ktrace.out''. 2945987SbosticThe kernel operations that are traced include system calls, namei 3045987Sbostictranslations, signal processing, and I/O. 3144955Scael.Pp 3245987SbosticOnce tracing is enabled on a process, trace data will be logged until 3345987Sbosticeither the process exits or the trace point is cleared. 3445987SbosticA traced process can generate enormous amounts of log data quickly; 3545987SbosticIt is strongly suggested that users memorize how to disable tracing before 3645987Sbosticattempting to trace a process. 3745987SbosticThe following command is sufficient to disable tracing on all user owned 3845987Sbosticprocesses, and, if executed by root, all processes: 3945987Sbostic.Pp 4044955Scael.Dl \&$ trace -C 4144955Scael.Pp 4245987SbosticThe trace file is not human readable; use 4344955Scael.Xr kdump 1 4444955Scaelto decode it. 4545987Sbostic.Pp 4645987SbosticThe options are as follows: 4744955Scael.Tw Ds 4845987Sbostic.Tp Fl a 4945987SbosticAppend to the trace file instead of truncating it. 5044955Scael.Tp Fl C 5145987SbosticDisable tracing on all user owned processes, and, if executed by root, all 5245987Sbosticprocesses in the system. 5345987Sbostic.Tp Fl c 5445989SbosticClear the trace points associated with the specified file or processes. 5545989Sbostic.Tp Fl d 5645989SbosticDescendants; perform the operation for all current children of the 5745989Sbosticdesignated processes. 5844955Scael.Tc Fl f 5944955Scael.Ws 6045987Sbostic.Ar file 6144955Scael.Cx 6244955ScaelLog trace records to 6345987Sbostic.Ar file 6445987Sbosticinstead of ``ktrace.out''. 6545987Sbostic.Tc Fl g 6645987Sbostic.Ws 6745987Sbostic.Ar pgid 6845987Sbostic.Cx 6945987SbosticEnable (disable) tracing on all processes in the process group (only one 7045987Sbostic.Fl g 7145987Sbosticflag is permitted). 7245987Sbostic.Tp Fl i 7345989SbosticInherit; pass the trace flags to all future children of the designated 7445987Sbosticprocesses. 7545987Sbostic.Tc Fl p 7645987Sbostic.Ws 7745987Sbostic.Ar pid 7845987Sbostic.Cx 7945987SbosticEnable (disable) tracing on the indicated process id (only one 8045987Sbostic.Fl p 8145987Sbosticflag is permitted). 8244955Scael.Tc Fl t 8344955Scael.Ws 8444955Scael.Ar trstr 8544955Scael.Cx 8645987SbosticThe string argument represents the kernel trace points, one per letter. 8745987SbosticThe following table equates the letters with the tracepoints: 8845987Sbostic.Dw Dp 8944955Scael.Dp Cm c 9044955Scaeltrace system calls 9144955Scael.Dp Cm n 9244955Scaeltrace namei translations 9344955Scael.Dp Cm i 9444955Scaeltrace I/O 9544955Scael.Dp Cm s 9645987Sbostictrace signal processing 9744955Scael.Dp 9844955Scael.Tp Ar command 9945987SbosticExecute 10044955Scael.Ar command 10144955Scaelwith the specified trace flags. 10244955Scael.Tp 10344955Scael.Pp 10444955ScaelThe 10544955Scael.Fl p , 10644955Scael.Fl g , 10744955Scaeland command options are mutually exclusive. 10844955Scael.Sh EXAMPLES 10944583Smarc# trace all kernel operations of process id 34 11045987Sbostic.Dl $ ktrace -p 34 11145987Sbostic.sp 112*47067Smarc.nf 11344583Smarc# trace all kernel operations of processes in process group 15 and 11437231Smarc# pass the trace flags to all current and future children 115*47067Smarc.fi 116*47067Smarc.Dl $ ktrace -idg 15 11745987Sbostic.sp 11844583Smarc# disable all tracing of process 65 11945987Sbostic.Dl $ ktrace -cp 65 12045987Sbostic.sp 12144583Smarc# disable tracing signals on process 70 and all current children 122*47067Smarc.Dl $ ktrace -t s -cdp 70 12345987Sbostic.sp 12444583Smarc# enable tracing of i/o on process 67 12545987Sbostic.Dl $ ktrace -ti -p 67 12645987Sbostic.sp 12744583Smarc# run the command "w", tracing only system calls 12844955Scael.Dl $ ktrace -tc w 12945987Sbostic.sp 13037231Smarc# disable all tracing to the file "tracedata" 13144955Scael.Dl $ ktrace -c -f tracedata 13245987Sbostic.sp 13344583Smarc# disable tracing of all processes owned by the user 13444955Scael.Dl $ ktrace -C 13544955Scael.Sh SEE ALSO 13644955Scael.Xr kdump 1 13744955Scael.Sh HISTORY 13844955Scael4.4 BSD. 139