19b50d902SRodney W. Grimes.\" Copyright (c) 1990, 1993 29b50d902SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 39b50d902SRodney W. Grimes.\" 49b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 59b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions 69b50d902SRodney W. Grimes.\" are met: 79b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 89b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 99b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 109b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 119b50d902SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 129b50d902SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software 139b50d902SRodney W. Grimes.\" must display the following acknowledgement: 149b50d902SRodney W. Grimes.\" This product includes software developed by the University of 159b50d902SRodney W. Grimes.\" California, Berkeley and its contributors. 169b50d902SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors 179b50d902SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 189b50d902SRodney W. Grimes.\" without specific prior written permission. 199b50d902SRodney W. Grimes.\" 209b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 219b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 229b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 239b50d902SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 249b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 259b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 269b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 279b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 289b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 299b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 309b50d902SRodney W. Grimes.\" SUCH DAMAGE. 319b50d902SRodney W. Grimes.\" 329b50d902SRodney W. Grimes.\" @(#)ktrace.1 8.1 (Berkeley) 6/6/93 339b50d902SRodney W. Grimes.\" 349b50d902SRodney W. Grimes.Dd June 6, 1993 359b50d902SRodney W. Grimes.Dt KTRACE 1 369b50d902SRodney W. Grimes.Os BSD 4.4 379b50d902SRodney W. Grimes.Sh NAME 389b50d902SRodney W. Grimes.Nm ktrace 399b50d902SRodney W. Grimes.Nd enable kernel process tracing 409b50d902SRodney W. Grimes.Sh SYNOPSIS 419b50d902SRodney W. Grimes.Nm ktrace 429b50d902SRodney W. Grimes.Op Fl aCcdi 439b50d902SRodney W. Grimes.Op Fl f Ar trfile 449b50d902SRodney W. Grimes.Op Fl g Ar pgrp 459b50d902SRodney W. Grimes.Op Fl p Ar pid 469b50d902SRodney W. Grimes.Op Fl t Ar trstr 479b50d902SRodney W. Grimes.Nm ktrace 489b50d902SRodney W. Grimes.Op Fl adi 499b50d902SRodney W. Grimes.Op Fl f Ar trfile 509b50d902SRodney W. Grimes.Op Fl t Ar trstr 519b50d902SRodney W. Grimescommand 529b50d902SRodney W. Grimes.Sh DESCRIPTION 539b50d902SRodney W. Grimes.Nm Ktrace 549b50d902SRodney W. Grimesenables kernel trace logging for the specified processes. 559b50d902SRodney W. GrimesKernel trace data is logged to the file 569b50d902SRodney W. Grimes.Pa ktrace.out . 579b50d902SRodney W. GrimesThe kernel operations that are traced include system calls, namei 589b50d902SRodney W. Grimestranslations, signal processing, and 599b50d902SRodney W. Grimes.Tn I/O . 609b50d902SRodney W. Grimes.Pp 619b50d902SRodney W. GrimesOnce tracing is enabled on a process, trace data will be logged until 629b50d902SRodney W. Grimeseither the process exits or the trace point is cleared. 639b50d902SRodney W. GrimesA traced process can generate enormous amounts of log data quickly; 649b50d902SRodney W. GrimesIt is strongly suggested that users memorize how to disable tracing before 659b50d902SRodney W. Grimesattempting to trace a process. 669b50d902SRodney W. GrimesThe following command is sufficient to disable tracing on all user owned 679b50d902SRodney W. Grimesprocesses, and, if executed by root, all processes: 689b50d902SRodney W. Grimes.Pp 699b50d902SRodney W. Grimes.Dl \&$ trace -C 709b50d902SRodney W. Grimes.Pp 719b50d902SRodney W. GrimesThe trace file is not human readable; use 729b50d902SRodney W. Grimes.Xr kdump 1 739b50d902SRodney W. Grimesto decode it. 749b50d902SRodney W. Grimes.Pp 759b50d902SRodney W. GrimesThe options are as follows: 769b50d902SRodney W. Grimes.Bl -tag -width indent 779b50d902SRodney W. Grimes.It Fl a 789b50d902SRodney W. GrimesAppend to the trace file instead of truncating it. 799b50d902SRodney W. Grimes.It Fl C 809b50d902SRodney W. GrimesDisable tracing on all user owned processes, and, if executed by root, all 819b50d902SRodney W. Grimesprocesses in the system. 829b50d902SRodney W. Grimes.It Fl c 839b50d902SRodney W. GrimesClear the trace points associated with the specified file or processes. 849b50d902SRodney W. Grimes.It Fl d 859b50d902SRodney W. GrimesDescendants; perform the operation for all current children of the 869b50d902SRodney W. Grimesdesignated processes. 879b50d902SRodney W. Grimes.It Fl f Ar file 889b50d902SRodney W. GrimesLog trace records to 899b50d902SRodney W. Grimes.Ar file 909b50d902SRodney W. Grimesinstead of 919b50d902SRodney W. Grimes.Pa ktrace.out . 929b50d902SRodney W. Grimes.It Fl g Ar pgid 939b50d902SRodney W. GrimesEnable (disable) tracing on all processes in the process group (only one 949b50d902SRodney W. Grimes.Fl g 959b50d902SRodney W. Grimesflag is permitted). 969b50d902SRodney W. Grimes.It Fl i 979b50d902SRodney W. GrimesInherit; pass the trace flags to all future children of the designated 989b50d902SRodney W. Grimesprocesses. 999b50d902SRodney W. Grimes.It Fl p Ar pid 1009b50d902SRodney W. GrimesEnable (disable) tracing on the indicated process id (only one 1019b50d902SRodney W. Grimes.Fl p 1029b50d902SRodney W. Grimesflag is permitted). 1039b50d902SRodney W. Grimes.It Fl t Ar trstr 1049b50d902SRodney W. GrimesThe string argument represents the kernel trace points, one per letter. 1059b50d902SRodney W. GrimesThe following table equates the letters with the tracepoints: 1069b50d902SRodney W. Grimes.Pp 1079b50d902SRodney W. Grimes.Bl -tag -width flag -compact 1089b50d902SRodney W. Grimes.It Cm c 1099b50d902SRodney W. Grimestrace system calls 1109b50d902SRodney W. Grimes.It Cm n 1119b50d902SRodney W. Grimestrace namei translations 1129b50d902SRodney W. Grimes.It Cm i 1139b50d902SRodney W. Grimestrace 1149b50d902SRodney W. Grimes.Tn I/O 1159b50d902SRodney W. Grimes.It Cm s 1169b50d902SRodney W. Grimestrace signal processing 1179b50d902SRodney W. Grimes.El 1189b50d902SRodney W. Grimes.It Ar command 1199b50d902SRodney W. GrimesExecute 1209b50d902SRodney W. Grimes.Ar command 1219b50d902SRodney W. Grimeswith the specified trace flags. 1229b50d902SRodney W. Grimes.El 1239b50d902SRodney W. Grimes.Pp 1249b50d902SRodney W. GrimesThe 1259b50d902SRodney W. Grimes.Fl p , 1269b50d902SRodney W. Grimes.Fl g , 1279b50d902SRodney W. Grimesand 1289b50d902SRodney W. Grimes.Ar command 1299b50d902SRodney W. Grimesoptions are mutually exclusive. 1309b50d902SRodney W. Grimes.Sh EXAMPLES 1319b50d902SRodney W. Grimes# trace all kernel operations of process id 34 1329b50d902SRodney W. Grimes.Dl $ ktrace -p 34 1339b50d902SRodney W. Grimes.Pp 1349b50d902SRodney W. Grimes# trace all kernel operations of processes in process group 15 and 1359b50d902SRodney W. Grimes# pass the trace flags to all current and future children 1369b50d902SRodney W. Grimes.Dl $ ktrace -idg 15 1379b50d902SRodney W. Grimes.Pp 1389b50d902SRodney W. Grimes# disable all tracing of process 65 1399b50d902SRodney W. Grimes.Dl $ ktrace -cp 65 1409b50d902SRodney W. Grimes.Pp 1419b50d902SRodney W. Grimes# disable tracing signals on process 70 and all current children 1429b50d902SRodney W. Grimes.Dl $ ktrace -t s -cdp 70 1439b50d902SRodney W. Grimes.Pp 1449b50d902SRodney W. Grimes# enable tracing of 1459b50d902SRodney W. Grimes.Tn I/O 1469b50d902SRodney W. Grimeson process 67 1479b50d902SRodney W. Grimes.Dl $ ktrace -ti -p 67 1489b50d902SRodney W. Grimes.Pp 1499b50d902SRodney W. Grimes# run the command "w", tracing only system calls 1509b50d902SRodney W. Grimes.Dl $ ktrace -tc w 1519b50d902SRodney W. Grimes.Pp 1529b50d902SRodney W. Grimes# disable all tracing to the file "tracedata" 1539b50d902SRodney W. Grimes.Dl $ ktrace -c -f tracedata 1549b50d902SRodney W. Grimes.Pp 1559b50d902SRodney W. Grimes# disable tracing of all processes owned by the user 1569b50d902SRodney W. Grimes.Dl $ ktrace -C 1579b50d902SRodney W. Grimes.Sh SEE ALSO 1589b50d902SRodney W. Grimes.Xr kdump 1 15910871c98SJames Raynard.Sh BUGS 16010871c98SJames RaynardOnly works if 16110871c98SJames Raynard.Ar file 16210871c98SJames Raynardis a regular file. 1639b50d902SRodney W. Grimes.Sh HISTORY 1649b50d902SRodney W. GrimesThe 1659b50d902SRodney W. Grimes.Nm ktrace 1669b50d902SRodney W. Grimescommand appears in 1679b50d902SRodney W. Grimes.Bx 4.4 . 168