[BACK]Return to ktrace.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / ktrace

Annotation of src/usr.bin/ktrace/ktrace.1, Revision 1.8

1.8     ! aaron       1: .\"    $OpenBSD: ktrace.1,v 1.7 1999/06/05 01:21:28 aaron 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
1.7       aaron      37: .Os
1.1       deraadt    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
1.6       aaron      52: .Ar command
1.1       deraadt    53: .Sh DESCRIPTION
1.6       aaron      54: .Nm ktrace
1.1       deraadt    55: enables kernel trace logging for the specified processes.
1.8     ! aaron      56: By default, kernel trace data is logged to the file
        !            57: .Pa ktrace.out ,
        !            58: unless overridden by the
        !            59: .Fl f
        !            60: option.
1.1       deraadt    61: The kernel operations that are traced include system calls, namei
                     62: translations, signal processing, and
                     63: .Tn I/O .
                     64: .Pp
                     65: Once tracing is enabled on a process, trace data will be logged until
                     66: either the process exits or the trace point is cleared.
                     67: A traced process can generate enormous amounts of log data quickly;
1.8     ! aaron      68: it is strongly suggested that users memorize how to disable tracing before
1.1       deraadt    69: attempting to trace a process.
                     70: The following command is sufficient to disable tracing on all user owned
                     71: processes, and, if executed by root, all processes:
                     72: .Pp
1.3       millert    73: .Dl \&$ ktrace -C
1.1       deraadt    74: .Pp
1.6       aaron      75: The trace file is not human-readable; use
1.1       deraadt    76: .Xr kdump 1
                     77: to decode it.
                     78: .Pp
                     79: The options are as follows:
                     80: .Bl -tag -width indent
                     81: .It Fl a
1.5       deraadt    82: Append to the trace file instead of recreating it.
1.1       deraadt    83: .It Fl C
                     84: Disable tracing on all user owned processes, and, if executed by root, all
                     85: processes in the system.
                     86: .It Fl c
                     87: Clear the trace points associated with the specified file or processes.
                     88: .It Fl d
                     89: Descendants; perform the operation for all current children of the
                     90: designated processes.
1.7       aaron      91: .It Fl f Ar file
1.1       deraadt    92: Log trace records to
                     93: .Ar file
                     94: instead of
                     95: .Pa ktrace.out .
1.7       aaron      96: .It Fl g Ar pgid
1.1       deraadt    97: Enable (disable) tracing on all processes in the process group (only one
                     98: .Fl g
                     99: flag is permitted).
                    100: .It Fl i
                    101: Inherit; pass the trace flags to all future children of the designated
                    102: processes.
1.7       aaron     103: .It Fl p Ar pid
1.6       aaron     104: Enable (disable) tracing on the indicated process ID (only one
1.1       deraadt   105: .Fl p
                    106: flag is permitted).
1.7       aaron     107: .It Fl t Ar trstr
1.1       deraadt   108: The string argument represents the kernel trace points, one per letter.
                    109: The following table equates the letters with the tracepoints:
                    110: .Pp
                    111: .Bl -tag -width flag -compact
                    112: .It Cm c
                    113: trace system calls
                    114: .It Cm e
                    115: trace emulation changes
                    116: .It Cm n
                    117: trace namei translations
                    118: .It Cm i
                    119: trace
                    120: .Tn I/O
                    121: .It Cm s
                    122: trace signal processing
                    123: .El
                    124: .It Ar command
                    125: Execute
                    126: .Ar command
                    127: with the specified trace flags.
                    128: .El
                    129: .Pp
                    130: The
                    131: .Fl p ,
                    132: .Fl g ,
                    133: and
                    134: .Ar command
                    135: options are mutually exclusive.
                    136: .Sh EXAMPLES
                    137: # trace all kernel operations of process id 34
                    138: .Dl $ ktrace -p 34
                    139: .Pp
1.4       deraadt   140: .Bd -literal
1.1       deraadt   141: # trace all kernel operations of processes in process group 15 and
                    142: # pass the trace flags to all current and future children
1.4       deraadt   143: .Ed
1.1       deraadt   144: .Dl $ ktrace -idg 15
                    145: .Pp
                    146: # disable all tracing of process 65
                    147: .Dl $ ktrace -cp 65
                    148: .Pp
                    149: # disable tracing signals on process 70 and all current children
                    150: .Dl $ ktrace -t s -cdp 70
                    151: .Pp
                    152: # enable tracing of
                    153: .Tn I/O
                    154: on process 67
                    155: .Dl $ ktrace -ti -p 67
                    156: .Pp
                    157: # run the command "w", tracing only system calls
                    158: .Dl $ ktrace -tc w
                    159: .Pp
                    160: # disable all tracing to the file "tracedata"
                    161: .Dl $ ktrace -c -f tracedata
                    162: .Pp
                    163: # disable tracing of all processes owned by the user
                    164: .Dl $ ktrace -C
1.8     ! aaron     165: .Sh FILES
        !           166: .Bl -tag -width ktrace.out -compact
        !           167: .It Pa ktrace.out
        !           168: default ktrace dump file
        !           169: .El
1.1       deraadt   170: .Sh SEE ALSO
                    171: .Xr kdump 1
                    172: .Sh HISTORY
                    173: The
                    174: .Nm ktrace
1.6       aaron     175: command appeared in
1.1       deraadt   176: .Bx 4.4 .