summaryrefslogtreecommitdiffstats
path: root/cddl/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/usr.sbin')
-rw-r--r--cddl/usr.sbin/Makefile34
-rw-r--r--cddl/usr.sbin/Makefile.inc5
-rw-r--r--cddl/usr.sbin/dtrace/Makefile28
-rw-r--r--cddl/usr.sbin/dtruss/Makefile8
-rw-r--r--cddl/usr.sbin/dtruss/dtruss.189
-rw-r--r--cddl/usr.sbin/lockstat/Makefile31
-rw-r--r--cddl/usr.sbin/plockstat/Makefile26
-rw-r--r--cddl/usr.sbin/plockstat/plockstat.195
-rw-r--r--cddl/usr.sbin/zdb/Makefile33
-rw-r--r--cddl/usr.sbin/zhack/Makefile32
10 files changed, 381 insertions, 0 deletions
diff --git a/cddl/usr.sbin/Makefile b/cddl/usr.sbin/Makefile
new file mode 100644
index 0000000..fb2c437
--- /dev/null
+++ b/cddl/usr.sbin/Makefile
@@ -0,0 +1,34 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+SUBDIR= ${_dtrace} \
+ ${_dtruss} \
+ ${_lockstat} \
+ ${_zdb} \
+ ${_zhack}
+
+.if ${MK_ZFS} != "no"
+.if ${MK_LIBTHR} != "no"
+_zdb= zdb
+_zhack= zhack
+.endif
+.endif
+
+.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
+_dtrace= dtrace
+_dtruss= dtruss
+_lockstat= lockstat
+.endif
+
+.if ${MACHINE_CPUARCH} == "mips"
+_dtrace= dtrace
+.endif
+
+.if ${MACHINE_CPUARCH} == "powerpc"
+_dtrace= dtrace
+_dtruss= dtruss
+_lockstat= lockstat
+.endif
+
+.include <bsd.subdir.mk>
diff --git a/cddl/usr.sbin/Makefile.inc b/cddl/usr.sbin/Makefile.inc
new file mode 100644
index 0000000..282198e
--- /dev/null
+++ b/cddl/usr.sbin/Makefile.inc
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+BINDIR?= /usr/sbin
+
+.include "../Makefile.inc"
diff --git a/cddl/usr.sbin/dtrace/Makefile b/cddl/usr.sbin/dtrace/Makefile
new file mode 100644
index 0000000..dfccf88
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/Makefile
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/dtrace
+
+PROG= dtrace
+SRCS= dtrace.c
+BINDIR?= /usr/sbin
+
+WARNS?= 1
+
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
+ -I${.CURDIR}/../../../cddl/compat/opensolaris/include \
+ -I${OPENSOLARIS_USR_DISTDIR}/head \
+ -I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \
+ -I${OPENSOLARIS_USR_DISTDIR}/lib/libproc/common \
+ -I${OPENSOLARIS_SYS_DISTDIR}/uts/common \
+ -I${OPENSOLARIS_SYS_DISTDIR}/compat
+
+# Optional debugging stuff...
+#CFLAGS+= -DNEED_ERRLOC
+#YFLAGS+= -d
+
+DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \
+ ${LIBCTF} ${LIBELF} ${LIBZ} ${LIBUTIL} ${LIBRTLD_DB}
+LDADD= -lpthread -ldtrace -ly -ll -lproc -lctf -lelf -lz -lutil \
+ -lrtld_db
+
+.include <bsd.prog.mk>
diff --git a/cddl/usr.sbin/dtruss/Makefile b/cddl/usr.sbin/dtruss/Makefile
new file mode 100644
index 0000000..39161ec
--- /dev/null
+++ b/cddl/usr.sbin/dtruss/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../../cddl/contrib/dtracetoolkit
+
+SCRIPTS=dtruss
+MAN=dtruss.1
+
+.include <bsd.prog.mk>
diff --git a/cddl/usr.sbin/dtruss/dtruss.1 b/cddl/usr.sbin/dtruss/dtruss.1
new file mode 100644
index 0000000..416eb04
--- /dev/null
+++ b/cddl/usr.sbin/dtruss/dtruss.1
@@ -0,0 +1,89 @@
+.\"
+.\" Copyright (c) 2010 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This software was developed by Rui Paulo under sponsorship from the
+.\" FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 26, 2010
+.Dt DTRUSS 1
+.Os
+.Sh NAME
+.Nm dtruss
+.Nd Trace system calls and userland stacks using DTrace
+.Sh SYNOPSIS
+.Nm
+.Op Fl acdefholLs
+.Op Fl t Ar syscall
+.Op Fl n Ar name Fl p Ar pid Ar command
+.Sh DESCRIPTION
+The
+.Nm
+utility traces system calls and (optionally) userland stack traces for the
+specified programs.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl p Ar pid
+Trace the process with PID
+.Ar pid .
+.It Fl n Ar name
+Trace the process with name
+.Ar name .
+.It Fl t Ar syscall
+Trace the specified syscall only.
+.It Fl a
+Print all details.
+.It Fl c
+Print syscall counts.
+.It Fl d
+Print relative times (in microseconds).
+.It Fl e
+Print elapsed times (in microseconds).
+.It Fl f
+Follow the children processes.
+.It Fl l
+Force printing PID / TID.
+.It Fl o
+Print time spent on CPU.
+.It Fl s
+Print userland stack backtraces.
+.It Fl L
+Don't print PID / TID.
+.It Fl b Ar bufsize
+Specify the DTrace buffer size.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr dtrace 1
+.Sh HISTORY
+The
+.Nm
+utility comes from the DTraceToolkit and was first imported into
+.Fx 9.0 .
+.Sh AUTHORS
+.An Brendan Gregg
diff --git a/cddl/usr.sbin/lockstat/Makefile b/cddl/usr.sbin/lockstat/Makefile
new file mode 100644
index 0000000..ef3ac3c
--- /dev/null
+++ b/cddl/usr.sbin/lockstat/Makefile
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/lockstat
+
+PROG= lockstat
+NO_MAN=
+SRCS= lockstat.c sym.c
+BINDIR?= /usr/sbin
+
+WARNS?= 1
+
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
+ -I${.CURDIR}/../../../cddl/compat/opensolaris/include \
+ -I${OPENSOLARIS_USR_DISTDIR}/head \
+ -I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \
+ -I${OPENSOLARIS_USR_DISTDIR}/lib/libproc/common \
+ -I${OPENSOLARIS_SYS_DISTDIR}/uts/common \
+ -I${OPENSOLARIS_SYS_DISTDIR}/compat \
+ -I${.CURDIR}/../../../sys
+
+CFLAGS+= -DNEED_ERRLOC -g
+
+#YFLAGS+= -d
+
+DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \
+ ${LIBCTF} ${LIBELF} ${LIBZ} ${LIBRT} ${LIBUTIL} \
+ ${LIBRTLD_DB}
+LDADD= -lpthread -ldtrace -ly -ll -lproc -lctf -lelf -lz -lrt -lutil \
+ -lrtld_db
+
+.include <bsd.prog.mk>
diff --git a/cddl/usr.sbin/plockstat/Makefile b/cddl/usr.sbin/plockstat/Makefile
new file mode 100644
index 0000000..05929589
--- /dev/null
+++ b/cddl/usr.sbin/plockstat/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/plockstat
+
+PROG= plockstat
+SRCS= plockstat.c
+BINDIR?= /usr/sbin
+
+WARNS?= 1
+
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
+ -I${.CURDIR}/../../../cddl/compat/opensolaris/include \
+ -I${OPENSOLARIS_USR_DISTDIR}/head \
+ -I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \
+ -I${OPENSOLARIS_USR_DISTDIR}/lib/libproc/common \
+ -I${OPENSOLARIS_SYS_DISTDIR}/uts/common \
+ -I${OPENSOLARIS_SYS_DISTDIR}/compat \
+ -I${.CURDIR}/../../../cddl/lib/libdtrace \
+ -I${.CURDIR}/../../../sys
+
+DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} ${LIBCTF}\
+ ${LIBELF} ${LIBZ} ${LIBRT} ${LIBRTLD_DB} ${LIBUTIL}
+LDADD= -lpthread -ldtrace -ly -ll -lproc -lctf -lelf -lz -lrt \
+ -lrtld_db -lutil
+
+.include <bsd.prog.mk>
diff --git a/cddl/usr.sbin/plockstat/plockstat.1 b/cddl/usr.sbin/plockstat/plockstat.1
new file mode 100644
index 0000000..d02c962
--- /dev/null
+++ b/cddl/usr.sbin/plockstat/plockstat.1
@@ -0,0 +1,95 @@
+.\"
+.\" Copyright (c) 2010 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This software was developed by Rui Paulo under sponsorship from the
+.\" FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 13, 2010
+.Dt PLOCKSTAT 1
+.Os
+.Sh NAME
+.Nm plockstat
+.Nd Trace pthread lock statistics using DTrace
+.Sh SYNOPSIS
+.Nm
+.Op Fl vACHV
+.Op Fl n Ar count
+.Op Fl s Ar depth
+.Op Fl e Ar secs
+.Op Fl x Ar opt Ns = Ns Ar val
+.Ar command
+.Op arg...
+.Nm
+.Op Fl vACHV
+.Op Fl n Ar count
+.Op Fl s Ar depth
+.Op Fl e Ar secs
+.Op Fl x Ar opt Ns = Ns Ar val
+.Fl p Ar pid
+.Sh DESCRIPTION
+The
+.Nm
+utility traces pthread locks (mutexes and rwlocks) and prints statistics about
+them.
+You can use
+.Nm
+to investigate bottlenecks in your software.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl v
+Be verbose.
+.It Fl A
+Print all statistics.
+.It Fl C
+Print commulative statistics (the default).
+.It Fl H
+Print a histogram.
+.It Fl V
+Print the DTrace script about to be used to stderr.
+.It Fl n Ar count
+Set the aggregation count for the data set.
+.It Fl s Ar depth
+Set the ustack (userland stack) caller depth.
+.It Fl e Ar secs
+Does nothing at the moment.
+.It Fl x Ar opt Ns = Ns Ar val
+Specify DTrace options.
+See the
+.Xr dtrace 1
+man page for more details.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr dtrace 1 ,
+.Xr pthread 3
+.Sh HISTORY
+The
+.Nm
+utility comes from OpenSolaris and was first imported into
+.Fx 9.0 .
diff --git a/cddl/usr.sbin/zdb/Makefile b/cddl/usr.sbin/zdb/Makefile
new file mode 100644
index 0000000..8068385
--- /dev/null
+++ b/cddl/usr.sbin/zdb/Makefile
@@ -0,0 +1,33 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/zdb
+
+PROG= zdb
+MAN= zdb.8
+SRCS= zdb.c zdb_il.c
+
+WARNS?= 0
+CSTD= c99
+
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
+CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
+CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
+CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
+CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
+CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
+CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
+CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
+CFLAGS+= -I${.CURDIR}/../../lib/libumem
+
+DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
+ ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS} ${LIBZPOOL}
+LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs_core -lzfs -lzpool
+
+CFLAGS+= -DDEBUG=1
+#DEBUG_FLAGS+= -g
+
+.include <bsd.prog.mk>
diff --git a/cddl/usr.sbin/zhack/Makefile b/cddl/usr.sbin/zhack/Makefile
new file mode 100644
index 0000000..f09d2d8
--- /dev/null
+++ b/cddl/usr.sbin/zhack/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/zhack
+
+PROG= zhack
+NO_MAN=
+
+WARNS?= 0
+CSTD= c99
+
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
+CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
+CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
+CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
+CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
+CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
+CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
+CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
+CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
+CFLAGS+= -I${.CURDIR}/../../lib/libumem
+
+DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
+ ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS} ${LIBZPOOL}
+LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs_core -lzfs -lzpool
+
+CFLAGS+= -DDEBUG=1
+#DEBUG_FLAGS+= -g
+
+.include <bsd.prog.mk>
OpenPOWER on IntegriCloud