Print this page
749 "/usr/bin/kstat" should be rewritten in C
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Brendan Gregg <brendan.gregg@joyent.com>

@@ -1,24 +1,24 @@
 '\" te
 .\" Copyright (c) 2000, Sun Microsystems, Inc. All Rights Reserved
 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
 .\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with
 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH KSTAT 1M "Mar 23, 2009"
+.TH KSTAT 1M "Nov 22, 2012"
 .SH NAME
 kstat \- display kernel statistics
 .SH SYNOPSIS
 .LP
 .nf
-\fBkstat\fR [\fB-lpq\fR] [\fB-T\fR u | d ] [\fB-c\fR \fIclass\fR] [\fB-m\fR \fImodule\fR]
+\fBkstat\fR [\fB-Cjlpq\fR] [\fB-T\fR u | d ] [\fB-c\fR \fIclass\fR] [\fB-m\fR \fImodule\fR]
      [\fB-i\fR \fIinstance\fR] [\fB-n\fR \fIname\fR] [\fB-s\fR \fIstatistic\fR]
      [interval [count]]
 .fi
 
 .LP
 .nf
-\fBkstat\fR [\fB-lpq\fR] [\fB-T\fR u | d ] [\fB-c\fR \fIclass\fR]
+\fBkstat\fR [\fB-Cjlpq\fR] [\fB-T\fR u | d ] [\fB-c\fR \fIclass\fR]
      [\fImodule\fR:\fIinstance\fR:\fIname\fR:\fIstatistic\fR]...
      [interval [count]]
 .fi
 
 .SH DESCRIPTION

@@ -57,12 +57,20 @@
 metacharacters must be protected from the shell by enclosing it with the
 appropriate quotes.
 .sp
 .LP
 The argument for the \fB-c\fR, \fB-i\fR, \fB-m\fR, \fB-n\fR, and \fB-s\fR
-options may be specified as a shell glob pattern, or a Perl regular expression
-enclosed in '/' characters.
+options may be specified as a shell glob pattern.
+.sp
+.ne 2
+.na
+\fB\fB-C\fR\fR
+.ad
+.RS 16n
+Displays output in parseable format with a colon as separator.
+.RE
+
 .sp
 .ne 2
 .na
 \fB\fB-c\fR \fIclass\fR\fR
 .ad

@@ -81,10 +89,19 @@
 .RE
 
 .sp
 .ne 2
 .na
+\fB\fB-j\fR\fR
+.ad
+.RS 16n
+Displays output in JSON format.
+.RE
+
+.sp
+.ne 2
+.na
 \fB\fB-l\fR\fR
 .ad
 .RS 16n
 Lists matching kstat names without displaying values.
 .RE

@@ -159,12 +176,12 @@
 .ad
 .sp .6
 .RS 4n
 Alternate method of specifying module, instance, name, and statistic as
 described above. Each of the module, instance, name, or statistic specifiers
-may be a shell glob pattern or a Perl regular expression enclosed by '/'
-characters. It is possible to use both specifier types within a single operand.
+may be a shell glob pattern.
+It is possible to use both specifier types within a single operand.
 Leaving a specifier empty is equivalent to using the '*' glob pattern for that
 specifier.
 .RE
 
 .sp

@@ -200,11 +217,11 @@
 .nf
 example$ \fBkstat -p -m unix -i 0 -n system_misc -s 'avenrun*'\fR
 example$ \fBkstat -p -s 'avenrun*'\fR
 example$ \fBkstat -p 'unix:0:system_misc:avenrun*'\fR
 example$ \fBkstat -p ':::avenrun*'\fR
-example$ \fBkstat -p ':::/^avenrun_\ed+min$/'\fR
+example$ \fBkstat -p ':::avenrun*min$'\fR
 
 unix:0:system_misc:avenrun_15min        3
 unix:0:system_misc:avenrun_1min 4
 unix:0:system_misc:avenrun_5min 2
 .fi

@@ -215,11 +232,11 @@
 \fBExample 2 \fRUsing the \fBkstat\fR Command
 .sp
 .in +2
 .nf
 example$ \fBkstat -p -m cpu_stat -s 'intr*'\fR
-example$ \fBkstat -p cpu_stat:::/^intr/\fR
+example$ \fBkstat -p 'cpu_stat:::intr*'\fR
 
 cpu_stat:0:cpu_stat0:intr       29682330
 cpu_stat:0:cpu_stat0:intrblk    87
 cpu_stat:0:cpu_stat0:intrthread 15054222
 cpu_stat:1:cpu_stat1:intr       426073

@@ -239,11 +256,10 @@
 \fBExample 3 \fRUsing the \fBkstat\fR Command
 .sp
 .in +2
 .nf
 example$ \fBkstat -p :::state ':::avenrun*'\fR
-example$ \fBkstat -p :::state :::/^avenrun/\fR
 
 cpu_info:0:cpu_info0:state      on-line
 cpu_info:1:cpu_info1:state      on-line
 cpu_info:2:cpu_info2:state      on-line
 cpu_info:3:cpu_info3:state      on-line

@@ -365,8 +381,8 @@
 \fBkstat\fR(3KSTAT), \fBattributes\fR(5), \fBkstat\fR(7D), \fBsd\fR(7D),
 \fBkstat\fR(9S)
 .SH NOTES
 .sp
 .LP
-If the pattern argument contains glob or Perl RE metacharacters which are also
+If the pattern argument contains glob metacharacters which are also
 shell metacharacters, it will be necessary to enclose the pattern with
 appropriate shell quotes.