[Midnightbsd-cvs] src [9162] trunk/cddl/contrib/opensolaris: sync with freebsd 9.2

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Oct 13 22:18:41 EDT 2016


Revision: 9162
          http://svnweb.midnightbsd.org/src/?rev=9162
Author:   laffer1
Date:     2016-10-13 22:18:41 -0400 (Thu, 13 Oct 2016)
Log Message:
-----------
sync with freebsd 9.2

Modified Paths:
--------------
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs1.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d.out
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d.out
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d.out
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/assocs/tst.orthogonality.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationOut.d.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationWithO.d.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.PreprocessorStatement.d.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoofew.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoomany.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.index.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestFunctionLookup.java
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.ksh.out
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.schrock.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.exe
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.fork.c
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.probemod.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress5.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.basics.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.basics.d.out
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.walltimestamp.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exec.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.sigwait.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.c
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.header.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.include.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.user.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/vars/tst.ucaller.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i386/funcs/tst.badcopyin.d
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedargs.ksh
    trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/sparc/usdt/tst.tailcall.ksh
    trunk/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c
    trunk/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h
    trunk/cddl/contrib/opensolaris/cmd/sgs/include/_string_table.h
    trunk/cddl/contrib/opensolaris/cmd/sgs/include/alist.h
    trunk/cddl/contrib/opensolaris/cmd/sgs/include/debug.h
    trunk/cddl/contrib/opensolaris/cmd/sgs/include/sgs.h
    trunk/cddl/contrib/opensolaris/cmd/sgs/include/string_table.h
    trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/findprime.c
    trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c
    trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/string_table.c
    trunk/cddl/contrib/opensolaris/cmd/zdb/zdb.8
    trunk/cddl/contrib/opensolaris/cmd/zfs/zfs.8
    trunk/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
    trunk/cddl/contrib/opensolaris/cmd/zhack/zhack.c
    trunk/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
    trunk/cddl/contrib/opensolaris/cmd/zpool/zpool.8
    trunk/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
    trunk/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1
    trunk/cddl/contrib/opensolaris/cmd/ztest/ztest.c
    trunk/cddl/contrib/opensolaris/common/avl/avl.c
    trunk/cddl/contrib/opensolaris/common/ctf/ctf_create.c
    trunk/cddl/contrib/opensolaris/common/ctf/ctf_decl.c
    trunk/cddl/contrib/opensolaris/common/ctf/ctf_error.c
    trunk/cddl/contrib/opensolaris/common/ctf/ctf_hash.c
    trunk/cddl/contrib/opensolaris/common/ctf/ctf_impl.h
    trunk/cddl/contrib/opensolaris/common/ctf/ctf_labels.c
    trunk/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c
    trunk/cddl/contrib/opensolaris/common/ctf/ctf_open.c
    trunk/cddl/contrib/opensolaris/common/ctf/ctf_types.c
    trunk/cddl/contrib/opensolaris/common/ctf/ctf_util.c
    trunk/cddl/contrib/opensolaris/head/libintl.h
    trunk/cddl/contrib/opensolaris/head/synch.h
    trunk/cddl/contrib/opensolaris/head/thread.h
    trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
    trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
    trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
    trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h
    trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
    trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c
    trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
    trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
    trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c
    trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
    trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
    trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
    trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
    trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
    trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c
    trunk/cddl/contrib/opensolaris/lib/libzpool/common/util.c

Added Paths:
-----------
    trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c
    trunk/cddl/contrib/opensolaris/lib/libzfs_core/
    trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/
    trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
    trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
    trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.c
    trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.h

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst	2016-10-14 02:18:41 UTC (rev 9162)
@@ -23,7 +23,6 @@
 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
 
 # Exception list: names tests that are bypassed when running in Java
 # mode (relative to /opt/SUNWdtrt/tst)
@@ -52,14 +51,17 @@
 common/usdt/tst.enabled2.ksh
 common/usdt/tst.entryreturn.ksh
 common/usdt/tst.fork.ksh
-common/usdt/tst.header.ksh
 common/usdt/tst.guess32.ksh
 common/usdt/tst.guess64.ksh
+common/usdt/tst.header.ksh
 common/usdt/tst.linkpriv.ksh
 common/usdt/tst.linkunpriv.ksh
 common/usdt/tst.multiple.ksh
 common/usdt/tst.nodtrace.ksh
+common/usdt/tst.noreap.ksh
+common/usdt/tst.noreapring.ksh
 common/usdt/tst.onlyenabled.ksh
+common/usdt/tst.reap.ksh
 common/usdt/tst.reeval.ksh
 common/usdt/tst.static.ksh
 common/usdt/tst.static2.ksh

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs1.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs1.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs1.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -20,15 +20,13 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma	ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * ASSERTION:
- * 	Multiple aggregates can be used within the same D script.
+ *     Multiple aggregates can be used within the same D script.
  *
  * SECTION: Aggregations/Aggregations
  *
@@ -52,9 +50,11 @@
 	@c[pid] = avg(new_time);
 	@d[pid] = sum(new_time);
 	@e[pid] = quantize(new_time);
-	@f[timestamp] = max(new_time);
-	@g[timestamp] = quantize(new_time);
-	@h[timestamp] = lquantize(new_time, 0, 10000, 1000);
+	@f[pid] = stddev(new_time);
+	@g[timestamp] = max(new_time);
+	@h[timestamp] = quantize(new_time);
+	@i[timestamp] = lquantize(new_time, 0, 10000, 1000);
+
 	time_1 = time_2;
 	i++;
 }

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -20,18 +20,16 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma	ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * ASSERTION:
- *   Test multiple aggregations and the default output order
+ *     Test multiple aggregations and the default output order
  *
  * SECTION: Aggregations/Aggregations;
- *	Aggregations/Output
+ *     Aggregations/Output
  *
  */
 
@@ -51,6 +49,7 @@
 	@d = max(i);
 	@e = quantize(i);
 	@f = lquantize(i, 0, 1000, 100);
+	@g = stddev(i);
 
 	i += 100;
 }

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d.out
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d.out	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d.out	2016-10-14 02:18:41 UTC (rev 9162)
@@ -34,3 +34,4 @@
              900 |@@@@                                     1        
          >= 1000 |                                         0        
 
+              287

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -20,19 +20,17 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma	ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * ASSERTION:
- *   Test multiple aggregations and overriding default order with
- *   printa() statements.
+ *     Test multiple aggregations and overriding default order with
+ *     printa() statements.
  *
  * SECTION: Aggregations/Aggregations;
- *	Aggregations/Output
+ *     Aggregations/Output
  *
  * NOTES: This is a simple verifiable test.
  *
@@ -55,6 +53,7 @@
 	@e = max(i);
 	@f = quantize(i);
 	@g = lquantize(i, 0, 1000, 100);
+	@h = stddev(i);
 
 	i += 100;
 }
@@ -62,6 +61,7 @@
 tick-10ms
 /i == 1000/
 {
+	printa("%@d\n", @h);
 	printa("%@d\n", @g);
 	printa("%@d\n", @f);
 	printa("%@d\n", @e);

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d.out
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d.out	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d.out	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,3 +1,4 @@
+287
 
            value  ------------- Distribution ------------- count    
              < 0 |                                         0        

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -20,20 +20,19 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-
 /*
  * ASSERTION:
- *      Positive stddev() test
+ *     Positive stddev() test
  *
  * SECTION: Aggregations/Aggregations
  *
  * NOTES: This is a simple verifiable positive test of the stddev() function.
+ *     printa() for one aggregation, default printing behavior for the other
+ *     so that we exercise both code paths.
  */
 
 #pragma D option quiet
@@ -60,5 +59,6 @@
 	@b = stddev(-5000000700);
 	@b = stddev(-5000000800);
 	@b = stddev(-5000000900);
+	printa("%@d\n", @a);
 	exit(0);
 }

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d.out
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d.out	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d.out	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,3 +1,3 @@
+287
 
               287
-              287

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -26,7 +26,6 @@
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
-#include <sys/dtrace.h>
 
 #define INTFUNC(x)			\
 	BEGIN				\

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/assocs/tst.orthogonality.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/assocs/tst.orthogonality.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/assocs/tst.orthogonality.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -39,7 +39,7 @@
 }
 
 BEGIN
-/b[curthread->t_did] == 0/
+/b[curthread->td_flags] == 0/
 {
 	exit(0);
 }
@@ -46,6 +46,6 @@
 
 BEGIN
 {
-	printf("value should be 0; value is %x!", b[curthread->t_did]);
+	printf("value should be 0; value is %x!", b[curthread->td_flags]);
 	exit(1);
 }

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -78,5 +78,5 @@
 	exit $status
 fi
 
-/usr/bin/rm -f $tempfile
+/bin/rm -f $tempfile
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -44,7 +44,7 @@
 
 dtrace=$1
 
-$dtrace -qwm unix'{chill(15); printf("Done chilling"); exit(0);}'
+$dtrace -qwm kernel'{chill(15); printf("Done chilling"); exit(0);}'
 status=$?
 
 if [ "$status" -ne 0 ]; then

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationOut.d.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationOut.d.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationOut.d.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -69,5 +69,5 @@
 	exit 1
 fi
 
-/usr/bin/rm -f "d.out"
+/bin/rm -f "d.out"
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationWithO.d.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationWithO.d.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationWithO.d.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -70,5 +70,5 @@
 	exit 1
 fi
 
-/usr/bin/rm -f "outputFile"
+/bin/rm -f "outputFile"
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.PreprocessorStatement.d.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.PreprocessorStatement.d.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.PreprocessorStatement.d.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -43,7 +43,6 @@
 {
 	$dtrace -CH -s /dev/stdin <<EOF
 
-#include <stdio.h>
 
 	BEGIN
 	{

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoofew.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoofew.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoofew.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -34,7 +34,7 @@
  *
  */
 
-lockstat:genunix:mutex_enter:adaptive-acquire
+lockstat:kernel:mtx_lock:adaptive-acquire
 {
 	mutex_owned();
 	exit(1);

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoomany.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoomany.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoomany.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -34,7 +34,7 @@
  *
  */
 
-lockstat:genunix:mutex_enter:adaptive-acquire
+lockstat:kernel:mtx_lock:adaptive-acquire
 {
 	mutex_owned((kmutex_t *)arg0, 99);
 	exit(1);

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -36,7 +36,7 @@
  */
 
 
-lockstat:genunix:mutex_enter:adaptive-acquire
+lockstat:kernel:mtx_lock:adaptive-acquire
 {
 	mutex_type_adaptive();
 	exit(1);

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -35,7 +35,7 @@
  */
 
 
-lockstat:genunix:mutex_enter:adaptive-acquire
+lockstat:kernel:mtx_lock:adaptive-acquire
 {
 	mutex_type_adaptive((kmutex_t *)arg0, 99);
 	exit(1);

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.index.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.index.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.index.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -80,7 +80,7 @@
 	i++;
 
 	end = j = k = 0;
-	printf("#!/usr/perl5/bin/perl\n\nBEGIN {\n");
+	printf("#!/usr/bin/perl\n\nBEGIN {\n");
 }
 
 tick-1ms

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestFunctionLookup.java
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestFunctionLookup.java	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestFunctionLookup.java	2016-10-14 02:18:41 UTC (rev 9162)
@@ -20,10 +20,8 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
- *
- * ident	"%Z%%M%	%I%	%E% SMI"
  */
 
 import org.opensolaris.os.dtrace.*;
@@ -70,7 +68,7 @@
 			    long addr = (Long)address;
 			    f = consumer.lookupKernelFunction(addr);
 			}
-			if (f.equals("genunix`setrun")) {
+			if (f.equals("genunix`cv_wakeup")) {
 			    System.out.println(f);
 			    done = true;
 			}

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.ksh.out
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.ksh.out	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.ksh.out	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,3 +1,3 @@
-genunix`setrun
+genunix`cv_wakeup
 3
 tst.FunctionLookup.exe`f1

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -31,7 +31,7 @@
 fi
 
 dtrace=$1
-CC=/usr/sfw/bin/gcc
+CC=/usr/bin/gcc
 CFLAGS=
 
 doit()

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.schrock.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.schrock.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.schrock.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -39,7 +39,7 @@
 # LD_NOEXEC_64 variable prevents nm from re-execing itself.
 #
 LD_NOEXEC_64=tomeeisrad $dtrace -F -s /dev/stdin -c \
-    '/usr/ccs/bin/nm /bin/ls' stat <<EOF
+    '/usr/bin/nm /bin/ls' stat <<EOF
 
 pid\$target::\$1:entry
 {

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.exe
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.exe	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.exe	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # CDDL HEADER START
 #

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.fork.c
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.fork.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.fork.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -56,7 +56,7 @@
 	while (waiting(&a) == 0)
 		continue;
 
-	(void) forkall();
+	(void) fork();
 	(void) go();
 
 	return (0);

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -28,6 +28,7 @@
 
 #include <spawn.h>
 #include <signal.h>
+#include <stdio.h>
 
 void
 go(void)
@@ -34,7 +35,7 @@
 {
 	pid_t pid;
 
-	(void) posix_spawn(&pid, "/usr/bin/ls", NULL, NULL, NULL, NULL);
+	(void) posix_spawn(&pid, "/bin/ls", NULL, NULL, NULL, NULL);
 
 	(void) waitpid(pid, NULL, 0);
 }

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.probemod.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.probemod.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.probemod.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -21,11 +21,9 @@
 #
 
 #
-# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
@@ -40,7 +38,7 @@
 # (and therefore 'libc' and 'libc.so') as it's definitely there.
 #
 
-for lib in libc libc.so libc.so.1; do
+for lib in libc libc.so libc.so.1 'lib[c]*'; do
 	sleep 60 &
 	pid=$!
 	dtrace -n "pid$pid:$lib::entry" -n 'tick-2s{exit(0);}'

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -88,6 +88,6 @@
 status=$?
 
 cd /tmp
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -126,6 +126,6 @@
 status=$?
 
 cd /tmp
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -97,6 +97,6 @@
 status=$?
 
 cd /tmp
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -149,6 +149,6 @@
 status=$?
 
 cd /tmp
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress5.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress5.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress5.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION:
@@ -32,16 +34,16 @@
  * a runtime error.
  *
  * SECTION: Pointers and Arrays/Generic Pointers
- *
- * NOTES:
- * This test doesn't apply to x86; for the time being, we're working
- * around this with the preprocessor.
  */
 
 #pragma D option quiet
 
-int array[3];
-uintptr_t uptr;
+#if defined(__i386) || defined(__amd64)
+#define __x86 1
+#endif
+
+int array[2];
+char *ptr;
 int *p;
 int *q;
 int *r;
@@ -48,23 +50,26 @@
 
 BEGIN
 {
-#ifdef __i386
-	exit(1);
-#else
-	array[0] = 20;
-	array[1] = 40;
-	array[2] = 80;
+	array[0] = 0x12345678;
+	array[1] = 0xabcdefff;
 
-	uptr = (uintptr_t) &array[0];
+	ptr = (char *) &array[0];
 
-	p = (int *) (uptr);
-	q = (int *) (uptr + 2);
-	r = (int *) (uptr + 3);
+	p = (int *) (ptr);
+	q = (int *) (ptr + 2);
+	r = (int *) (ptr + 3);
 
-	printf("array[0]: %d\t*p: %d\n", array[0], *p);
-	printf("array[1]: %d\t*q: %d\n", array[1], *q);
-	printf("array[2]: %d\t*r: %d\n", array[2], *r);
+	printf("*p: 0x%x\n", *p);
+	printf("*q: 0x%x\n", *q);
+	printf("*r: 0x%x\n", *r);
 
+	/*
+	 * On x86, the above unaligned memory accesses are allowed and should
+	 * not result in the ERROR probe firing.
+	 */
+#ifdef __x86
+	exit(1);
+#else
 	exit(0);
 #endif
 }
@@ -71,5 +76,9 @@
 
 ERROR
 {
+#ifdef __x86
+	exit(0);
+#else
 	exit(1);
+#endif
 }

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.basics.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.basics.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.basics.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -20,15 +20,13 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * ASSERTION:
- *  Test the basic formatting of all the supported kinds of aggregations.
+ *     Test the basic formatting of all the supported kinds of aggregations.
  *
  * SECTION: Output Formatting/printa()
  *
@@ -45,6 +43,7 @@
 	@e = min(1);
 	@f = sum(1);
 	@g = quantize(1);
+	@h = stddev(1);
 
 	printa("@a = %@u\n", @a);
 	printa("@b = %@u\n", @b);
@@ -53,6 +52,7 @@
 	printa("@e = %@u\n", @e);
 	printa("@f = %@u\n", @f);
 	printa("@g = %@d\n", @g);
+	printa("@h = %@d\n", @h);
 
 	exit(0);
 }

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.basics.d.out
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.basics.d.out	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.basics.d.out	2016-10-14 02:18:41 UTC (rev 9162)
@@ -15,4 +15,5 @@
                1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
                2 |                                         0        
 
+ at h = 0
 

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.walltimestamp.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.walltimestamp.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.walltimestamp.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -33,7 +33,7 @@
 dtrace=$1
 
 # The output files assumes the timezone is US/Pacific
-TZ=US/Pacific
+export TZ=America/Los_Angeles
 
 $dtrace -s /dev/stdin <<EOF
 #pragma D option quiet

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -33,7 +33,7 @@
 dtrace=$1
 
 # The output files assumes the timezone is US/Pacific
-TZ=US/Pacific
+export TZ=America/Los_Angeles
 
 $dtrace -s /dev/stdin <<EOF
 #pragma D option quiet

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -33,7 +33,7 @@
 dtrace=$1
 
 # The output files assumes the timezone is US/Pacific
-TZ=US/Pacific
+export TZ=America/Los_Angeles
 
 $dtrace -s /dev/stdin <<EOF
 #pragma D option quiet

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -20,12 +20,10 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * ASSERTION:
  *  Test printf() with a simple string argument.
@@ -38,6 +36,6 @@
 
 BEGIN
 {
-	printf("rootfs = %s", `rootfs.bo_fstype);
+	printf("sysname = %s", `utsname.sysname);
 	exit(0);
 }

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1 +1 @@
-rootfs = ufs
+sysname = SunOS

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -38,6 +38,6 @@
 
 BEGIN
 {
-	printf("symbol = %a", &`kmem_flags);
+	printf("symbol = %a", &`kmem_alloc);
 	exit(0);
 }

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1 +1 @@
-symbol = genunix`kmem_flags
+symbol = kernel`kmem_alloc

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exec.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exec.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exec.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -41,7 +41,7 @@
 		self->exec = 1;
 	}
 
-	proc:::exec_success
+	proc:::exec-success
 	/self->exec/
 	{
 		exit(0);

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -42,7 +42,7 @@
 		self->exec = 1;
 	}
 
-	proc:::exec_failure
+	proc:::exec-failure
 	/self->exec && args[0] == ENOENT/
 	{
 		exit(0);

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -45,7 +45,7 @@
 		self->exec = 1;
 	}
 
-	proc:::exec_failure
+	proc:::exec-failure
 	/self->exec/
 	{
 		exit(0);

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.sigwait.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.sigwait.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.sigwait.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -28,13 +28,13 @@
 
 #pragma D option destructive
 
-proc:::signal_send
+proc:::signal-send
 /args[1]->p_pid == $1 && args[2] == SIGUSR1/
 {
 	sent = 1;
 }
 
-proc:::signal_clear
+proc:::signal-clear
 /pid == $1 && args[0] == SIGUSR1 && sent/
 {
 	exit(0);

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -70,11 +70,11 @@
 grep "D_MACRO_UNUSED" /var/tmp/err.$$.txt >/dev/null 2>&1
 if [ $? -ne 0 ]; then
 	print -u2 "Expected error D_MACRO_UNUSED not returned"
-	/usr/bin/rm -f /var/tmp/err.$$.txt
+	/bin/rm -f /var/tmp/err.$$.txt
 	exit 1
 fi
 
-/usr/bin/rm -f $dfilename
-/usr/bin/rm -f /var/tmp/err.$$.txt
+/bin/rm -f $dfilename
+/bin/rm -f /var/tmp/err.$$.txt
 
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -42,7 +42,7 @@
 
 dtrace=$1
 
-bname=`/bin/basename $0`
+bname=`/usr/bin/basename $0`
 
 dfilename=/var/tmp/$bname.$$
 
@@ -85,6 +85,6 @@
 	exit 1
 fi
 
-/usr/bin/rm -f $dfilename
+/bin/rm -f $dfilename
 exit 0
 

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -43,7 +43,7 @@
 fi
 
 dtrace=$1
-bname=`/bin/basename $0`
+bname=`/usr/bin/basename $0`
 dfilename=/var/tmp/$bname.$$.d
 
 ## Create .d file
@@ -70,7 +70,7 @@
 #chmod 555 the .d file
 
 chmod 555 $dfilename >/dev/null 2>&1
-if [ &? -ne 0 ]; then
+if [ $? -ne 0 ]; then
 	print -u2 "chmod $dfilename failed"
 	exit 1
 fi
@@ -77,7 +77,7 @@
 
 #Get the groupid of the calling process using ps
 
-groupid=`ps -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+groupid=`ps -o pid,pgid | grep "$$ " | awk '{print $2}' 2>/dev/null`
 if [ $? -ne 0 ]; then
 	print -u2 "unable to get uid of the current process with pid = $$"
 	exit 1
@@ -93,5 +93,5 @@
 
 #Cleanup leftovers
 
-/usr/bin/rm -f $dfilename
+/bin/rm -f $dfilename
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -82,5 +82,5 @@
 	exit 1
 fi
 
-#/usr/bin/rm -f $dfilename
+#/bin/rm -f $dfilename
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -82,5 +82,5 @@
 	exit 1
 fi
 
-#/usr/bin/rm -f $dfilename
+#/bin/rm -f $dfilename
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -82,5 +82,5 @@
 	exit 1
 fi
 
-#/usr/bin/rm -f $dfilename
+#/bin/rm -f $dfilename
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -82,5 +82,5 @@
 	exit 1
 fi
 
-#/usr/bin/rm -f $dfilename
+#/bin/rm -f $dfilename
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -82,5 +82,5 @@
 	exit 1
 fi
 
-#/usr/bin/rm -f $dfilename
+#/bin/rm -f $dfilename
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -74,5 +74,5 @@
 	exit 1
 fi
 
-/usr/bin/rm -f $dfilename
+/bin/rm -f $dfilename
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -82,5 +82,5 @@
 	exit 1
 fi
 
-#/usr/bin/rm -f $dfilename
+#/bin/rm -f $dfilename
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -82,5 +82,5 @@
 	exit 1
 fi
 
-#/usr/bin/rm -f $dfilename
+#/bin/rm -f $dfilename
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.c
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -19,12 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <libsysevent.h>
 #include <stdio.h>
 
@@ -42,7 +40,7 @@
 	for (;;) {
 		if (sysevent_evc_publish(ch, "class_dtest", "subclass_dtest",
 		    "vendor_dtest", "publisher_dtest", NULL, EVCH_SLEEP) != 0) {
-			sysevent_evc_unbind(ch);
+			(void) sysevent_evc_unbind(ch);
 			(void) fprintf(stderr, "failed to publisth sysevent\n");
 			return (1);
 		}

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -79,6 +79,6 @@
 fi
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -125,7 +125,7 @@
 }
 EOF
 
-/usr/ccs/bin/make > /dev/null
+/usr/bin/make > /dev/null
 if [ $? -ne 0 ]; then
 	print -u2 "failed to build"
 	exit 1
@@ -154,6 +154,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -136,7 +136,7 @@
 }
 EOF
 
-/usr/ccs/bin/make > /dev/null
+/usr/bin/make > /dev/null
 if [ $? -ne 0 ]; then
 	print -u2 "failed to build"
 	exit 1
@@ -155,6 +155,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -131,7 +131,7 @@
 }
 EOF
 
-/usr/ccs/bin/make > /dev/null
+/usr/bin/make > /dev/null
 if [ $? -ne 0 ]; then
 	print -u2 "failed to build"
 	exit 1
@@ -165,6 +165,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -101,6 +101,6 @@
 fi
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit 0

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -91,6 +91,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -108,6 +108,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -113,6 +113,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -100,6 +100,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -91,6 +91,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -95,6 +95,6 @@
 fi
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.header.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.header.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.header.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -82,4 +82,4 @@
 fi
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.include.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.include.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.include.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -56,6 +56,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -79,4 +79,4 @@
 fi
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -81,4 +81,4 @@
 fi
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -94,6 +94,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -85,6 +85,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -79,4 +79,4 @@
 fi
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -93,6 +93,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -93,6 +93,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -103,6 +103,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.user.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.user.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.user.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -91,6 +91,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/vars/tst.ucaller.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/vars/tst.ucaller.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/vars/tst.ucaller.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -38,7 +38,7 @@
 
 dtrace=$1
 
-$dtrace -qs /dev/stdin -c "/usr/bin/echo" <<EOF
+$dtrace -qs /dev/stdin -c "/bin/echo" <<EOF
 pid\$target:ld.so.1:calloc:entry
 {
 	self->calloc = 1;

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i386/funcs/tst.badcopyin.d
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i386/funcs/tst.badcopyin.d	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i386/funcs/tst.badcopyin.d	2016-10-14 02:18:41 UTC (rev 9162)
@@ -20,12 +20,10 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * ASSERTION:
  *	On IA/32, there is a single 32-bit address space that is partitioned
@@ -43,11 +41,12 @@
 
 BEGIN
 {
-	lbolt = copyin((uintptr_t)&`lbolt, sizeof (int));
+	dtrace_zero = copyin((uintptr_t)&`dtrace_zero, sizeof (int));
 	exit(1);
 }
 
 ERROR
 {
-	exit(arg4 == DTRACEFLT_BADADDR && arg5 == (uint64_t)&`lbolt ? 0 : 1);
+	exit(arg4 == DTRACEFLT_BADADDR &&
+	    arg5 == (uint64_t)&`dtrace_zero ? 0 : 1);
 }

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -20,11 +20,9 @@
 #
 
 #
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 # ASSERTION: Make sure that we can map in and read the Xen trace buffers.
@@ -48,13 +46,13 @@
 {
 	$dtrace -qs /dev/stdin <<EOF
 	xdt:sched::on-cpu
-	/arg1 == 0/
+	/arg0 == 0/
 	{
 		self->on++;
 	}
 
 	xdt:sched::off-cpu
-	/arg1 == 0 && self->on/
+	/arg0 == 0 && self->on/
 	{
 		self->off++;
 	}

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedargs.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedargs.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedargs.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -20,11 +20,9 @@
 #
 
 #
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 # ASSERTION: Sched probe arguments should be valid. 
@@ -56,7 +54,7 @@
 	xdt:sched::yield
 	{
 		/* print domid vcpu pcpu probename */
-		printf("%d %d %d %s\n", arg1, arg2, arg0, probename);
+		printf("%d %d %d %s\n", arg0, arg1, \`xdt_curpcpu, probename);
 	}
 EOF
 }

Modified: trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/sparc/usdt/tst.tailcall.ksh
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/sparc/usdt/tst.tailcall.ksh	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/dtrace/test/tst/sparc/usdt/tst.tailcall.ksh	2016-10-14 02:18:41 UTC (rev 9162)
@@ -76,7 +76,7 @@
 };
 EOF
 
-/usr/ccs/bin/as -xregsym=no -P -D_ASM -o test.o test.s
+/usr/bin/as -xregsym=no -P -D_ASM -o test.o test.s
 if [ $? -ne 0 ]; then
 	print -u2 "failed to compile test.s"
 	exit 1
@@ -127,6 +127,6 @@
 status=$?
 
 cd /
-/usr/bin/rm -rf $DIR
+/bin/rm -rf $DIR
 
 exit $status

Modified: trunk/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/cmd/sgs/include/_string_table.h
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/sgs/include/_string_table.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/sgs/include/_string_table.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/cmd/sgs/include/alist.h
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/sgs/include/alist.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/sgs/include/alist.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/cmd/sgs/include/debug.h
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/sgs/include/debug.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/sgs/include/debug.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/cmd/sgs/include/sgs.h
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/sgs/include/sgs.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/sgs/include/sgs.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/cmd/sgs/include/string_table.h
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/sgs/include/string_table.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/sgs/include/string_table.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/findprime.c
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/findprime.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/findprime.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/string_table.c
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/string_table.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/sgs/tools/common/string_table.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/cmd/zdb/zdb.8
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/zdb/zdb.8	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/zdb/zdb.8	2016-10-14 02:18:41 UTC (rev 9162)
@@ -16,7 +16,7 @@
 .\" Copyright (c) 2012, Marcelo Araujo <araujo at FreeBSD.org>.
 .\" All Rights Reserved.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: release/9.2.0/cddl/contrib/opensolaris/cmd/zdb/zdb.8 243674 2012-11-29 14:05:04Z mm $
 .\"
 .Dd May 10, 2012
 .Dt ZDB 8

Modified: trunk/cddl/contrib/opensolaris/cmd/zfs/zfs.8
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/zfs/zfs.8	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/zfs/zfs.8	2016-10-14 02:18:41 UTC (rev 9162)
@@ -19,13 +19,16 @@
 .\"
 .\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
 .\" Copyright (c) 2012 by Delphix. All rights reserved.
-.\" Copyright (c) 2012 Nexenta Systems, Inc. All Rights Reserved.
 .\" Copyright (c) 2012, Joyent, Inc. All rights reserved.
 .\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd at FreeBSD.org>
+.\" Copyright (c) 2012, Bryan Drewery <bdrewery at FreeBSD.org>
+.\" Copyright (c) 2012, Glen Barber <gjb at FreeBSD.org>
+.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
+.\" Copyright (c) 2013 Nexenta Systems, Inc. All Rights Reserved.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: release/9.2.0/cddl/contrib/opensolaris/cmd/zfs/zfs.8 250277 2013-05-05 16:42:06Z gavin $
 .\"
-.Dd March 31, 2013
+.Dd March 21, 2013
 .Dt ZFS 8
 .Os
 .Sh NAME
@@ -1190,7 +1193,7 @@
 .Sy sharenfs
 property is changed for a dataset, the
 .Xr mountd 8
-dameon is reloaded.
+daemon is reloaded.
 .It Sy logbias Ns = Ns Cm latency | throughput
 Provide a hint to
 .Tn ZFS

Modified: trunk/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -28,6 +28,7 @@
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel at dawidek.net>.
  * All rights reserved.
  * Copyright (c) 2012 Martin Matuska <mm at FreeBSD.org>. All rights reserved.
+ * Copyright (c) 2013 Steven Hartland.  All rights reserved.
  */
 
 #include <assert.h>
@@ -5222,8 +5223,7 @@
 			continue;
 		}
 		if (holding) {
-			if (zfs_hold(zhp, delim+1, tag, recursive,
-			    B_FALSE, -1) != 0)
+			if (zfs_hold(zhp, delim+1, tag, recursive, -1) != 0)
 				++errors;
 		} else {
 			if (zfs_release(zhp, delim+1, tag, recursive) != 0)
@@ -5590,8 +5590,8 @@
 
 		(void) fprintf(stderr, gettext("cannot share '%s': "
 		    "legacy share\n"), zfs_get_name(zhp));
-		(void) fprintf(stderr, gettext("use share(1M) to "
-		    "share this filesystem, or set "
+		(void) fprintf(stderr, gettext("to "
+		    "share this filesystem set "
 		    "sharenfs property on\n"));
 		return (1);
 	}
@@ -5607,7 +5607,7 @@
 
 		(void) fprintf(stderr, gettext("cannot %s '%s': "
 		    "legacy mountpoint\n"), cmdname, zfs_get_name(zhp));
-		(void) fprintf(stderr, gettext("use %s(1M) to "
+		(void) fprintf(stderr, gettext("use %s(8) to "
 		    "%s this filesystem\n"), cmdname, cmdname);
 		return (1);
 	}
@@ -6045,8 +6045,10 @@
 		    strcmp(smbshare_prop, "off") == 0) {
 			(void) fprintf(stderr, gettext("cannot unshare "
 			    "'%s': legacy share\n"), path);
+#ifdef illumos
 			(void) fprintf(stderr, gettext("use "
 			    "unshare(1M) to unshare this filesystem\n"));
+#endif
 		} else if (!zfs_is_shared(zhp)) {
 			(void) fprintf(stderr, gettext("cannot unshare '%s': "
 			    "not currently shared\n"), path);
@@ -6065,7 +6067,7 @@
 			(void) fprintf(stderr, gettext("cannot unmount "
 			    "'%s': legacy mountpoint\n"),
 			    zfs_get_name(zhp));
-			(void) fprintf(stderr, gettext("use umount(1M) "
+			(void) fprintf(stderr, gettext("use umount(8) "
 			    "to unmount this filesystem\n"));
 		} else {
 			ret = zfs_unmountall(zhp, flags);
@@ -6287,9 +6289,11 @@
 				(void) fprintf(stderr, gettext("cannot "
 				    "unshare '%s': legacy share\n"),
 				    zfs_get_name(zhp));
+#ifdef illumos
 				(void) fprintf(stderr, gettext("use "
 				    "unshare(1M) to unshare this "
 				    "filesystem\n"));
+#endif
 				ret = 1;
 			} else if (!zfs_is_shared(zhp)) {
 				(void) fprintf(stderr, gettext("cannot "
@@ -6307,7 +6311,7 @@
 				    "unmount '%s': legacy "
 				    "mountpoint\n"), zfs_get_name(zhp));
 				(void) fprintf(stderr, gettext("use "
-				    "umount(1M) to unmount this "
+				    "umount(8) to unmount this "
 				    "filesystem\n"));
 				ret = 1;
 			} else if (!zfs_is_mounted(zhp, NULL)) {
@@ -6493,12 +6497,12 @@
 		}
 	} else {
 		(void) fprintf(stderr, gettext("filesystem '%s' cannot be "
-		    "mounted using 'mount -F zfs'\n"), dataset);
+		    "mounted using 'mount -t zfs'\n"), dataset);
 		(void) fprintf(stderr, gettext("Use 'zfs set mountpoint=%s' "
 		    "instead.\n"), path);
-		(void) fprintf(stderr, gettext("If you must use 'mount -F zfs' "
-		    "or /etc/vfstab, use 'zfs set mountpoint=legacy'.\n"));
-		(void) fprintf(stderr, gettext("See zfs(1M) for more "
+		(void) fprintf(stderr, gettext("If you must use 'mount -t zfs' "
+		    "or /etc/fstab, use 'zfs set mountpoint=legacy'.\n"));
+		(void) fprintf(stderr, gettext("See zfs(8) for more "
 		    "information.\n"));
 		ret = 1;
 	}

Modified: trunk/cddl/contrib/opensolaris/cmd/zhack/zhack.c
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/zhack/zhack.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/zhack/zhack.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 Steven Hartland. All rights reserved.
  */
 
 /*
@@ -153,7 +154,7 @@
 	g_importargs.poolname = g_pool;
 	pools = zpool_search_import(g_zfs, &g_importargs);
 
-	if (pools == NULL || nvlist_next_nvpair(pools, NULL) == NULL) {
+	if (nvlist_empty(pools)) {
 		if (!g_importargs.can_be_active) {
 			g_importargs.can_be_active = B_TRUE;
 			if (zpool_search_import(g_zfs, &g_importargs) != NULL ||

Modified: trunk/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7	2016-10-14 02:18:41 UTC (rev 9162)
@@ -20,7 +20,7 @@
 .\" Copyright (c) 2012 by Delphix. All rights reserved.
 .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
 .\"
-.\" $FreeBSD$
+.\" $FreeBSD: release/9.2.0/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 247309 2013-02-26 05:58:05Z delphij $
 .\"
 .Dd February 8, 2013
 .Dt ZPOOL-FEATURES 7

Modified: trunk/cddl/contrib/opensolaris/cmd/zpool/zpool.8
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/zpool/zpool.8	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/zpool/zpool.8	2016-10-14 02:18:41 UTC (rev 9162)
@@ -23,7 +23,7 @@
 .\" Copyright (c) 2012 by Delphix. All Rights Reserved.
 .\" Copyright (c) 2012, Glen Barber <gjb at FreeBSD.org>
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: release/9.2.0/cddl/contrib/opensolaris/cmd/zpool/zpool.8 248369 2013-03-16 08:16:11Z mm $
 .\"
 .Dd March 14, 2013
 .Dt ZPOOL 8

Modified: trunk/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -804,6 +804,7 @@
 				goto errout;
 			break;
 		case 'm':
+			/* Equivalent to -O mountpoint=optarg */
 			mountpoint = optarg;
 			break;
 		case 'o':
@@ -842,8 +843,18 @@
 			*propval = '\0';
 			propval++;
 
-			if (add_prop_list(optarg, propval, &fsprops, B_FALSE))
+			/*
+			 * Mountpoints are checked and then added later.
+			 * Uniquely among properties, they can be specified
+			 * more than once, to avoid conflict with -m.
+			 */
+			if (0 == strcmp(optarg,
+			    zfs_prop_to_name(ZFS_PROP_MOUNTPOINT))) {
+				mountpoint = propval;
+			} else if (add_prop_list(optarg, propval, &fsprops,
+			    B_FALSE)) {
 				goto errout;
+			}
 			break;
 		case ':':
 			(void) fprintf(stderr, gettext("missing argument for "
@@ -960,6 +971,18 @@
 		}
 	}
 
+	/*
+	 * Now that the mountpoint's validity has been checked, ensure that
+	 * the property is set appropriately prior to creating the pool.
+	 */
+	if (mountpoint != NULL) {
+		ret = add_prop_list(zfs_prop_to_name(ZFS_PROP_MOUNTPOINT),
+		    mountpoint, &fsprops, B_FALSE);
+		if (ret != 0)
+			goto errout;
+	}
+
+	ret = 1;
 	if (dryrun) {
 		/*
 		 * For a dry run invocation, print out a basic message and run
@@ -994,21 +1017,19 @@
 				if (nvlist_exists(props, propname))
 					continue;
 
-				if (add_prop_list(propname, ZFS_FEATURE_ENABLED,
-				    &props, B_TRUE) != 0)
+				ret = add_prop_list(propname,
+				    ZFS_FEATURE_ENABLED, &props, B_TRUE);
+				if (ret != 0)
 					goto errout;
 			}
 		}
+
+		ret = 1;
 		if (zpool_create(g_zfs, poolname,
 		    nvroot, props, fsprops) == 0) {
 			zfs_handle_t *pool = zfs_open(g_zfs, poolname,
 			    ZFS_TYPE_FILESYSTEM);
 			if (pool != NULL) {
-				if (mountpoint != NULL)
-					verify(zfs_prop_set(pool,
-					    zfs_prop_to_name(
-					    ZFS_PROP_MOUNTPOINT),
-					    mountpoint) == 0);
 				if (zfs_mount(pool, NULL, 0) == 0)
 					ret = zfs_shareall(pool);
 				zfs_close(pool);
@@ -5322,10 +5343,9 @@
 		 * 'freeze' is a vile debugging abomination, so we treat
 		 * it as such.
 		 */
-		char buf[16384];
-		int fd = open(ZFS_DEV, O_RDWR);
-		(void) strcpy((void *)buf, argv[2]);
-		return (!!ioctl(fd, ZFS_IOC_POOL_FREEZE, buf));
+		zfs_cmd_t zc = { 0 };
+		(void) strlcpy(zc.zc_name, argv[2], sizeof (zc.zc_name));
+		return (!!zfs_ioctl(g_zfs, ZFS_IOC_POOL_FREEZE, &zc));
 	} else {
 		(void) fprintf(stderr, gettext("unrecognized "
 		    "command '%s'\n"), cmdname);

Modified: trunk/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1	2016-10-14 02:18:41 UTC (rev 9162)
@@ -19,7 +19,7 @@
 .\"
 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD$
 .\"
 .Dd November 26, 2011
 .Dt ZSTREAMDUMP 8

Modified: trunk/cddl/contrib/opensolaris/cmd/ztest/ztest.c
===================================================================
--- trunk/cddl/contrib/opensolaris/cmd/ztest/ztest.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/cmd/ztest/ztest.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -23,6 +23,7 @@
  * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2012 Martin Matuska <mm at FreeBSD.org>.  All rights reserved.
+ * Copyright (c) 2013 Steven Hartland. All rights reserved.
  */
 
 /*
@@ -2300,7 +2301,7 @@
 	 * We grab the zd_dirobj_lock to ensure that no other thread is
 	 * updating the zil (i.e. adding in-memory log records) and the
 	 * zd_zilog_lock to block any I/O.
- 	 */
+	 */
 	VERIFY0(mutex_lock(&zd->zd_dirobj_lock));
 	(void) rw_wrlock(&zd->zd_zilog_lock);
 
@@ -4509,7 +4510,7 @@
 	 */
 	tmp_cb = list_head(&zcl.zcl_callbacks);
 	if (tmp_cb != NULL &&
-	    tmp_cb->zcd_txg > txg - ZTEST_COMMIT_CALLBACK_THRESH) {
+	    (txg - ZTEST_COMMIT_CALLBACK_THRESH) > tmp_cb->zcd_txg) {
 		fatal(0, "Commit callback threshold exceeded, oldest txg: %"
 		    PRIu64 ", open txg: %" PRIu64 "\n", tmp_cb->zcd_txg, txg);
 	}
@@ -4713,7 +4714,7 @@
 
 	error = user_release_one(fullname, tag);
 	if (error)
-		fatal(0, "user_release_one(%s)", fullname, tag);
+		fatal(0, "user_release_one(%s, %s) = %d", fullname, tag, error);
 
 	VERIFY3U(dmu_objset_hold(fullname, FTAG, &origin), ==, ENOENT);
 

Modified: trunk/cddl/contrib/opensolaris/common/avl/avl.c
===================================================================
--- trunk/cddl/contrib/opensolaris/common/avl/avl.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/common/avl/avl.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -20,13 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-
 /*
  * AVL - generic AVL tree implementation for kernel use
  *
@@ -244,7 +240,7 @@
  *	"void *"  of the found tree node
  */
 void *
-avl_find(avl_tree_t *tree, void *value, avl_index_t *where)
+avl_find(avl_tree_t *tree, const void *value, avl_index_t *where)
 {
 	avl_node_t *node;
 	avl_node_t *prev = NULL;
@@ -809,6 +805,64 @@
 	} while (parent != NULL);
 }
 
+#define	AVL_REINSERT(tree, obj)		\
+	avl_remove((tree), (obj));	\
+	avl_add((tree), (obj))
+
+boolean_t
+avl_update_lt(avl_tree_t *t, void *obj)
+{
+	void *neighbor;
+
+	ASSERT(((neighbor = AVL_NEXT(t, obj)) == NULL) ||
+	    (t->avl_compar(obj, neighbor) <= 0));
+
+	neighbor = AVL_PREV(t, obj);
+	if ((neighbor != NULL) && (t->avl_compar(obj, neighbor) < 0)) {
+		AVL_REINSERT(t, obj);
+		return (B_TRUE);
+	}
+
+	return (B_FALSE);
+}
+
+boolean_t
+avl_update_gt(avl_tree_t *t, void *obj)
+{
+	void *neighbor;
+
+	ASSERT(((neighbor = AVL_PREV(t, obj)) == NULL) ||
+	    (t->avl_compar(obj, neighbor) >= 0));
+
+	neighbor = AVL_NEXT(t, obj);
+	if ((neighbor != NULL) && (t->avl_compar(obj, neighbor) > 0)) {
+		AVL_REINSERT(t, obj);
+		return (B_TRUE);
+	}
+
+	return (B_FALSE);
+}
+
+boolean_t
+avl_update(avl_tree_t *t, void *obj)
+{
+	void *neighbor;
+
+	neighbor = AVL_PREV(t, obj);
+	if ((neighbor != NULL) && (t->avl_compar(obj, neighbor) < 0)) {
+		AVL_REINSERT(t, obj);
+		return (B_TRUE);
+	}
+
+	neighbor = AVL_NEXT(t, obj);
+	if ((neighbor != NULL) && (t->avl_compar(obj, neighbor) > 0)) {
+		AVL_REINSERT(t, obj);
+		return (B_TRUE);
+	}
+
+	return (B_FALSE);
+}
+
 /*
  * initialize a new AVL tree
  */
@@ -854,6 +908,12 @@
 	return (tree->avl_numnodes);
 }
 
+boolean_t
+avl_is_empty(avl_tree_t *tree)
+{
+	ASSERT(tree);
+	return (tree->avl_numnodes == 0);
+}
 
 #define	CHILDBIT	(1L)
 

Modified: trunk/cddl/contrib/opensolaris/common/ctf/ctf_create.c
===================================================================
--- trunk/cddl/contrib/opensolaris/common/ctf/ctf_create.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/common/ctf/ctf_create.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/common/ctf/ctf_decl.c
===================================================================
--- trunk/cddl/contrib/opensolaris/common/ctf/ctf_decl.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/common/ctf/ctf_decl.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/common/ctf/ctf_error.c
===================================================================
--- trunk/cddl/contrib/opensolaris/common/ctf/ctf_error.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/common/ctf/ctf_error.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/common/ctf/ctf_hash.c
===================================================================
--- trunk/cddl/contrib/opensolaris/common/ctf/ctf_hash.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/common/ctf/ctf_hash.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/common/ctf/ctf_impl.h
===================================================================
--- trunk/cddl/contrib/opensolaris/common/ctf/ctf_impl.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/common/ctf/ctf_impl.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/common/ctf/ctf_labels.c
===================================================================
--- trunk/cddl/contrib/opensolaris/common/ctf/ctf_labels.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/common/ctf/ctf_labels.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c
===================================================================
--- trunk/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/common/ctf/ctf_open.c
===================================================================
--- trunk/cddl/contrib/opensolaris/common/ctf/ctf_open.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/common/ctf/ctf_open.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/common/ctf/ctf_types.c
===================================================================
--- trunk/cddl/contrib/opensolaris/common/ctf/ctf_types.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/common/ctf/ctf_types.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/common/ctf/ctf_util.c
===================================================================
--- trunk/cddl/contrib/opensolaris/common/ctf/ctf_util.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/common/ctf/ctf_util.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/cddl/contrib/opensolaris/head/libintl.h
===================================================================
--- trunk/cddl/contrib/opensolaris/head/libintl.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/head/libintl.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * 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.
@@ -20,11 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-/* Libintl is a library of advanced internationalization functions. */
 
 #ifndef	_LIBINTL_H
 #define	_LIBINTL_H
@@ -63,6 +61,9 @@
 
 #define	TEXTDOMAINMAX	256
 
+#define	__GNU_GETTEXT_SUPPORTED_REVISION(m)	\
+	((((m) == 0) || ((m) == 1)) ? 1 : -1)
+
 #ifdef __STDC__
 extern char *dcgettext(const char *, const char *, const int);
 extern char *dgettext(const char *, const char *);

Modified: trunk/cddl/contrib/opensolaris/head/synch.h
===================================================================
--- trunk/cddl/contrib/opensolaris/head/synch.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/head/synch.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * 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.
@@ -19,16 +18,14 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #ifndef	_SYNCH_H
 #define	_SYNCH_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * synch.h:
  * definitions needed to use the thread synchronization interface
@@ -81,12 +78,12 @@
  * Because we have to deal with C++, we cannot redefine this one as that one.
  */
 typedef struct _rwlock {
-	int32_t		readers;	/* -1 == writer else # of readers */
+	int32_t		readers;	/* rwstate word */
 	uint16_t	type;
 	uint16_t	magic;
-	mutex_t		mutex;		/* used to indicate ownership */
-	cond_t		readercv;	/* unused */
-	cond_t		writercv;	/* unused */
+	mutex_t		mutex;		/* used with process-shared rwlocks */
+	cond_t		readercv;	/* used only to indicate ownership */
+	cond_t		writercv;	/* used only to indicate ownership */
 } rwlock_t;
 
 #ifdef	__STDC__
@@ -111,6 +108,7 @@
 int	cond_broadcast(cond_t *);
 int	mutex_init(mutex_t *, int, void *);
 int	mutex_destroy(mutex_t *);
+int	mutex_consistent(mutex_t *);
 int	mutex_lock(mutex_t *);
 int	mutex_trylock(mutex_t *);
 int	mutex_unlock(mutex_t *);
@@ -152,6 +150,7 @@
 int	cond_broadcast();
 int	mutex_init();
 int	mutex_destroy();
+int	mutex_consistent();
 int	mutex_lock();
 int	mutex_trylock();
 int	mutex_unlock();
@@ -241,10 +240,17 @@
 
 #ifdef	__STDC__
 
-int _sema_held(sema_t *);
-int _rw_read_held(rwlock_t *);
-int _rw_write_held(rwlock_t *);
-int _mutex_held(mutex_t *);
+/*
+ * The *_held() functions apply equally well to Solaris threads
+ * and to Posix threads synchronization objects, but the formal
+ * type declarations are different, so we just declare the argument
+ * to each *_held() function to be a void *, expecting that they will
+ * be called with the proper type of argument in each case.
+ */
+int _sema_held(void *);			/* sema_t or sem_t */
+int _rw_read_held(void *);		/* rwlock_t or pthread_rwlock_t */
+int _rw_write_held(void *);		/* rwlock_t or pthread_rwlock_t */
+int _mutex_held(void *);		/* mutex_t or pthread_mutex_t */
 
 #else	/* __STDC__ */
 
@@ -255,6 +261,13 @@
 
 #endif	/* __STDC__ */
 
+/* Pause API */
+#ifdef	__STDC__
+void smt_pause(void);
+#else	/* __STDC__ */
+void smt_pause();
+#endif	/* __STDC__ */
+
 #endif /* _ASM */
 
 #ifdef	__cplusplus

Modified: trunk/cddl/contrib/opensolaris/head/thread.h
===================================================================
--- trunk/cddl/contrib/opensolaris/head/thread.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/head/thread.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -30,6 +30,7 @@
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <pthread.h>
+#include <pthread_np.h>
 #include <assert.h>
 
 /*
@@ -75,6 +76,7 @@
 thr_create(void *stack_base, size_t stack_size, void *(*start_func) (void*),
     void *arg, long flags, thread_t *new_thread_ID)
 {
+	pthread_t dummy;
 	int ret;
 
 	assert(stack_base == NULL);
@@ -84,9 +86,12 @@
 	pthread_attr_t attr;
 	pthread_attr_init(&attr);
 
-	if(flags & THR_DETACHED)
+	if (flags & THR_DETACHED)
 		pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 
+	if (new_thread_ID == NULL)
+		new_thread_ID = &dummy;
+
 	/* This function ignores the THR_BOUND flag, since NPTL doesn't seem to support PTHREAD_SCOPE_PROCESS */
 
 	ret = pthread_create(new_thread_ID, &attr, start_func, arg);

Modified: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -22,6 +22,7 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, Joyent Inc. All rights reserved.
+ * Copyright (c) 2011 by Delphix. All rights reserved.
  */
 
 /*
@@ -679,13 +680,59 @@
 	ap->dtad_kind = DTRACEACT_DIFEXPR;
 }
 
+/*
+ * The print() action behaves identically to trace(), except that it stores the
+ * CTF type of the argument (if present) within the DOF for the DIFEXPR action.
+ * To do this, we set the 'dtsd_strdata' to point to the fully-qualified CTF
+ * type ID for the result of the DIF action.  We use the ID instead of the name
+ * to handles complex types like arrays and function pointers that can't be
+ * resolved by ctf_type_lookup().  This is later processed by
+ * dtrace_dof_create() and turned into a reference into the string table so
+ * that we can get the type information when we process the data after the
+ * fact.
+ */
 static void
+dt_action_print(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+	dt_node_t *dret;
+	size_t len;
+	dt_module_t *dmp;
+
+	if (dt_node_is_void(dnp->dn_args)) {
+		dnerror(dnp->dn_args, D_PRINT_VOID,
+		    "print( ) may not be applied to a void expression\n");
+	}
+
+	if (dt_node_is_dynamic(dnp->dn_args)) {
+		dnerror(dnp->dn_args, D_PRINT_DYN,
+		    "print( ) may not be applied to a dynamic expression\n");
+	}
+
+	dt_cg(yypcb, dnp->dn_args);
+
+	dret = yypcb->pcb_dret;
+	dmp = dt_module_lookup_by_ctf(dtp, dret->dn_ctfp);
+
+	len = snprintf(NULL, 0, "%s`%ld", dmp->dm_name, dret->dn_type) + 1;
+	sdp->dtsd_strdata = dt_alloc(dtp, len);
+	if (sdp->dtsd_strdata == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+	(void) snprintf(sdp->dtsd_strdata, len, "%s`%ld", dmp->dm_name,
+	    dret->dn_type);
+
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = DTRACEACT_DIFEXPR;
+}
+
+static void
 dt_action_tracemem(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
 {
 	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
 
 	dt_node_t *addr = dnp->dn_args;
-	dt_node_t *size = dnp->dn_args->dn_list;
+	dt_node_t *max = dnp->dn_args->dn_list;
+	dt_node_t *size;
 
 	char n[DT_TYPE_NAMELEN];
 
@@ -697,17 +744,37 @@
 		    dt_node_type_name(addr, n, sizeof (n)));
 	}
 
-	if (dt_node_is_posconst(size) == 0) {
-		dnerror(size, D_TRACEMEM_SIZE, "tracemem( ) argument #2 must "
+	if (dt_node_is_posconst(max) == 0) {
+		dnerror(max, D_TRACEMEM_SIZE, "tracemem( ) argument #2 must "
 		    "be a non-zero positive integral constant expression\n");
 	}
 
+	if ((size = max->dn_list) != NULL) {
+		if (size->dn_list != NULL) {
+			dnerror(size, D_TRACEMEM_ARGS, "tracemem ( ) prototype "
+			    "mismatch: expected at most 3 args\n");
+		}
+
+		if (!dt_node_is_scalar(size)) {
+			dnerror(size, D_TRACEMEM_DYNSIZE, "tracemem ( ) "
+			    "dynamic size (argument #3) must be of "
+			    "scalar type\n");
+		}
+
+		dt_cg(yypcb, size);
+		ap->dtad_difo = dt_as(yypcb);
+		ap->dtad_difo->dtdo_rtype = dt_int_rtype;
+		ap->dtad_kind = DTRACEACT_TRACEMEM_DYNSIZE;
+
+		ap = dt_stmt_action(dtp, sdp);
+	}
+
 	dt_cg(yypcb, addr);
 	ap->dtad_difo = dt_as(yypcb);
-	ap->dtad_kind = DTRACEACT_DIFEXPR;
+	ap->dtad_kind = DTRACEACT_TRACEMEM;
 
 	ap->dtad_difo->dtdo_rtype.dtdt_flags |= DIF_TF_BYREF;
-	ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value;
+	ap->dtad_difo->dtdo_rtype.dtdt_size = max->dn_value;
 }
 
 static void
@@ -1114,6 +1181,9 @@
 	case DT_ACT_TRACE:
 		dt_action_trace(dtp, dnp->dn_expr, sdp);
 		break;
+	case DT_ACT_PRINT:
+		dt_action_print(dtp, dnp->dn_expr, sdp);
+		break;
 	case DT_ACT_TRACEMEM:
 		dt_action_tracemem(dtp, dnp->dn_expr, sdp);
 		break;

Modified: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -25,6 +25,7 @@
 
 /*
  * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2011 by Delphix. All rights reserved.
  */
 
 #include <stdlib.h>
@@ -832,7 +833,7 @@
 /*ARGSUSED*/
 int
 dt_print_bytes(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr,
-    size_t nbytes, int width, int quiet, int raw)
+    size_t nbytes, int width, int quiet, int forceraw)
 {
 	/*
 	 * If the byte stream is a series of printable characters, followed by
@@ -845,9 +846,12 @@
 	if (nbytes == 0)
 		return (0);
 
-	if (raw || dtp->dt_options[DTRACEOPT_RAWBYTES] != DTRACEOPT_UNSET)
+	if (forceraw)
 		goto raw;
 
+	if (dtp->dt_options[DTRACEOPT_RAWBYTES] != DTRACEOPT_UNSET)
+		goto raw;
+
 	for (i = 0; i < nbytes; i++) {
 		/*
 		 * We define a "printable character" to be one for which
@@ -2019,6 +2023,7 @@
 	int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET);
 	int rval, i, n;
 	dtrace_epid_t last = DTRACE_EPIDNONE;
+	uint64_t tracememsize = 0;
 	dtrace_probedata_t data;
 	uint64_t drops;
 	caddr_t addr;
@@ -2187,6 +2192,13 @@
 				}
 			}
 
+			if (act == DTRACEACT_TRACEMEM_DYNSIZE &&
+			    rec->dtrd_size == sizeof (uint64_t)) {
+			    	/* LINTED - alignment */
+				tracememsize = *((unsigned long long *)addr);
+				continue;
+			}
+
 			rval = (*rfunc)(&data, rec, arg);
 
 			if (rval == DTRACE_CONSUME_NEXT)
@@ -2290,6 +2302,35 @@
 				goto nextrec;
 			}
 
+			/*
+			 * If this is a DIF expression, and the record has a
+			 * format set, this indicates we have a CTF type name
+			 * associated with the data and we should try to print
+			 * it out by type.
+			 */
+			if (act == DTRACEACT_DIFEXPR) {
+				const char *strdata = dt_strdata_lookup(dtp,
+				    rec->dtrd_format);
+				if (strdata != NULL) {
+					n = dtrace_print(dtp, fp, strdata,
+					    addr, rec->dtrd_size);
+
+					/*
+					 * dtrace_print() will return -1 on
+					 * error, or return the number of bytes
+					 * consumed.  It will return 0 if the
+					 * type couldn't be determined, and we
+					 * should fall through to the normal
+					 * trace method.
+					 */
+					if (n < 0)
+						return (-1);
+
+					if (n > 0)
+						goto nextrec;
+				}
+			}
+
 nofmt:
 			if (act == DTRACEACT_PRINTA) {
 				dt_print_aggdata_t pd;
@@ -2358,6 +2399,23 @@
 				goto nextrec;
 			}
 
+			if (act == DTRACEACT_TRACEMEM) {
+				if (tracememsize == 0 ||
+				    tracememsize > rec->dtrd_size) {
+					tracememsize = rec->dtrd_size;
+				}
+
+				n = dt_print_bytes(dtp, fp, addr,
+				    tracememsize, 33, quiet, 1);
+
+				tracememsize = 0;
+
+				if (n < 0)
+					return (-1);
+
+				goto nextrec;
+			}
+
 			switch (rec->dtrd_size) {
 			case sizeof (uint64_t):
 				n = dt_printf(dtp, fp,

Modified: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011 by Delphix. All rights reserved.
  */
 
 #include <sys/types.h>
@@ -758,8 +759,11 @@
 				dofa[i].dofa_difo = DOF_SECIDX_NONE;
 
 			/*
-			 * If the first action in a statement has format data,
-			 * add the format string to the global string table.
+			 * If the first action in a statement has string data,
+			 * add the string to the global string table.  This can
+			 * be due either to a printf() format string
+			 * (dtsd_fmtdata) or a print() type string
+			 * (dtsd_strdata).
 			 */
 			if (sdp != NULL && ap == sdp->dtsd_action) {
 				if (sdp->dtsd_fmtdata != NULL) {
@@ -766,8 +770,12 @@
 					(void) dtrace_printf_format(dtp,
 					    sdp->dtsd_fmtdata, fmt, maxfmt + 1);
 					strndx = dof_add_string(ddo, fmt);
-				} else
+				} else if (sdp->dtsd_strdata != NULL) {
+					strndx = dof_add_string(ddo,
+					    sdp->dtsd_strdata);
+				} else {
 					strndx = 0; /* use dtad_arg instead */
+				}
 
 				if ((next = dt_list_next(next)) != NULL)
 					sdp = next->ds_desc;

Modified: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -24,11 +24,14 @@
  * Use is subject to license terms.
  */
 
+ /*
+  * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+  * Copyright (c) 2011 by Delphix. All rights reserved.
+  */
+
 #ifndef	_DT_ERRTAGS_H
 #define	_DT_ERRTAGS_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #ifdef	__cplusplus
 extern "C" {
 #endif
@@ -187,8 +190,12 @@
 	D_PRINTA_AGGPROTO,		/* printa() aggregation mismatch */
 	D_TRACE_VOID,			/* trace() argument has void type */
 	D_TRACE_DYN,			/* trace() argument has dynamic type */
+	D_PRINT_VOID,			/* print() argument has void type */
+	D_PRINT_DYN,			/* print() argument has dynamic type */
 	D_TRACEMEM_ADDR,		/* tracemem() address bad type */
 	D_TRACEMEM_SIZE,		/* tracemem() size bad type */
+	D_TRACEMEM_ARGS,		/* tracemem() illegal number of args */
+	D_TRACEMEM_DYNSIZE,		/* tracemem() dynamic size bad type */
 	D_STACK_PROTO,			/* stack() prototype mismatch */
 	D_STACK_SIZE,			/* stack() size argument bad type */
 	D_USTACK_FRAMES,		/* ustack() frames arg bad type */

Modified: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -26,6 +26,7 @@
 
 /*
  * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2011 by Delphix. All rights reserved.
  */
 
 #ifndef	_DT_IMPL_H
@@ -253,6 +254,8 @@
 	dtrace_aggdesc_t **dt_aggdesc; /* aggregation descriptions */
 	int dt_maxformat;	/* max format ID */
 	void **dt_formats;	/* pointer to format array */
+	int dt_maxstrdata;	/* max strdata ID */
+	char **dt_strdata;	/* pointer to strdata array */
 	dt_aggregate_t dt_aggregate; /* aggregate */
 	dtrace_bufdesc_t dt_buf; /* staging buffer */
 	struct dt_pfdict *dt_pfdict; /* dictionary of printf conversions */
@@ -438,8 +441,9 @@
 #define	DT_ACT_UMOD		DT_ACT(26)	/* umod() action */
 #define	DT_ACT_UADDR		DT_ACT(27)	/* uaddr() action */
 #define	DT_ACT_SETOPT		DT_ACT(28)	/* setopt() action */
-#define	DT_ACT_PRINTM		DT_ACT(29)	/* printm() action */
-#define	DT_ACT_PRINTT		DT_ACT(30)	/* printt() action */
+#define	DT_ACT_PRINT		DT_ACT(29)	/* print() action */
+#define	DT_ACT_PRINTM		DT_ACT(30)	/* printm() action */
+#define	DT_ACT_PRINTT		DT_ACT(31)	/* printt() action */
 
 /*
  * Sentinel to tell freopen() to restore the saved stdout.  This must not
@@ -641,6 +645,9 @@
 extern void *dt_format_lookup(dtrace_hdl_t *, int);
 extern void dt_format_destroy(dtrace_hdl_t *);
 
+extern const char *dt_strdata_lookup(dtrace_hdl_t *, int);
+extern void dt_strdata_destroy(dtrace_hdl_t *);
+
 extern int dt_print_quantize(dtrace_hdl_t *, FILE *,
     const void *, size_t, uint64_t);
 extern int dt_print_lquantize(dtrace_hdl_t *, FILE *,

Modified: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -23,7 +23,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2011 by Delphix. All rights reserved.
+ */
 
 #include <stdlib.h>
 #include <strings.h>
@@ -35,10 +37,81 @@
 #include <dt_printf.h>
 
 static int
+dt_strdata_add(dtrace_hdl_t *dtp, dtrace_recdesc_t *rec, void ***data, int *max)
+{
+	int maxformat;
+	dtrace_fmtdesc_t fmt;
+	void *result;
+
+	if (rec->dtrd_format == 0)
+		return (0);
+
+	if (rec->dtrd_format <= *max &&
+	    (*data)[rec->dtrd_format - 1] != NULL) {
+		return (0);
+	}
+
+	bzero(&fmt, sizeof (fmt));
+	fmt.dtfd_format = rec->dtrd_format;
+	fmt.dtfd_string = NULL;
+	fmt.dtfd_length = 0;
+
+	if (dt_ioctl(dtp, DTRACEIOC_FORMAT, &fmt) == -1)
+		return (dt_set_errno(dtp, errno));
+
+	if ((fmt.dtfd_string = dt_alloc(dtp, fmt.dtfd_length)) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	if (dt_ioctl(dtp, DTRACEIOC_FORMAT, &fmt) == -1) {
+		free(fmt.dtfd_string);
+		return (dt_set_errno(dtp, errno));
+	}
+
+	while (rec->dtrd_format > (maxformat = *max)) {
+		int new_max = maxformat ? (maxformat << 1) : 1;
+		size_t nsize = new_max * sizeof (void *);
+		size_t osize = maxformat * sizeof (void *);
+		void **new_data = dt_zalloc(dtp, nsize);
+
+		if (new_data == NULL) {
+			dt_free(dtp, fmt.dtfd_string);
+			return (dt_set_errno(dtp, EDT_NOMEM));
+		}
+
+		bcopy(*data, new_data, osize);
+		free(*data);
+
+		*data = new_data;
+		*max = new_max;
+	}
+
+	switch (rec->dtrd_action) {
+	case DTRACEACT_DIFEXPR:
+		result = fmt.dtfd_string;
+		break;
+	case DTRACEACT_PRINTA:
+		result = dtrace_printa_create(dtp, fmt.dtfd_string);
+		dt_free(dtp, fmt.dtfd_string);
+		break;
+	default:
+		result = dtrace_printf_create(dtp, fmt.dtfd_string);
+		dt_free(dtp, fmt.dtfd_string);
+		break;
+	}
+
+	if (result == NULL)
+		return (-1);
+
+	(*data)[rec->dtrd_format - 1] = result;
+
+	return (0);
+}
+
+static int
 dt_epid_add(dtrace_hdl_t *dtp, dtrace_epid_t id)
 {
 	dtrace_id_t max;
-	int rval, i, maxformat;
+	int rval, i;
 	dtrace_eprobedesc_t *enabled, *nenabled;
 	dtrace_probedesc_t *probe;
 
@@ -132,71 +205,23 @@
 	}
 
 	for (i = 0; i < enabled->dtepd_nrecs; i++) {
-		dtrace_fmtdesc_t fmt;
 		dtrace_recdesc_t *rec = &enabled->dtepd_rec[i];
 
-		if (!DTRACEACT_ISPRINTFLIKE(rec->dtrd_action))
-			continue;
-
-		if (rec->dtrd_format == 0)
-			continue;
-
-		if (rec->dtrd_format <= dtp->dt_maxformat &&
-		    dtp->dt_formats[rec->dtrd_format - 1] != NULL)
-			continue;
-
-		bzero(&fmt, sizeof (fmt));
-		fmt.dtfd_format = rec->dtrd_format;
-		fmt.dtfd_string = NULL;
-		fmt.dtfd_length = 0;
-
-		if (dt_ioctl(dtp, DTRACEIOC_FORMAT, &fmt) == -1) {
-			rval = dt_set_errno(dtp, errno);
-			goto err;
-		}
-
-		if ((fmt.dtfd_string = malloc(fmt.dtfd_length)) == NULL) {
-			rval = dt_set_errno(dtp, EDT_NOMEM);
-			goto err;
-		}
-
-		if (dt_ioctl(dtp, DTRACEIOC_FORMAT, &fmt) == -1) {
-			rval = dt_set_errno(dtp, errno);
-			free(fmt.dtfd_string);
-			goto err;
-		}
-
-		while (rec->dtrd_format > (maxformat = dtp->dt_maxformat)) {
-			int new_max = maxformat ? (maxformat << 1) : 1;
-			size_t nsize = new_max * sizeof (void *);
-			size_t osize = maxformat * sizeof (void *);
-			void **new_formats = malloc(nsize);
-
-			if (new_formats == NULL) {
-				rval = dt_set_errno(dtp, EDT_NOMEM);
-				free(fmt.dtfd_string);
+		if (DTRACEACT_ISPRINTFLIKE(rec->dtrd_action)) {
+			if (dt_strdata_add(dtp, rec, &dtp->dt_formats,
+			    &dtp->dt_maxformat) != 0) {
+				rval = -1;
 				goto err;
 			}
-
-			bzero(new_formats, nsize);
-			bcopy(dtp->dt_formats, new_formats, osize);
-			free(dtp->dt_formats);
-
-			dtp->dt_formats = new_formats;
-			dtp->dt_maxformat = new_max;
+		} else if (rec->dtrd_action == DTRACEACT_DIFEXPR) {
+			if (dt_strdata_add(dtp, rec,
+			    (void ***)&dtp->dt_strdata,
+			    &dtp->dt_maxstrdata) != 0) {
+				rval = -1;
+				goto err;
+			}
 		}
 
-		dtp->dt_formats[rec->dtrd_format - 1] =
-		    rec->dtrd_action == DTRACEACT_PRINTA ?
-		    dtrace_printa_create(dtp, fmt.dtfd_string) :
-		    dtrace_printf_create(dtp, fmt.dtfd_string);
-
-		free(fmt.dtfd_string);
-
-		if (dtp->dt_formats[rec->dtrd_format - 1] == NULL) {
-			rval = -1; /* dt_errno is set for us */
-			goto err;
-		}
 	}
 
 	dtp->dt_pdesc[id] = probe;
@@ -440,3 +465,28 @@
 	dtp->dt_aggdesc = NULL;
 	dtp->dt_maxagg = 0;
 }
+
+const char *
+dt_strdata_lookup(dtrace_hdl_t *dtp, int idx)
+{
+	if (idx == 0 || idx > dtp->dt_maxstrdata)
+		return (NULL);
+
+	if (dtp->dt_strdata == NULL)
+		return (NULL);
+
+	return (dtp->dt_strdata[idx - 1]);
+}
+
+void
+dt_strdata_destroy(dtrace_hdl_t *dtp)
+{
+	int i;
+
+	for (i = 0; i < dtp->dt_maxstrdata; i++) {
+		free(dtp->dt_strdata[i]);
+	}
+
+	free(dtp->dt_strdata);
+	dtp->dt_strdata = NULL;
+}

Modified: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -22,6 +22,7 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2011 by Delphix. All rights reserved.
  */
 
 #include <sys/types.h>
@@ -116,8 +117,12 @@
 #define	DT_VERS_1_6_2	DT_VERSION_NUMBER(1, 6, 2)
 #define	DT_VERS_1_6_3	DT_VERSION_NUMBER(1, 6, 3)
 #define	DT_VERS_1_7	DT_VERSION_NUMBER(1, 7, 0)
-#define	DT_VERS_LATEST	DT_VERS_1_7
-#define	DT_VERS_STRING	"Sun D 1.7"
+#define	DT_VERS_1_7_1	DT_VERSION_NUMBER(1, 7, 1)
+#define	DT_VERS_1_8	DT_VERSION_NUMBER(1, 8, 0)
+#define	DT_VERS_1_8_1	DT_VERSION_NUMBER(1, 8, 1)
+#define	DT_VERS_1_9	DT_VERSION_NUMBER(1, 9, 0)
+#define	DT_VERS_LATEST	DT_VERS_1_9
+#define	DT_VERS_STRING	"Sun D 1.9"
 
 const dt_version_t _dtrace_versions[] = {
 	DT_VERS_1_0,	/* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */
@@ -134,6 +139,10 @@
 	DT_VERS_1_6_2,	/* D API 1.6.2 */
 	DT_VERS_1_6_3,	/* D API 1.6.3 */
 	DT_VERS_1_7,	/* D API 1.7 */
+	DT_VERS_1_7_1,	/* D API 1.7.1 */
+	DT_VERS_1_8,	/* D API 1.8 */
+	DT_VERS_1_8_1,	/* D API 1.8.1 */
+	DT_VERS_1_9,	/* D API 1.9 */
 	0
 };
 
@@ -289,7 +298,7 @@
 { "jstack", DT_IDENT_ACTFUNC, 0, DT_ACT_JSTACK, DT_ATTR_STABCMN, DT_VERS_1_0,
 	&dt_idops_func, "stack(...)" },
 { "lltostr", DT_IDENT_FUNC, 0, DIF_SUBR_LLTOSTR, DT_ATTR_STABCMN, DT_VERS_1_0,
-	&dt_idops_func, "string(int64_t)" },
+	&dt_idops_func, "string(int64_t, [int])" },
 { "llquantize", DT_IDENT_AGGFUNC, 0, DTRACEAGG_LLQUANTIZE, DT_ATTR_STABCMN,
 	DT_VERS_1_7, &dt_idops_func,
 	"void(@, int32_t, int32_t, int32_t, int32_t, ...)" },
@@ -351,6 +360,8 @@
 	&dt_idops_type, "pid_t" },
 { "ppid", DT_IDENT_SCALAR, 0, DIF_VAR_PPID, DT_ATTR_STABCMN, DT_VERS_1_0,
 	&dt_idops_type, "pid_t" },
+{ "print", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINT, DT_ATTR_STABCMN, DT_VERS_1_9,
+	&dt_idops_func, "void(@)" },
 { "printa", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINTA, DT_ATTR_STABCMN, DT_VERS_1_0,
 	&dt_idops_func, "void(@, ...)" },
 { "printf", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINTF, DT_ATTR_STABCMN, DT_VERS_1_0,
@@ -457,11 +468,15 @@
 { "timestamp", DT_IDENT_SCALAR, 0, DIF_VAR_TIMESTAMP,
 	DT_ATTR_STABCMN, DT_VERS_1_0,
 	&dt_idops_type, "uint64_t" },
+{ "tolower", DT_IDENT_FUNC, 0, DIF_SUBR_TOLOWER, DT_ATTR_STABCMN, DT_VERS_1_8,
+	&dt_idops_func, "string(const char *)" },
+{ "toupper", DT_IDENT_FUNC, 0, DIF_SUBR_TOUPPER, DT_ATTR_STABCMN, DT_VERS_1_8,
+	&dt_idops_func, "string(const char *)" },
 { "trace", DT_IDENT_ACTFUNC, 0, DT_ACT_TRACE, DT_ATTR_STABCMN, DT_VERS_1_0,
 	&dt_idops_func, "void(@)" },
 { "tracemem", DT_IDENT_ACTFUNC, 0, DT_ACT_TRACEMEM,
 	DT_ATTR_STABCMN, DT_VERS_1_0,
-	&dt_idops_func, "void(@, size_t)" },
+	&dt_idops_func, "void(@, size_t, ...)" },
 { "trunc", DT_IDENT_ACTFUNC, 0, DT_ACT_TRUNC, DT_ATTR_STABCMN,
 	DT_VERS_1_0, &dt_idops_func, "void(...)" },
 { "typeref", DT_IDENT_FUNC, 0, DIF_SUBR_TYPEREF, DT_ATTR_STABCMN, DT_VERS_1_1,
@@ -1612,6 +1627,7 @@
 	dt_epid_destroy(dtp);
 	dt_aggid_destroy(dtp);
 	dt_format_destroy(dtp);
+	dt_strdata_destroy(dtp);
 	dt_buffered_destroy(dtp);
 	dt_aggregate_destroy(dtp);
 	free(dtp->dt_buf.dtbd_data);

Modified: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -241,6 +241,8 @@
 	int found;
 	dt_lib_depend_t *dld;
 	char lib[MAXPATHLEN];
+	size_t plen;
+	char *provs, *cpy, *tok;
 
 	if (cnp == NULL || nnp == NULL ||
 	    cnp->dn_kind != DT_NODE_IDENT || nnp->dn_kind != DT_NODE_IDENT) {
@@ -248,9 +250,31 @@
 		    "<class> <name>\n", prname);
 	}
 
-	if (strcmp(cnp->dn_string, "provider") == 0)
-		found = dt_provider_lookup(dtp, nnp->dn_string) != NULL;
-	else if (strcmp(cnp->dn_string, "module") == 0) {
+	if (strcmp(cnp->dn_string, "provider") == 0) {
+		/*
+		 * First try to get the provider list using the
+		 * debug.dtrace.providers sysctl, since that'll work even if
+		 * we're not running as root.
+		 */
+		provs = NULL;
+		if (sysctlbyname("debug.dtrace.providers", NULL, &plen, NULL, 0) ||
+		    ((provs = dt_alloc(dtp, plen)) == NULL) ||
+		    sysctlbyname("debug.dtrace.providers", provs, &plen, NULL, 0))
+			found = dt_provider_lookup(dtp, nnp->dn_string) != NULL;
+		else {
+			found = B_FALSE;
+			for (cpy = provs; (tok = strsep(&cpy, " ")) != NULL; )
+				if (strcmp(tok, nnp->dn_string) == 0) {
+					found = B_TRUE;
+					break;
+				}
+			if (found == B_FALSE)
+				found = dt_provider_lookup(dtp,
+				    nnp->dn_string) != NULL;
+		}
+		if (provs != NULL)
+			dt_free(dtp, provs);
+	} else if (strcmp(cnp->dn_string, "module") == 0) {
 		dt_module_t *mp = dt_module_lookup_by_name(dtp, nnp->dn_string);
 		found = mp != NULL && dt_module_getctf(dtp, mp) != NULL;
 	} else if (strcmp(cnp->dn_string, "library") == 0) {

Added: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c	                        (rev 0)
+++ trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -0,0 +1,691 @@
+/*
+ * CDDL HEADER START
+ *
+ * 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]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+/*
+ * Copyright (c) 2011 by Delphix. All rights reserved.
+ */
+/*
+ * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+ */
+
+/*
+ * DTrace print() action
+ *
+ * This file contains the post-processing logic for the print() action.  The
+ * print action behaves identically to trace() in that it generates a
+ * DTRACEACT_DIFEXPR action, but the action argument field refers to a CTF type
+ * string stored in the DOF string table (similar to printf formats).  We
+ * take the result of the trace action and post-process it in the fashion of
+ * MDB's ::print dcmd.
+ *
+ * This implementation differs from MDB's in the following ways:
+ *
+ * 	- We do not expose any options or flags.  The behavior of print() is
+ *	  equivalent to "::print -tn".
+ *
+ * 	- MDB will display "holes" in structures (unused padding between
+ *	  members).
+ *
+ * 	- When printing arrays of structures, MDB will leave a trailing ','
+ *	  after the last element.
+ *
+ *	- MDB will print time_t types as date and time.
+ *
+ *	- MDB will detect when an enum is actually the OR of several flags,
+ *	  and print it out with the constituent flags separated.
+ *
+ *	- For large arrays, MDB will print the first few members and then
+ *	  print a "..." continuation line.
+ *
+ *	- MDB will break and wrap arrays at 80 columns.
+ *
+ *	- MDB prints out floats and doubles by hand, as it must run in kmdb
+ *	  context.  We're able to leverage the printf() format strings,
+ *	  but the result is a slightly different format.
+ */
+
+#include <sys/sysmacros.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <alloca.h>
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <dt_module.h>
+#include <dt_printf.h>
+#include <dt_string.h>
+#include <dt_impl.h>
+
+/* determines whether the given integer CTF encoding is a character */
+#define	CTF_IS_CHAR(e) \
+	(((e).cte_format & (CTF_INT_CHAR | CTF_INT_SIGNED)) == \
+	(CTF_INT_CHAR | CTF_INT_SIGNED) && (e).cte_bits == NBBY)
+/* determines whether the given CTF kind is a struct or union */
+#define	CTF_IS_STRUCTLIKE(k) \
+	((k) == CTF_K_STRUCT || (k) == CTF_K_UNION)
+
+/*
+ * Print structure passed down recursively through printing algorithm.
+ */
+typedef struct dt_printarg {
+	dtrace_hdl_t	*pa_dtp;	/* libdtrace handle */
+	caddr_t		pa_addr;	/* base address of trace data */
+	ctf_file_t	*pa_ctfp;	/* CTF container */
+	int		pa_depth;	/* member depth */
+	int		pa_nest;	/* nested array depth */
+	FILE		*pa_file;	/* output file */
+} dt_printarg_t;
+
+static int dt_print_member(const char *, ctf_id_t, ulong_t, int, void *);
+
+/*
+ * Safe version of ctf_type_name() that will fall back to just "<ctfid>" if it
+ * can't resolve the type.
+ */
+static void
+dt_print_type_name(ctf_file_t *ctfp, ctf_id_t id, char *buf, size_t buflen)
+{
+	if (ctf_type_name(ctfp, id, buf, buflen) == NULL)
+		(void) snprintf(buf, buflen, "<%ld>", id);
+}
+
+/*
+ * Print any necessary trailing braces for structures or unions.  We don't get
+ * invoked when a struct or union ends, so we infer the need to print braces
+ * based on the depth the last time we printed something and the new depth.
+ */
+static void
+dt_print_trailing_braces(dt_printarg_t *pap, int depth)
+{
+	int d;
+
+	for (d = pap->pa_depth; d > depth; d--) {
+		(void) fprintf(pap->pa_file, "%*s}%s",
+		    (d + pap->pa_nest - 1) * 4, "",
+		    d == depth + 1 ? "" : "\n");
+	}
+}
+
+/*
+ * Print the appropriate amount of indentation given the current depth and
+ * array nesting.
+ */
+static void
+dt_print_indent(dt_printarg_t *pap)
+{
+	(void) fprintf(pap->pa_file, "%*s",
+	    (pap->pa_depth + pap->pa_nest) * 4, "");
+}
+
+/*
+ * Print a bitfield.  It's worth noting that the D compiler support for
+ * bitfields is currently broken; printing "D`user_desc_t" (pulled in by the
+ * various D provider files) will produce incorrect results compared to
+ * "genunix`user_desc_t".
+ */
+static void
+print_bitfield(dt_printarg_t *pap, ulong_t off, ctf_encoding_t *ep)
+{
+	FILE *fp = pap->pa_file;
+	caddr_t addr = pap->pa_addr + off / NBBY;
+	uint64_t mask = (1ULL << ep->cte_bits) - 1;
+	uint64_t value = 0;
+	size_t size = (ep->cte_bits + (NBBY - 1)) / NBBY;
+	uint8_t *buf = (uint8_t *)&value;
+	uint8_t shift;
+
+	/*
+	 * On big-endian machines, we need to adjust the buf pointer to refer
+	 * to the lowest 'size' bytes in 'value', and we need to shift based on
+	 * the offset from the end of the data, not the offset of the start.
+	 */
+#ifdef _BIG_ENDIAN
+	buf += sizeof (value) - size;
+	off += ep->cte_bits;
+#endif
+	bcopy(addr, buf, size);
+	shift = off % NBBY;
+
+	/*
+	 * Offsets are counted from opposite ends on little- and
+	 * big-endian machines.
+	 */
+#ifdef _BIG_ENDIAN
+	shift = NBBY - shift;
+#endif
+
+	/*
+	 * If the bits we want do not begin on a byte boundary, shift the data
+	 * right so that the value is in the lowest 'cte_bits' of 'value'.
+	 */
+	if (off % NBBY != 0)
+		value >>= shift;
+	value &= mask;
+
+	(void) fprintf(fp, "%#llx", (u_longlong_t)value);
+}
+
+/*
+ * Dump the contents of memory as a fixed-size integer in hex.
+ */
+static void
+dt_print_hex(FILE *fp, caddr_t addr, size_t size)
+{
+	switch (size) {
+	case sizeof (uint8_t):
+		(void) fprintf(fp, "%#x", *(uint8_t *)addr);
+		break;
+	case sizeof (uint16_t):
+		/* LINTED - alignment */
+		(void) fprintf(fp, "%#x", *(uint16_t *)addr);
+		break;
+	case sizeof (uint32_t):
+		/* LINTED - alignment */
+		(void) fprintf(fp, "%#x", *(uint32_t *)addr);
+		break;
+	case sizeof (uint64_t):
+		(void) fprintf(fp, "%#llx",
+		    /* LINTED - alignment */
+		    (unsigned long long)*(uint64_t *)addr);
+		break;
+	default:
+		(void) fprintf(fp, "<invalid size %u>", (uint_t)size);
+	}
+}
+
+/*
+ * Print an integer type.  Before dumping the contents via dt_print_hex(), we
+ * first check the encoding to see if it's part of a bitfield or a character.
+ */
+static void
+dt_print_int(ctf_id_t base, ulong_t off, dt_printarg_t *pap)
+{
+	FILE *fp = pap->pa_file;
+	ctf_file_t *ctfp = pap->pa_ctfp;
+	ctf_encoding_t e;
+	size_t size;
+	caddr_t addr = pap->pa_addr + off / NBBY;
+
+	if (ctf_type_encoding(ctfp, base, &e) == CTF_ERR) {
+		(void) fprintf(fp, "<unknown encoding>");
+		return;
+	}
+
+	/*
+	 * This comes from MDB - it's not clear under what circumstances this
+	 * would be found.
+	 */
+	if (e.cte_format & CTF_INT_VARARGS) {
+		(void) fprintf(fp, "...");
+		return;
+	}
+
+	/*
+	 * We print this as a bitfield if the bit encoding indicates it's not
+	 * an even power of two byte size, or is larger than 8 bytes.
+	 */
+	size = e.cte_bits / NBBY;
+	if (size > 8 || (e.cte_bits % NBBY) != 0 || (size & (size - 1)) != 0) {
+		print_bitfield(pap, off, &e);
+		return;
+	}
+
+	/*
+	 * If this is a character, print it out as such.
+	 */
+	if (CTF_IS_CHAR(e)) {
+		char c = *(char *)addr;
+		if (isprint(c))
+			(void) fprintf(fp, "'%c'", c);
+		else if (c == 0)
+			(void) fprintf(fp, "'\\0'");
+		else
+			(void) fprintf(fp, "'\\%03o'", c);
+		return;
+	}
+
+	dt_print_hex(fp, addr, size);
+}
+
+/*
+ * Print a floating point (float, double, long double) value.
+ */
+/* ARGSUSED */
+static void
+dt_print_float(ctf_id_t base, ulong_t off, dt_printarg_t *pap)
+{
+	FILE *fp = pap->pa_file;
+	ctf_file_t *ctfp = pap->pa_ctfp;
+	ctf_encoding_t e;
+	caddr_t addr = pap->pa_addr + off / NBBY;
+
+	if (ctf_type_encoding(ctfp, base, &e) == 0) {
+		if (e.cte_format == CTF_FP_SINGLE &&
+		    e.cte_bits == sizeof (float) * NBBY) {
+			/* LINTED - alignment */
+			(void) fprintf(fp, "%+.7e", *((float *)addr));
+		} else if (e.cte_format == CTF_FP_DOUBLE &&
+		    e.cte_bits == sizeof (double) * NBBY) {
+			/* LINTED - alignment */
+			(void) fprintf(fp, "%+.7e", *((double *)addr));
+		} else if (e.cte_format == CTF_FP_LDOUBLE &&
+		    e.cte_bits == sizeof (long double) * NBBY) {
+			/* LINTED - alignment */
+			(void) fprintf(fp, "%+.16LE", *((long double *)addr));
+		} else {
+			(void) fprintf(fp, "<unknown encoding>");
+		}
+	}
+}
+
+/*
+ * A pointer is generally printed as a fixed-size integer.  If we have a
+ * function pointer, we try to look up its name.
+ */
+static void
+dt_print_ptr(ctf_id_t base, ulong_t off, dt_printarg_t *pap)
+{
+	FILE *fp = pap->pa_file;
+	ctf_file_t *ctfp = pap->pa_ctfp;
+	caddr_t addr = pap->pa_addr + off / NBBY;
+	size_t size = ctf_type_size(ctfp, base);
+	ctf_id_t bid = ctf_type_reference(ctfp, base);
+	uint64_t pc;
+	dtrace_syminfo_t dts;
+	GElf_Sym sym;
+
+	if (bid == CTF_ERR || ctf_type_kind(ctfp, bid) != CTF_K_FUNCTION) {
+		dt_print_hex(fp, addr, size);
+	} else {
+		/* LINTED - alignment */
+		pc = *((uint64_t *)addr);
+		if (dtrace_lookup_by_addr(pap->pa_dtp, pc, &sym, &dts) != 0) {
+			dt_print_hex(fp, addr, size);
+		} else {
+			(void) fprintf(fp, "%s`%s", dts.dts_object,
+			    dts.dts_name);
+		}
+	}
+}
+
+/*
+ * Print out an array.  This is somewhat complex, as we must manually visit
+ * each member, and recursively invoke ctf_type_visit() for each member.  If
+ * the members are non-structs, then we print them out directly:
+ *
+ * 	[ 0x14, 0x2e, 0 ]
+ *
+ * If they are structs, then we print out the necessary leading and trailing
+ * braces, to end up with:
+ *
+ *	[
+ *	    type {
+ *	    ...
+ *	    },
+ *	    type {
+ *	    ...
+ *	    }
+ *	]
+ *
+ * We also use a heuristic to detect whether the array looks like a character
+ * array.  If the encoding indicates it's a character, and we have all
+ * printable characters followed by a null byte, then we display it as a
+ * string:
+ *
+ *	[ "string" ]
+ */
+static void
+dt_print_array(ctf_id_t base, ulong_t off, dt_printarg_t *pap)
+{
+	FILE *fp = pap->pa_file;
+	ctf_file_t *ctfp = pap->pa_ctfp;
+	caddr_t addr = pap->pa_addr + off / NBBY;
+	ctf_arinfo_t car;
+	ssize_t eltsize;
+	ctf_encoding_t e;
+	int i;
+	boolean_t isstring;
+	int kind;
+	ctf_id_t rtype;
+
+	if (ctf_array_info(ctfp, base, &car) == CTF_ERR) {
+		(void) fprintf(fp, "0x%p", (void *)addr);
+		return;
+	}
+
+	if ((eltsize = ctf_type_size(ctfp, car.ctr_contents)) < 0 ||
+	    (rtype = ctf_type_resolve(ctfp, car.ctr_contents)) == CTF_ERR ||
+	    (kind = ctf_type_kind(ctfp, rtype)) == CTF_ERR) {
+		(void) fprintf(fp, "<invalid type %lu>", car.ctr_contents);
+		return;
+	}
+
+	/* see if this looks like a string */
+	isstring = B_FALSE;
+	if (kind == CTF_K_INTEGER &&
+	    ctf_type_encoding(ctfp, rtype, &e) != CTF_ERR && CTF_IS_CHAR(e)) {
+		char c;
+		for (i = 0; i < car.ctr_nelems; i++) {
+			c = *((char *)addr + eltsize * i);
+			if (!isprint(c) || c == '\0')
+				break;
+		}
+
+		if (i != car.ctr_nelems && c == '\0')
+			isstring = B_TRUE;
+	}
+
+	/*
+	 * As a slight aesthetic optimization, if we are a top-level type, then
+	 * don't bother printing out the brackets.  This lets print("foo") look
+	 * like:
+	 *
+	 * 	string "foo"
+	 *
+	 * As D will internally represent this as a char[256] array.
+	 */
+	if (!isstring || pap->pa_depth != 0)
+		(void) fprintf(fp, "[ ");
+
+	if (isstring)
+		(void) fprintf(fp, "\"");
+
+	for (i = 0; i < car.ctr_nelems; i++) {
+		if (isstring) {
+			char c = *((char *)addr + eltsize * i);
+			if (c == '\0')
+				break;
+			(void) fprintf(fp, "%c", c);
+		} else {
+			/*
+			 * Recursively invoke ctf_type_visit() on each member.
+			 * We setup a new printarg struct with 'pa_nest' set to
+			 * indicate that we are within a nested array.
+			 */
+			dt_printarg_t pa = *pap;
+			pa.pa_nest += pap->pa_depth + 1;
+			pa.pa_depth = 0;
+			pa.pa_addr = addr + eltsize * i;
+			(void) ctf_type_visit(ctfp, car.ctr_contents,
+			    dt_print_member, &pa);
+
+			dt_print_trailing_braces(&pa, 0);
+			if (i != car.ctr_nelems - 1)
+				(void) fprintf(fp, ", ");
+			else if (CTF_IS_STRUCTLIKE(kind))
+				(void) fprintf(fp, "\n");
+		}
+	}
+
+	if (isstring)
+		(void) fprintf(fp, "\"");
+
+	if (!isstring || pap->pa_depth != 0) {
+		if (CTF_IS_STRUCTLIKE(kind))
+			dt_print_indent(pap);
+		else
+			(void) fprintf(fp, " ");
+		(void) fprintf(fp, "]");
+	}
+}
+
+/*
+ * This isued by both structs and unions to print the leading brace.
+ */
+/* ARGSUSED */
+static void
+dt_print_structlike(ctf_id_t id, ulong_t off, dt_printarg_t *pap)
+{
+	(void) fprintf(pap->pa_file, "{");
+}
+
+/*
+ * For enums, we try to print the enum name, and fall back to the value if it
+ * can't be determined.  We do not do any fancy flag processing like mdb.
+ */
+/* ARGSUSED */
+static void
+dt_print_enum(ctf_id_t base, ulong_t off, dt_printarg_t *pap)
+{
+	FILE *fp = pap->pa_file;
+	ctf_file_t *ctfp = pap->pa_ctfp;
+	const char *ename;
+	ssize_t size;
+	caddr_t addr = pap->pa_addr + off / NBBY;
+	int value = 0;
+
+	/*
+	 * The C standard says that an enum will be at most the sizeof (int).
+	 * But if all the values are less than that, the compiler can use a
+	 * smaller size. Thanks standards.
+	 */
+	size = ctf_type_size(ctfp, base);
+	switch (size) {
+	case sizeof (uint8_t):
+		value = *(uint8_t *)addr;
+		break;
+	case sizeof (uint16_t):
+		value = *(uint16_t *)addr;
+		break;
+	case sizeof (int32_t):
+		value = *(int32_t *)addr;
+		break;
+	default:
+		(void) fprintf(fp, "<invalid enum size %u>", (uint_t)size);
+		return;
+	}
+
+	if ((ename = ctf_enum_name(ctfp, base, value)) != NULL)
+		(void) fprintf(fp, "%s", ename);
+	else
+		(void) fprintf(fp, "%d", value);
+}
+
+/*
+ * Forward declaration.  There's not much to do here without the complete
+ * type information, so just print out this fact and drive on.
+ */
+/* ARGSUSED */
+static void
+dt_print_tag(ctf_id_t base, ulong_t off, dt_printarg_t *pap)
+{
+	(void) fprintf(pap->pa_file, "<forward decl>");
+}
+
+typedef void dt_printarg_f(ctf_id_t, ulong_t, dt_printarg_t *);
+
+static dt_printarg_f *const dt_printfuncs[] = {
+	dt_print_int,		/* CTF_K_INTEGER */
+	dt_print_float,		/* CTF_K_FLOAT */
+	dt_print_ptr,		/* CTF_K_POINTER */
+	dt_print_array,		/* CTF_K_ARRAY */
+	dt_print_ptr,		/* CTF_K_FUNCTION */
+	dt_print_structlike,	/* CTF_K_STRUCT */
+	dt_print_structlike,	/* CTF_K_UNION */
+	dt_print_enum,		/* CTF_K_ENUM */
+	dt_print_tag		/* CTF_K_FORWARD */
+};
+
+/*
+ * Print one member of a structure.  This callback is invoked from
+ * ctf_type_visit() recursively.
+ */
+static int
+dt_print_member(const char *name, ctf_id_t id, ulong_t off, int depth,
+    void *data)
+{
+	char type[DT_TYPE_NAMELEN];
+	int kind;
+	dt_printarg_t *pap = data;
+	FILE *fp = pap->pa_file;
+	ctf_file_t *ctfp = pap->pa_ctfp;
+	boolean_t arraymember;
+	boolean_t brief;
+	ctf_encoding_t e;
+	ctf_id_t rtype;
+
+	dt_print_trailing_braces(pap, depth);
+	/*
+	 * dt_print_trailing_braces() doesn't include the trailing newline; add
+	 * it here if necessary.
+	 */
+	if (depth < pap->pa_depth)
+		(void) fprintf(fp, "\n");
+	pap->pa_depth = depth;
+
+	if ((rtype = ctf_type_resolve(ctfp, id)) == CTF_ERR ||
+	    (kind = ctf_type_kind(ctfp, rtype)) == CTF_ERR ||
+	    kind < CTF_K_INTEGER || kind > CTF_K_FORWARD) {
+		dt_print_indent(pap);
+		(void) fprintf(fp, "%s = <invalid type %lu>", name, id);
+		return (0);
+	}
+
+	dt_print_type_name(ctfp, id, type, sizeof (type));
+
+	arraymember = (pap->pa_nest != 0 && depth == 0);
+	brief = (arraymember && !CTF_IS_STRUCTLIKE(kind));
+
+	if (!brief) {
+		/*
+		 * If this is a direct array member and a struct (otherwise
+		 * brief would be true), then print a trailing newline, as the
+		 * array printing code doesn't include it because it might be a
+		 * simple type.
+		 */
+		if (arraymember)
+			(void) fprintf(fp, "\n");
+		dt_print_indent(pap);
+
+		/* always print the type */
+		(void) fprintf(fp, "%s", type);
+		if (name[0] != '\0') {
+			/*
+			 * For aesthetics, we don't include a space between the
+			 * type name and member name if the type is a pointer.
+			 * This will give us "void *foo =" instead of "void *
+			 * foo =".  Unions also have the odd behavior that the
+			 * type name is returned as "union ", with a trailing
+			 * space, so we also avoid printing a space if the type
+			 * name already ends with a space.
+			 */
+			if (type[strlen(type) - 1] != '*' &&
+			    type[strlen(type) -1] != ' ') {
+				(void) fprintf(fp, " ");
+			}
+			(void) fprintf(fp, "%s", name);
+
+			/*
+			 * If this looks like a bitfield, or is an integer not
+			 * aligned on a byte boundary, print the number of
+			 * bits after the name.
+			 */
+			if (kind == CTF_K_INTEGER &&
+			    ctf_type_encoding(ctfp, id, &e) == 0) {
+				ulong_t bits = e.cte_bits;
+				ulong_t size = bits / NBBY;
+
+				if (bits % NBBY != 0 ||
+				    off % NBBY != 0 ||
+				    size > 8 ||
+				    size != ctf_type_size(ctfp, id)) {
+					(void) fprintf(fp, " :%lu", bits);
+				}
+			}
+
+			(void) fprintf(fp, " =");
+		}
+		(void) fprintf(fp, " ");
+	}
+
+	dt_printfuncs[kind - 1](rtype, off, pap);
+
+	/* direct simple array members are not separated by newlines */
+	if (!brief)
+		(void) fprintf(fp, "\n");
+
+	return (0);
+}
+
+/*
+ * Main print function invoked by dt_consume_cpu().
+ */
+int
+dtrace_print(dtrace_hdl_t *dtp, FILE *fp, const char *typename,
+    caddr_t addr, size_t len)
+{
+	const char *s;
+	char *object;
+	dt_printarg_t pa;
+	ctf_id_t id;
+	dt_module_t *dmp;
+
+	/*
+	 * Split the fully-qualified type ID (module`id).  This should
+	 * always be the format, but if for some reason we don't find the
+	 * expected value, return 0 to fall back to the generic trace()
+	 * behavior.
+	 */
+	for (s = typename; *s != '\0' && *s != '`'; s++)
+		;
+
+	if (*s != '`')
+		return (0);
+
+	object = alloca(s - typename + 1);
+	bcopy(typename, object, s - typename);
+	object[s - typename] = '\0';
+	id = atoi(s + 1);
+
+	/*
+	 * Try to get the CTF kind for this id.  If something has gone horribly
+	 * wrong and we can't resolve the ID, bail out and let trace() do the
+	 * work.
+	 */
+	dmp = dt_module_lookup_by_name(dtp, object);
+	if (dmp == NULL || ctf_type_kind(dt_module_getctf(dtp, dmp),
+	    id) == CTF_ERR) {
+		return (0);
+	}
+
+	/* setup the print structure and kick off the main print routine */
+	pa.pa_dtp = dtp;
+	pa.pa_addr = addr;
+	pa.pa_ctfp = dt_module_getctf(dtp, dmp);
+	pa.pa_nest = 0;
+	pa.pa_depth = 0;
+	pa.pa_file = fp;
+	(void) ctf_type_visit(pa.pa_ctfp, id, dt_print_member, &pa);
+
+	dt_print_trailing_braces(&pa, 0);
+
+	return (len);
+}


Property changes on: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011 by Delphix. All rights reserved.
  */
 
 #include <unistd.h>
@@ -352,6 +353,7 @@
 
 	if (sdp->dtsd_fmtdata != NULL)
 		dt_printf_destroy(sdp->dtsd_fmtdata);
+	dt_free(dtp, sdp->dtsd_strdata);
 
 	dt_ecbdesc_release(dtp, sdp->dtsd_ecbdesc);
 	dt_free(dtp, sdp);

Modified: trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -154,6 +154,7 @@
 	dtrace_actdesc_t *dtsd_action_last;	/* last action in action list */
 	void *dtsd_aggdata;			/* aggregation data */
 	void *dtsd_fmtdata;			/* type-specific output data */
+	void *dtsd_strdata;			/* type-specific string data */
 	void (*dtsd_callback)(void);		/* callback function for EPID */
 	void *dtsd_data;			/* callback data pointer */
 	dtrace_attribute_t dtsd_descattr;	/* probedesc attributes */
@@ -246,6 +247,18 @@
     const void *, size_t);
 
 /*
+ * Type-specific output printing
+ *
+ * The print() action will associate a string data record that is actually the
+ * fully-qualified type name of the data traced by the DIFEXPR action.  This is
+ * stored in the same 'format' record from the kernel, but we know by virtue of
+ * the fact that the action is still DIFEXPR that it is actually a reference to
+ * plain string data.
+ */
+extern int dtrace_print(dtrace_hdl_t *, FILE *, const char *,
+    caddr_t, size_t);
+
+/*
  * DTrace Work Interface
  */
 typedef enum {

Modified: trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -27,6 +27,7 @@
  * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012 Martin Matuska <mm at FreeBSD.org>. All rights reserved.
+ * Copyright (c) 2013 Steven Hartland. All rights reserved.
  */
 
 #ifndef	_LIBZFS_H
@@ -611,7 +612,8 @@
 
 extern int zfs_promote(zfs_handle_t *);
 extern int zfs_hold(zfs_handle_t *, const char *, const char *,
-    boolean_t, boolean_t, int);
+    boolean_t, int);
+extern int zfs_hold_nvl(zfs_handle_t *, int, nvlist_t *);
 extern int zfs_release(zfs_handle_t *, const char *, const char *, boolean_t);
 extern int zfs_get_holds(zfs_handle_t *, nvlist_t **);
 extern uint64_t zvol_volsize_to_reservation(uint64_t, nvlist_t *);

Modified: trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -21,12 +21,13 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012 DEY Storage Systems, Inc.  All rights reserved.
  * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
- * Copyright (c) 2012 DEY Storage Systems, Inc.  All rights reserved.
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel at dawidek.net>.
  * All rights reserved.
  * Copyright (c) 2012 Martin Matuska <mm at FreeBSD.org>. All rights reserved.
+ * Copyright (c) 2013 Steven Hartland. All rights reserved.
  */
 
 #include <ctype.h>
@@ -3158,7 +3159,6 @@
 zfs_check_snap_cb(zfs_handle_t *zhp, void *arg)
 {
 	struct destroydata *dd = arg;
-	zfs_handle_t *szhp;
 	char name[ZFS_MAXNAMELEN];
 	int rv = 0;
 
@@ -3165,11 +3165,8 @@
 	(void) snprintf(name, sizeof (name),
 	    "%s@%s", zhp->zfs_name, dd->snapname);
 
-	szhp = make_dataset_handle(zhp->zfs_hdl, name);
-	if (szhp) {
+	if (lzc_exists(name))
 		verify(nvlist_add_boolean(dd->nvl, name) == 0);
-		zfs_close(szhp);
-	}
 
 	rv = zfs_iter_filesystems(zhp, zfs_check_snap_cb, dd);
 	zfs_close(zhp);
@@ -3189,7 +3186,7 @@
 	verify(nvlist_alloc(&dd.nvl, NV_UNIQUE_NAME, 0) == 0);
 	(void) zfs_check_snap_cb(zfs_handle_dup(zhp), &dd);
 
-	if (nvlist_next_nvpair(dd.nvl, NULL) == NULL) {
+	if (nvlist_empty(dd.nvl)) {
 		ret = zfs_standard_error_fmt(zhp->zfs_hdl, ENOENT,
 		    dgettext(TEXT_DOMAIN, "cannot destroy '%s@%s'"),
 		    zhp->zfs_name, snapname);
@@ -3214,7 +3211,7 @@
 	if (ret == 0)
 		return (0);
 
-	if (nvlist_next_nvpair(errlist, NULL) == NULL) {
+	if (nvlist_empty(errlist)) {
 		char errbuf[1024];
 		(void) snprintf(errbuf, sizeof (errbuf),
 		    dgettext(TEXT_DOMAIN, "cannot destroy snapshots"));
@@ -4162,6 +4159,7 @@
 	const char *snapname;
 	const char *tag;
 	boolean_t recursive;
+	int error;
 };
 
 static int
@@ -4168,7 +4166,6 @@
 zfs_hold_one(zfs_handle_t *zhp, void *arg)
 {
 	struct holdarg *ha = arg;
-	zfs_handle_t *szhp;
 	char name[ZFS_MAXNAMELEN];
 	int rv = 0;
 
@@ -4175,11 +4172,8 @@
 	(void) snprintf(name, sizeof (name),
 	    "%s@%s", zhp->zfs_name, ha->snapname);
 
-	szhp = make_dataset_handle(zhp->zfs_hdl, name);
-	if (szhp) {
+	if (lzc_exists(name))
 		fnvlist_add_string(ha->nvl, name, ha->tag);
-		zfs_close(szhp);
-	}
 
 	if (ha->recursive)
 		rv = zfs_iter_filesystems(zhp, zfs_hold_one, ha);
@@ -4189,14 +4183,10 @@
 
 int
 zfs_hold(zfs_handle_t *zhp, const char *snapname, const char *tag,
-    boolean_t recursive, boolean_t enoent_ok, int cleanup_fd)
+    boolean_t recursive, int cleanup_fd)
 {
 	int ret;
 	struct holdarg ha;
-	nvlist_t *errors;
-	libzfs_handle_t *hdl = zhp->zfs_hdl;
-	char errbuf[1024];
-	nvpair_t *elem;
 
 	ha.nvl = fnvlist_alloc();
 	ha.snapname = snapname;
@@ -4204,23 +4194,44 @@
 	ha.recursive = recursive;
 	(void) zfs_hold_one(zfs_handle_dup(zhp), &ha);
 
-	if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) {
+	if (nvlist_empty(ha.nvl)) {
+		char errbuf[1024];
+
 		fnvlist_free(ha.nvl);
 		ret = ENOENT;
 		(void) snprintf(errbuf, sizeof (errbuf),
-		    dgettext(TEXT_DOMAIN, "cannot hold snapshot '%s@%s'"),
+		    dgettext(TEXT_DOMAIN,
+		    "cannot hold snapshot '%s@%s'"),
 		    zhp->zfs_name, snapname);
-		(void) zfs_standard_error(hdl, ret, errbuf);
+		(void) zfs_standard_error(zhp->zfs_hdl, ret, errbuf);
 		return (ret);
 	}
 
-	ret = lzc_hold(ha.nvl, cleanup_fd, &errors);
+	ret = zfs_hold_nvl(zhp, cleanup_fd, ha.nvl);
 	fnvlist_free(ha.nvl);
 
-	if (ret == 0)
+	return (ret);
+}
+
+int
+zfs_hold_nvl(zfs_handle_t *zhp, int cleanup_fd, nvlist_t *holds)
+{
+	int ret;
+	nvlist_t *errors;
+	libzfs_handle_t *hdl = zhp->zfs_hdl;
+	char errbuf[1024];
+	nvpair_t *elem;
+
+	errors = NULL;
+	ret = lzc_hold(holds, cleanup_fd, &errors);
+
+	if (ret == 0) {
+		/* There may be errors even in the success case. */
+		fnvlist_free(errors);
 		return (0);
+	}
 
-	if (nvlist_next_nvpair(errors, NULL) == NULL) {
+	if (nvlist_empty(errors)) {
 		/* no hold-specific errors */
 		(void) snprintf(errbuf, sizeof (errbuf),
 		    dgettext(TEXT_DOMAIN, "cannot hold"));
@@ -4260,10 +4271,6 @@
 		case EEXIST:
 			(void) zfs_error(hdl, EZFS_REFTAG_HOLD, errbuf);
 			break;
-		case ENOENT:
-			if (enoent_ok)
-				return (ENOENT);
-			/* FALLTHROUGH */
 		default:
 			(void) zfs_standard_error(hdl,
 			    fnvpair_value_int32(elem), errbuf);
@@ -4274,30 +4281,26 @@
 	return (ret);
 }
 
-struct releasearg {
-	nvlist_t *nvl;
-	const char *snapname;
-	const char *tag;
-	boolean_t recursive;
-};
-
 static int
 zfs_release_one(zfs_handle_t *zhp, void *arg)
 {
 	struct holdarg *ha = arg;
-	zfs_handle_t *szhp;
 	char name[ZFS_MAXNAMELEN];
 	int rv = 0;
+	nvlist_t *existing_holds;
 
 	(void) snprintf(name, sizeof (name),
 	    "%s@%s", zhp->zfs_name, ha->snapname);
 
-	szhp = make_dataset_handle(zhp->zfs_hdl, name);
-	if (szhp) {
-		nvlist_t *holds = fnvlist_alloc();
-		fnvlist_add_boolean(holds, ha->tag);
-		fnvlist_add_nvlist(ha->nvl, name, holds);
-		zfs_close(szhp);
+	if (lzc_get_holds(name, &existing_holds) != 0) {
+		ha->error = ENOENT;
+	} else if (!nvlist_exists(existing_holds, ha->tag)) {
+		ha->error = ESRCH;
+	} else {
+		nvlist_t *torelease = fnvlist_alloc();
+		fnvlist_add_boolean(torelease, ha->tag);
+		fnvlist_add_nvlist(ha->nvl, name, torelease);
+		fnvlist_free(torelease);
 	}
 
 	if (ha->recursive)
@@ -4312,7 +4315,7 @@
 {
 	int ret;
 	struct holdarg ha;
-	nvlist_t *errors;
+	nvlist_t *errors = NULL;
 	nvpair_t *elem;
 	libzfs_handle_t *hdl = zhp->zfs_hdl;
 	char errbuf[1024];
@@ -4321,16 +4324,21 @@
 	ha.snapname = snapname;
 	ha.tag = tag;
 	ha.recursive = recursive;
+	ha.error = 0;
 	(void) zfs_release_one(zfs_handle_dup(zhp), &ha);
 
-	if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) {
+	if (nvlist_empty(ha.nvl)) {
 		fnvlist_free(ha.nvl);
-		ret = ENOENT;
+		ret = ha.error;
 		(void) snprintf(errbuf, sizeof (errbuf),
 		    dgettext(TEXT_DOMAIN,
 		    "cannot release hold from snapshot '%s@%s'"),
 		    zhp->zfs_name, snapname);
-		(void) zfs_standard_error(hdl, ret, errbuf);
+		if (ret == ESRCH) {
+			(void) zfs_error(hdl, EZFS_REFTAG_RELE, errbuf);
+		} else {
+			(void) zfs_standard_error(hdl, ret, errbuf);
+		}
 		return (ret);
 	}
 
@@ -4337,10 +4345,13 @@
 	ret = lzc_release(ha.nvl, &errors);
 	fnvlist_free(ha.nvl);
 
-	if (ret == 0)
+	if (ret == 0) {
+		/* There may be errors even in the success case. */
+		fnvlist_free(errors);
 		return (0);
+	}
 
-	if (nvlist_next_nvpair(errors, NULL) == NULL) {
+	if (nvlist_empty(errors)) {
 		/* no hold-specific errors */
 		(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
 		    "cannot release"));
@@ -4535,6 +4546,11 @@
 	return (err);
 }
 
+/*
+ * Convert the zvol's volume size to an appropriate reservation.
+ * Note: If this routine is updated, it is necessary to update the ZFS test
+ * suite's shell version in reservation.kshlib.
+ */
 uint64_t
 zvol_volsize_to_reservation(uint64_t volsize, nvlist_t *props)
 {

Modified: trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -1112,7 +1112,6 @@
 	nvlist_t *zc_fsprops = NULL;
 	nvlist_t *zc_props = NULL;
 	char msg[1024];
-	char *altroot;
 	int ret = -1;
 
 	(void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
@@ -1211,21 +1210,6 @@
 		}
 	}
 
-	/*
-	 * If this is an alternate root pool, then we automatically set the
-	 * mountpoint of the root dataset to be '/'.
-	 */
-	if (nvlist_lookup_string(props, zpool_prop_to_name(ZPOOL_PROP_ALTROOT),
-	    &altroot) == 0) {
-		zfs_handle_t *zhp;
-
-		verify((zhp = zfs_open(hdl, pool, ZFS_TYPE_DATASET)) != NULL);
-		verify(zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT),
-		    "/") == 0);
-
-		zfs_close(zhp);
-	}
-
 create_failed:
 	zcmd_free_nvlists(&zc);
 	nvlist_free(zc_props);

Modified: trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -25,6 +25,7 @@
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012 Pawel Jakub Dawidek <pawel at dawidek.net>.
  * All rights reserved.
+ * Copyright (c) 2013 Steven Hartland. All rights reserved.
  */
 
 #include <assert.h>
@@ -731,7 +732,7 @@
 	sd->parent_fromsnap_guid = 0;
 	VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0));
 	VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0));
-	(void) zfs_iter_snapshots(zhp, B_FALSE, send_iterate_snap, sd);
+	(void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd);
 	VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps));
 	VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops));
 	nvlist_free(sd->parent_snaps);
@@ -802,6 +803,7 @@
 	int outfd;
 	boolean_t err;
 	nvlist_t *fss;
+	nvlist_t *snapholds;
 	avl_tree_t *fsavl;
 	snapfilter_cb_t *filter_cb;
 	void *filter_cb_arg;
@@ -952,41 +954,19 @@
 	return (0);
 }
 
-static int
-hold_for_send(zfs_handle_t *zhp, send_dump_data_t *sdd)
+static void
+gather_holds(zfs_handle_t *zhp, send_dump_data_t *sdd)
 {
-	zfs_handle_t *pzhp;
-	int error = 0;
-	char *thissnap;
-
 	assert(zhp->zfs_type == ZFS_TYPE_SNAPSHOT);
 
-	if (sdd->dryrun)
-		return (0);
-
 	/*
-	 * zfs_send() only opens a cleanup_fd for sends that need it,
+	 * zfs_send() only sets snapholds for sends that need them,
 	 * e.g. replication and doall.
 	 */
-	if (sdd->cleanup_fd == -1)
-		return (0);
+	if (sdd->snapholds == NULL)
+		return;
 
-	thissnap = strchr(zhp->zfs_name, '@') + 1;
-	*(thissnap - 1) = '\0';
-	pzhp = zfs_open(zhp->zfs_hdl, zhp->zfs_name, ZFS_TYPE_DATASET);
-	*(thissnap - 1) = '@';
-
-	/*
-	 * It's OK if the parent no longer exists.  The send code will
-	 * handle that error.
-	 */
-	if (pzhp) {
-		error = zfs_hold(pzhp, thissnap, sdd->holdtag,
-		    B_FALSE, B_TRUE, sdd->cleanup_fd);
-		zfs_close(pzhp);
-	}
-
-	return (error);
+	fnvlist_add_string(sdd->snapholds, zhp->zfs_name, sdd->holdtag);
 }
 
 static void *
@@ -1042,28 +1022,23 @@
 	send_dump_data_t *sdd = arg;
 	progress_arg_t pa = { 0 };
 	pthread_t tid;
-
 	char *thissnap;
 	int err;
 	boolean_t isfromsnap, istosnap, fromorigin;
 	boolean_t exclude = B_FALSE;
 
+	err = 0;
 	thissnap = strchr(zhp->zfs_name, '@') + 1;
 	isfromsnap = (sdd->fromsnap != NULL &&
 	    strcmp(sdd->fromsnap, thissnap) == 0);
 
 	if (!sdd->seenfrom && isfromsnap) {
-		err = hold_for_send(zhp, sdd);
-		if (err == 0) {
-			sdd->seenfrom = B_TRUE;
-			(void) strcpy(sdd->prevsnap, thissnap);
-			sdd->prevsnap_obj = zfs_prop_get_int(zhp,
-			    ZFS_PROP_OBJSETID);
-		} else if (err == ENOENT) {
-			err = 0;
-		}
+		gather_holds(zhp, sdd);
+		sdd->seenfrom = B_TRUE;
+		(void) strcpy(sdd->prevsnap, thissnap);
+		sdd->prevsnap_obj = zfs_prop_get_int(zhp, ZFS_PROP_OBJSETID);
 		zfs_close(zhp);
-		return (err);
+		return (0);
 	}
 
 	if (sdd->seento || !sdd->seenfrom) {
@@ -1114,14 +1089,7 @@
 		return (0);
 	}
 
-	err = hold_for_send(zhp, sdd);
-	if (err) {
-		if (err == ENOENT)
-			err = 0;
-		zfs_close(zhp);
-		return (err);
-	}
-
+	gather_holds(zhp, sdd);
 	fromorigin = sdd->prevsnap[0] == '\0' &&
 	    (sdd->fromorigin || sdd->replicate);
 
@@ -1389,7 +1357,7 @@
 	avl_tree_t *fsavl = NULL;
 	static uint64_t holdseq;
 	int spa_version;
-	pthread_t tid;
+	pthread_t tid = 0;
 	int pipefd[2];
 	dedup_arg_t dda = { 0 };
 	int featureflags = 0;
@@ -1462,11 +1430,8 @@
 				*debugnvp = hdrnv;
 			else
 				nvlist_free(hdrnv);
-			if (err) {
-				fsavl_destroy(fsavl);
-				nvlist_free(fss);
+			if (err)
 				goto stderr_out;
-			}
 		}
 
 		if (!flags->dryrun) {
@@ -1490,8 +1455,6 @@
 			}
 			free(packbuf);
 			if (err == -1) {
-				fsavl_destroy(fsavl);
-				nvlist_free(fss);
 				err = errno;
 				goto stderr_out;
 			}
@@ -1502,8 +1465,6 @@
 			drr.drr_u.drr_end.drr_checksum = zc;
 			err = write(outfd, &drr, sizeof (drr));
 			if (err == -1) {
-				fsavl_destroy(fsavl);
-				nvlist_free(fss);
 				err = errno;
 				goto stderr_out;
 			}
@@ -1515,7 +1476,7 @@
 	/* dump each stream */
 	sdd.fromsnap = fromsnap;
 	sdd.tosnap = tosnap;
-	if (flags->dedup)
+	if (tid != 0)
 		sdd.outfd = pipefd[0];
 	else
 		sdd.outfd = outfd;
@@ -1552,34 +1513,69 @@
 			err = errno;
 			goto stderr_out;
 		}
+		sdd.snapholds = fnvlist_alloc();
 	} else {
 		sdd.cleanup_fd = -1;
+		sdd.snapholds = NULL;
 	}
-	if (flags->verbose) {
+	if (flags->verbose || sdd.snapholds != NULL) {
 		/*
 		 * Do a verbose no-op dry run to get all the verbose output
-		 * before generating any data.  Then do a non-verbose real
-		 * run to generate the streams.
+		 * or to gather snapshot hold's before generating any data,
+		 * then do a non-verbose real run to generate the streams.
 		 */
 		sdd.dryrun = B_TRUE;
 		err = dump_filesystems(zhp, &sdd);
-		sdd.dryrun = flags->dryrun;
+
+		if (err != 0)
+			goto stderr_out;
+
+		if (flags->verbose) {
+			if (flags->parsable) {
+				(void) fprintf(stderr, "size\t%llu\n",
+				    (longlong_t)sdd.size);
+			} else {
+				char buf[16];
+				zfs_nicenum(sdd.size, buf, sizeof (buf));
+				(void) fprintf(stderr, dgettext(TEXT_DOMAIN,
+				    "total estimated size is %s\n"), buf);
+			}
+		}
+
+		/* Ensure no snaps found is treated as an error. */
+		if (!sdd.seento) {
+			err = ENOENT;
+			goto err_out;
+		}
+
+		/* Skip the second run if dryrun was requested. */
+		if (flags->dryrun)
+			goto err_out;
+
+		if (sdd.snapholds != NULL) {
+			err = zfs_hold_nvl(zhp, sdd.cleanup_fd, sdd.snapholds);
+			if (err != 0)
+				goto stderr_out;
+
+			fnvlist_free(sdd.snapholds);
+			sdd.snapholds = NULL;
+		}
+
+		sdd.dryrun = B_FALSE;
 		sdd.verbose = B_FALSE;
-		if (flags->parsable) {
-			(void) fprintf(stderr, "size\t%llu\n",
-			    (longlong_t)sdd.size);
-		} else {
-			char buf[16];
-			zfs_nicenum(sdd.size, buf, sizeof (buf));
-			(void) fprintf(stderr, dgettext(TEXT_DOMAIN,
-			    "total estimated size is %s\n"), buf);
-		}
 	}
+
 	err = dump_filesystems(zhp, &sdd);
 	fsavl_destroy(fsavl);
 	nvlist_free(fss);
 
-	if (flags->dedup) {
+	/* Ensure no snaps found is treated as an error. */
+	if (err == 0 && !sdd.seento)
+		err = ENOENT;
+
+	if (tid != 0) {
+		if (err != 0)
+			(void) pthread_cancel(tid);
 		(void) close(pipefd[0]);
 		(void) pthread_join(tid, NULL);
 	}
@@ -1609,12 +1605,16 @@
 stderr_out:
 	err = zfs_standard_error(zhp->zfs_hdl, err, errbuf);
 err_out:
+	fsavl_destroy(fsavl);
+	nvlist_free(fss);
+	fnvlist_free(sdd.snapholds);
+
 	if (sdd.cleanup_fd != -1)
 		VERIFY(0 == close(sdd.cleanup_fd));
-	if (flags->dedup) {
+	if (tid != 0) {
 		(void) pthread_cancel(tid);
+		(void) close(pipefd[0]);
 		(void) pthread_join(tid, NULL);
-		(void) close(pipefd[0]);
 	}
 	return (err);
 }
@@ -1946,11 +1946,12 @@
     recvflags_t *flags, nvlist_t *stream_nv, avl_tree_t *stream_avl,
     nvlist_t *renamed)
 {
-	nvlist_t *local_nv;
+	nvlist_t *local_nv, *deleted = NULL;
 	avl_tree_t *local_avl;
 	nvpair_t *fselem, *nextfselem;
 	char *fromsnap;
 	char newname[ZFS_MAXNAMELEN];
+	char guidname[32];
 	int error;
 	boolean_t needagain, progress, recursive;
 	char *s1, *s2;
@@ -1966,6 +1967,8 @@
 again:
 	needagain = progress = B_FALSE;
 
+	VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0));
+
 	if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL,
 	    recursive, &local_nv, &local_avl)) != 0)
 		return (error);
@@ -2080,6 +2083,8 @@
 					needagain = B_TRUE;
 				else
 					progress = B_TRUE;
+				sprintf(guidname, "%lu", thisguid);
+				nvlist_add_boolean(deleted, guidname);
 				continue;
 			}
 
@@ -2135,6 +2140,8 @@
 				needagain = B_TRUE;
 			else
 				progress = B_TRUE;
+			sprintf(guidname, "%lu", parent_fromsnap_guid);
+			nvlist_add_boolean(deleted, guidname);
 			continue;
 		}
 
@@ -2157,6 +2164,24 @@
 		s2 = strrchr(stream_fsname, '/');
 
 		/*
+		 * Check if we're going to rename based on parent guid change
+		 * and the current parent guid was also deleted. If it was then
+		 * rename will fail and is likely unneeded, so avoid this and
+		 * force an early retry to determine the new
+		 * parent_fromsnap_guid.
+		 */
+		if (stream_parent_fromsnap_guid != 0 &&
+                    parent_fromsnap_guid != 0 &&
+                    stream_parent_fromsnap_guid != parent_fromsnap_guid) {
+			sprintf(guidname, "%lu", parent_fromsnap_guid);
+			if (nvlist_exists(deleted, guidname)) {
+				progress = B_TRUE;
+				needagain = B_TRUE;
+				goto doagain;
+			}
+		}
+
+		/*
 		 * Check for rename. If the exact receive path is specified, it
 		 * does not count as a rename, but we still need to check the
 		 * datasets beneath it.
@@ -2210,8 +2235,10 @@
 		}
 	}
 
+doagain:
 	fsavl_destroy(local_avl);
 	nvlist_free(local_nv);
+	nvlist_free(deleted);
 
 	if (needagain && progress) {
 		/* do another pass to fix up temporary names */

Modified: trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -22,6 +22,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 Steven Hartland. All rights reserved.
  */
 
 /*
@@ -150,6 +151,16 @@
 			return (B_TRUE);
 	}
 
+	/*
+	 * Check any L2 cache devs
+	 */
+	if (nvlist_lookup_nvlist_array(vdev, ZPOOL_CONFIG_L2CACHE, &child,
+	    &children) == 0) {
+		for (c = 0; c < children; c++)
+			if (find_vdev_problem(child[c], func))
+				return (B_TRUE);
+	}
+
 	return (B_FALSE);
 }
 

Added: trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c	                        (rev 0)
+++ trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -0,0 +1,630 @@
+/*
+ * CDDL HEADER START
+ *
+ * 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]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 Steven Hartland. All rights reserved.
+ */
+
+/*
+ * LibZFS_Core (lzc) is intended to replace most functionality in libzfs.
+ * It has the following characteristics:
+ *
+ *  - Thread Safe.  libzfs_core is accessible concurrently from multiple
+ *  threads.  This is accomplished primarily by avoiding global data
+ *  (e.g. caching).  Since it's thread-safe, there is no reason for a
+ *  process to have multiple libzfs "instances".  Therefore, we store
+ *  our few pieces of data (e.g. the file descriptor) in global
+ *  variables.  The fd is reference-counted so that the libzfs_core
+ *  library can be "initialized" multiple times (e.g. by different
+ *  consumers within the same process).
+ *
+ *  - Committed Interface.  The libzfs_core interface will be committed,
+ *  therefore consumers can compile against it and be confident that
+ *  their code will continue to work on future releases of this code.
+ *  Currently, the interface is Evolving (not Committed), but we intend
+ *  to commit to it once it is more complete and we determine that it
+ *  meets the needs of all consumers.
+ *
+ *  - Programatic Error Handling.  libzfs_core communicates errors with
+ *  defined error numbers, and doesn't print anything to stdout/stderr.
+ *
+ *  - Thin Layer.  libzfs_core is a thin layer, marshaling arguments
+ *  to/from the kernel ioctls.  There is generally a 1:1 correspondence
+ *  between libzfs_core functions and ioctls to /dev/zfs.
+ *
+ *  - Clear Atomicity.  Because libzfs_core functions are generally 1:1
+ *  with kernel ioctls, and kernel ioctls are general atomic, each
+ *  libzfs_core function is atomic.  For example, creating multiple
+ *  snapshots with a single call to lzc_snapshot() is atomic -- it
+ *  can't fail with only some of the requested snapshots created, even
+ *  in the event of power loss or system crash.
+ *
+ *  - Continued libzfs Support.  Some higher-level operations (e.g.
+ *  support for "zfs send -R") are too complicated to fit the scope of
+ *  libzfs_core.  This functionality will continue to live in libzfs.
+ *  Where appropriate, libzfs will use the underlying atomic operations
+ *  of libzfs_core.  For example, libzfs may implement "zfs send -R |
+ *  zfs receive" by using individual "send one snapshot", rename,
+ *  destroy, and "receive one snapshot" operations in libzfs_core.
+ *  /sbin/zfs and /zbin/zpool will link with both libzfs and
+ *  libzfs_core.  Other consumers should aim to use only libzfs_core,
+ *  since that will be the supported, stable interface going forwards.
+ */
+
+#define _IN_LIBZFS_CORE_
+
+#include <libzfs_core.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <sys/nvpair.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/zfs_ioctl.h>
+#include "libzfs_core_compat.h"
+#include "libzfs_compat.h"
+
+#ifdef __FreeBSD__
+extern int zfs_ioctl_version;
+#endif
+
+static int g_fd;
+static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
+static int g_refcount;
+
+int
+libzfs_core_init(void)
+{
+	(void) pthread_mutex_lock(&g_lock);
+	if (g_refcount == 0) {
+		g_fd = open("/dev/zfs", O_RDWR);
+		if (g_fd < 0) {
+			(void) pthread_mutex_unlock(&g_lock);
+			return (errno);
+		}
+	}
+	g_refcount++;
+	(void) pthread_mutex_unlock(&g_lock);
+
+	return (0);
+}
+
+void
+libzfs_core_fini(void)
+{
+	(void) pthread_mutex_lock(&g_lock);
+	ASSERT3S(g_refcount, >, 0);
+	g_refcount--;
+	if (g_refcount == 0)
+		(void) close(g_fd);
+	(void) pthread_mutex_unlock(&g_lock);
+}
+
+static int
+lzc_ioctl(zfs_ioc_t ioc, const char *name,
+    nvlist_t *source, nvlist_t **resultp)
+{
+	zfs_cmd_t zc = { 0 };
+	int error = 0;
+	char *packed;
+#ifdef __FreeBSD__
+	nvlist_t *oldsource;
+#endif
+	size_t size;
+
+	ASSERT3S(g_refcount, >, 0);
+
+	(void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name));
+
+#ifdef __FreeBSD__
+	if (zfs_ioctl_version == ZFS_IOCVER_UNDEF)
+		zfs_ioctl_version = get_zfs_ioctl_version();
+
+	if (zfs_ioctl_version < ZFS_IOCVER_LZC) {
+		oldsource = source;
+		error = lzc_compat_pre(&zc, &ioc, &source);
+		if (error)
+			return (error);
+	}
+#endif
+
+	packed = fnvlist_pack(source, &size);
+	zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed;
+	zc.zc_nvlist_src_size = size;
+
+	if (resultp != NULL) {
+		*resultp = NULL;
+		zc.zc_nvlist_dst_size = MAX(size * 2, 128 * 1024);
+		zc.zc_nvlist_dst = (uint64_t)(uintptr_t)
+		    malloc(zc.zc_nvlist_dst_size);
+#ifdef illumos
+		if (zc.zc_nvlist_dst == NULL) {
+#else
+		if (zc.zc_nvlist_dst == 0) {
+#endif
+			error = ENOMEM;
+			goto out;
+		}
+	}
+
+	while (ioctl(g_fd, ioc, &zc) != 0) {
+		if (errno == ENOMEM && resultp != NULL) {
+			free((void *)(uintptr_t)zc.zc_nvlist_dst);
+			zc.zc_nvlist_dst_size *= 2;
+			zc.zc_nvlist_dst = (uint64_t)(uintptr_t)
+			    malloc(zc.zc_nvlist_dst_size);
+#ifdef illumos
+			if (zc.zc_nvlist_dst == NULL) {
+#else
+			if (zc.zc_nvlist_dst == 0) {
+#endif
+				error = ENOMEM;
+				goto out;
+			}
+		} else {
+			error = errno;
+			break;
+		}
+	}
+
+#ifdef __FreeBSD__
+	if (zfs_ioctl_version < ZFS_IOCVER_LZC)
+		lzc_compat_post(&zc, ioc);
+#endif
+	if (zc.zc_nvlist_dst_filled) {
+		*resultp = fnvlist_unpack((void *)(uintptr_t)zc.zc_nvlist_dst,
+		    zc.zc_nvlist_dst_size);
+	}
+#ifdef __FreeBSD__
+	if (zfs_ioctl_version < ZFS_IOCVER_LZC)
+		lzc_compat_outnvl(&zc, ioc, resultp);
+#endif
+out:
+#ifdef __FreeBSD__
+	if (zfs_ioctl_version < ZFS_IOCVER_LZC) {
+		if (source != oldsource)
+			nvlist_free(source);
+		source = oldsource;
+	}
+#endif
+	fnvlist_pack_free(packed, size);
+	free((void *)(uintptr_t)zc.zc_nvlist_dst);
+	return (error);
+}
+
+int
+lzc_create(const char *fsname, dmu_objset_type_t type, nvlist_t *props)
+{
+	int error;
+	nvlist_t *args = fnvlist_alloc();
+	fnvlist_add_int32(args, "type", type);
+	if (props != NULL)
+		fnvlist_add_nvlist(args, "props", props);
+	error = lzc_ioctl(ZFS_IOC_CREATE, fsname, args, NULL);
+	nvlist_free(args);
+	return (error);
+}
+
+int
+lzc_clone(const char *fsname, const char *origin,
+    nvlist_t *props)
+{
+	int error;
+	nvlist_t *args = fnvlist_alloc();
+	fnvlist_add_string(args, "origin", origin);
+	if (props != NULL)
+		fnvlist_add_nvlist(args, "props", props);
+	error = lzc_ioctl(ZFS_IOC_CLONE, fsname, args, NULL);
+	nvlist_free(args);
+	return (error);
+}
+
+/*
+ * Creates snapshots.
+ *
+ * The keys in the snaps nvlist are the snapshots to be created.
+ * They must all be in the same pool.
+ *
+ * The props nvlist is properties to set.  Currently only user properties
+ * are supported.  { user:prop_name -> string value }
+ *
+ * The returned results nvlist will have an entry for each snapshot that failed.
+ * The value will be the (int32) error code.
+ *
+ * The return value will be 0 if all snapshots were created, otherwise it will
+ * be the errno of a (unspecified) snapshot that failed.
+ */
+int
+lzc_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t **errlist)
+{
+	nvpair_t *elem;
+	nvlist_t *args;
+	int error;
+	char pool[MAXNAMELEN];
+
+	*errlist = NULL;
+
+	/* determine the pool name */
+	elem = nvlist_next_nvpair(snaps, NULL);
+	if (elem == NULL)
+		return (0);
+	(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
+	pool[strcspn(pool, "/@")] = '\0';
+
+	args = fnvlist_alloc();
+	fnvlist_add_nvlist(args, "snaps", snaps);
+	if (props != NULL)
+		fnvlist_add_nvlist(args, "props", props);
+
+	error = lzc_ioctl(ZFS_IOC_SNAPSHOT, pool, args, errlist);
+	nvlist_free(args);
+
+	return (error);
+}
+
+/*
+ * Destroys snapshots.
+ *
+ * The keys in the snaps nvlist are the snapshots to be destroyed.
+ * They must all be in the same pool.
+ *
+ * Snapshots that do not exist will be silently ignored.
+ *
+ * If 'defer' is not set, and a snapshot has user holds or clones, the
+ * destroy operation will fail and none of the snapshots will be
+ * destroyed.
+ *
+ * If 'defer' is set, and a snapshot has user holds or clones, it will be
+ * marked for deferred destruction, and will be destroyed when the last hold
+ * or clone is removed/destroyed.
+ *
+ * The return value will be 0 if all snapshots were destroyed (or marked for
+ * later destruction if 'defer' is set) or didn't exist to begin with.
+ *
+ * Otherwise the return value will be the errno of a (unspecified) snapshot
+ * that failed, no snapshots will be destroyed, and the errlist will have an
+ * entry for each snapshot that failed.  The value in the errlist will be
+ * the (int32) error code.
+ */
+int
+lzc_destroy_snaps(nvlist_t *snaps, boolean_t defer, nvlist_t **errlist)
+{
+	nvpair_t *elem;
+	nvlist_t *args;
+	int error;
+	char pool[MAXNAMELEN];
+
+	/* determine the pool name */
+	elem = nvlist_next_nvpair(snaps, NULL);
+	if (elem == NULL)
+		return (0);
+	(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
+	pool[strcspn(pool, "/@")] = '\0';
+
+	args = fnvlist_alloc();
+	fnvlist_add_nvlist(args, "snaps", snaps);
+	if (defer)
+		fnvlist_add_boolean(args, "defer");
+
+	error = lzc_ioctl(ZFS_IOC_DESTROY_SNAPS, pool, args, errlist);
+	nvlist_free(args);
+
+	return (error);
+}
+
+int
+lzc_snaprange_space(const char *firstsnap, const char *lastsnap,
+    uint64_t *usedp)
+{
+	nvlist_t *args;
+	nvlist_t *result;
+	int err;
+	char fs[MAXNAMELEN];
+	char *atp;
+
+	/* determine the fs name */
+	(void) strlcpy(fs, firstsnap, sizeof (fs));
+	atp = strchr(fs, '@');
+	if (atp == NULL)
+		return (EINVAL);
+	*atp = '\0';
+
+	args = fnvlist_alloc();
+	fnvlist_add_string(args, "firstsnap", firstsnap);
+
+	err = lzc_ioctl(ZFS_IOC_SPACE_SNAPS, lastsnap, args, &result);
+	nvlist_free(args);
+	if (err == 0)
+		*usedp = fnvlist_lookup_uint64(result, "used");
+	fnvlist_free(result);
+
+	return (err);
+}
+
+boolean_t
+lzc_exists(const char *dataset)
+{
+	/*
+	 * The objset_stats ioctl is still legacy, so we need to construct our
+	 * own zfs_cmd_t rather than using zfsc_ioctl().
+	 */
+	zfs_cmd_t zc = { 0 };
+
+	(void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name));
+	return (ioctl(g_fd, ZFS_IOC_OBJSET_STATS, &zc) == 0);
+}
+
+/*
+ * Create "user holds" on snapshots.  If there is a hold on a snapshot,
+ * the snapshot can not be destroyed.  (However, it can be marked for deletion
+ * by lzc_destroy_snaps(defer=B_TRUE).)
+ *
+ * The keys in the nvlist are snapshot names.
+ * The snapshots must all be in the same pool.
+ * The value is the name of the hold (string type).
+ *
+ * If cleanup_fd is not -1, it must be the result of open("/dev/zfs", O_EXCL).
+ * In this case, when the cleanup_fd is closed (including on process
+ * termination), the holds will be released.  If the system is shut down
+ * uncleanly, the holds will be released when the pool is next opened
+ * or imported.
+ *
+ * Holds for snapshots which don't exist will be skipped and have an entry
+ * added to errlist, but will not cause an overall failure.
+ *
+ * The return value will be 0 if all holds, for snapshots that existed,
+ * were succesfully created.
+ *
+ * Otherwise the return value will be the errno of a (unspecified) hold that
+ * failed and no holds will be created.
+ *
+ * In all cases the errlist will have an entry for each hold that failed
+ * (name = snapshot), with its value being the error code (int32).
+ */
+int
+lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist)
+{
+	char pool[MAXNAMELEN];
+	nvlist_t *args;
+	nvpair_t *elem;
+	int error;
+
+	/* determine the pool name */
+	elem = nvlist_next_nvpair(holds, NULL);
+	if (elem == NULL)
+		return (0);
+	(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
+	pool[strcspn(pool, "/@")] = '\0';
+
+	args = fnvlist_alloc();
+	fnvlist_add_nvlist(args, "holds", holds);
+	if (cleanup_fd != -1)
+		fnvlist_add_int32(args, "cleanup_fd", cleanup_fd);
+
+	error = lzc_ioctl(ZFS_IOC_HOLD, pool, args, errlist);
+	nvlist_free(args);
+	return (error);
+}
+
+/*
+ * Release "user holds" on snapshots.  If the snapshot has been marked for
+ * deferred destroy (by lzc_destroy_snaps(defer=B_TRUE)), it does not have
+ * any clones, and all the user holds are removed, then the snapshot will be
+ * destroyed.
+ *
+ * The keys in the nvlist are snapshot names.
+ * The snapshots must all be in the same pool.
+ * The value is a nvlist whose keys are the holds to remove.
+ *
+ * Holds which failed to release because they didn't exist will have an entry
+ * added to errlist, but will not cause an overall failure.
+ *
+ * The return value will be 0 if the nvl holds was empty or all holds that
+ * existed, were successfully removed.
+ *
+ * Otherwise the return value will be the errno of a (unspecified) hold that
+ * failed to release and no holds will be released.
+ *
+ * In all cases the errlist will have an entry for each hold that failed to
+ * to release.
+ */
+int
+lzc_release(nvlist_t *holds, nvlist_t **errlist)
+{
+	char pool[MAXNAMELEN];
+	nvpair_t *elem;
+
+	/* determine the pool name */
+	elem = nvlist_next_nvpair(holds, NULL);
+	if (elem == NULL)
+		return (0);
+	(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
+	pool[strcspn(pool, "/@")] = '\0';
+
+	return (lzc_ioctl(ZFS_IOC_RELEASE, pool, holds, errlist));
+}
+
+/*
+ * Retrieve list of user holds on the specified snapshot.
+ *
+ * On success, *holdsp will be set to a nvlist which the caller must free.
+ * The keys are the names of the holds, and the value is the creation time
+ * of the hold (uint64) in seconds since the epoch.
+ */
+int
+lzc_get_holds(const char *snapname, nvlist_t **holdsp)
+{
+	int error;
+	nvlist_t *innvl = fnvlist_alloc();
+	error = lzc_ioctl(ZFS_IOC_GET_HOLDS, snapname, innvl, holdsp);
+	fnvlist_free(innvl);
+	return (error);
+}
+
+/*
+ * If fromsnap is NULL, a full (non-incremental) stream will be sent.
+ */
+int
+lzc_send(const char *snapname, const char *fromsnap, int fd)
+{
+	nvlist_t *args;
+	int err;
+
+	args = fnvlist_alloc();
+	fnvlist_add_int32(args, "fd", fd);
+	if (fromsnap != NULL)
+		fnvlist_add_string(args, "fromsnap", fromsnap);
+	err = lzc_ioctl(ZFS_IOC_SEND_NEW, snapname, args, NULL);
+	nvlist_free(args);
+	return (err);
+}
+
+/*
+ * If fromsnap is NULL, a full (non-incremental) stream will be estimated.
+ */
+int
+lzc_send_space(const char *snapname, const char *fromsnap, uint64_t *spacep)
+{
+	nvlist_t *args;
+	nvlist_t *result;
+	int err;
+
+	args = fnvlist_alloc();
+	if (fromsnap != NULL)
+		fnvlist_add_string(args, "fromsnap", fromsnap);
+	err = lzc_ioctl(ZFS_IOC_SEND_SPACE, snapname, args, &result);
+	nvlist_free(args);
+	if (err == 0)
+		*spacep = fnvlist_lookup_uint64(result, "space");
+	nvlist_free(result);
+	return (err);
+}
+
+static int
+recv_read(int fd, void *buf, int ilen)
+{
+	char *cp = buf;
+	int rv;
+	int len = ilen;
+
+	do {
+		rv = read(fd, cp, len);
+		cp += rv;
+		len -= rv;
+	} while (rv > 0);
+
+	if (rv < 0 || len != 0)
+		return (EIO);
+
+	return (0);
+}
+
+/*
+ * The simplest receive case: receive from the specified fd, creating the
+ * specified snapshot.  Apply the specified properties a "received" properties
+ * (which can be overridden by locally-set properties).  If the stream is a
+ * clone, its origin snapshot must be specified by 'origin'.  The 'force'
+ * flag will cause the target filesystem to be rolled back or destroyed if
+ * necessary to receive.
+ *
+ * Return 0 on success or an errno on failure.
+ *
+ * Note: this interface does not work on dedup'd streams
+ * (those with DMU_BACKUP_FEATURE_DEDUP).
+ */
+int
+lzc_receive(const char *snapname, nvlist_t *props, const char *origin,
+    boolean_t force, int fd)
+{
+	/*
+	 * The receive ioctl is still legacy, so we need to construct our own
+	 * zfs_cmd_t rather than using zfsc_ioctl().
+	 */
+	zfs_cmd_t zc = { 0 };
+	char *atp;
+	char *packed = NULL;
+	size_t size;
+	dmu_replay_record_t drr;
+	int error;
+
+	ASSERT3S(g_refcount, >, 0);
+
+	/* zc_name is name of containing filesystem */
+	(void) strlcpy(zc.zc_name, snapname, sizeof (zc.zc_name));
+	atp = strchr(zc.zc_name, '@');
+	if (atp == NULL)
+		return (EINVAL);
+	*atp = '\0';
+
+	/* if the fs does not exist, try its parent. */
+	if (!lzc_exists(zc.zc_name)) {
+		char *slashp = strrchr(zc.zc_name, '/');
+		if (slashp == NULL)
+			return (ENOENT);
+		*slashp = '\0';
+
+	}
+
+	/* zc_value is full name of the snapshot to create */
+	(void) strlcpy(zc.zc_value, snapname, sizeof (zc.zc_value));
+
+	if (props != NULL) {
+		/* zc_nvlist_src is props to set */
+		packed = fnvlist_pack(props, &size);
+		zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed;
+		zc.zc_nvlist_src_size = size;
+	}
+
+	/* zc_string is name of clone origin (if DRR_FLAG_CLONE) */
+	if (origin != NULL)
+		(void) strlcpy(zc.zc_string, origin, sizeof (zc.zc_string));
+
+	/* zc_begin_record is non-byteswapped BEGIN record */
+	error = recv_read(fd, &drr, sizeof (drr));
+	if (error != 0)
+		goto out;
+	zc.zc_begin_record = drr.drr_u.drr_begin;
+
+	/* zc_cookie is fd to read from */
+	zc.zc_cookie = fd;
+
+	/* zc guid is force flag */
+	zc.zc_guid = force;
+
+	/* zc_cleanup_fd is unused */
+	zc.zc_cleanup_fd = -1;
+
+	error = ioctl(g_fd, ZFS_IOC_RECV, &zc);
+	if (error != 0)
+		error = errno;
+
+out:
+	if (packed != NULL)
+		fnvlist_pack_free(packed, size);
+	free((void*)(uintptr_t)zc.zc_nvlist_dst);
+	return (error);
+}


Property changes on: trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h	                        (rev 0)
+++ trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * 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]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 by Martin Matuska <mm at FreeBSD.org>. All rights reserved.
+ */
+
+#ifndef	_LIBZFS_CORE_H
+#define	_LIBZFS_CORE_H
+
+#include <libnvpair.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/fs/zfs.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+int libzfs_core_init(void);
+void libzfs_core_fini(void);
+
+int lzc_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t **errlist);
+int lzc_create(const char *fsname, dmu_objset_type_t type, nvlist_t *props);
+int lzc_clone(const char *fsname, const char *origin, nvlist_t *props);
+int lzc_destroy_snaps(nvlist_t *snaps, boolean_t defer, nvlist_t **errlist);
+
+int lzc_snaprange_space(const char *firstsnap, const char *lastsnap,
+    uint64_t *usedp);
+
+int lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist);
+int lzc_release(nvlist_t *holds, nvlist_t **errlist);
+int lzc_get_holds(const char *snapname, nvlist_t **holdsp);
+
+int lzc_send(const char *snapname, const char *fromsnap, int fd);
+int lzc_receive(const char *snapname, nvlist_t *props, const char *origin,
+    boolean_t force, int fd);
+int lzc_send_space(const char *snapname, const char *fromsnap,
+    uint64_t *result);
+
+boolean_t lzc_exists(const char *dataset);
+
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _LIBZFS_CORE_H */


Property changes on: trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.c	                        (rev 0)
+++ trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -0,0 +1,189 @@
+/*
+ * CDDL HEADER START
+ *
+ * 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]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2013 Martin Matuska <mm at FreeBSD.org>. All rights reserved.
+ */
+
+#include <sys/zfs_ioctl.h>
+#include <zfs_ioctl_compat.h>
+#include "libzfs_core_compat.h"
+
+extern int zfs_ioctl_version;
+
+int
+lzc_compat_pre(zfs_cmd_t *zc, zfs_ioc_t *ioc, nvlist_t **source)
+{
+	nvlist_t *nvl = NULL;
+	nvpair_t *pair, *hpair;
+	char *buf, *val;
+	zfs_ioc_t vecnum;
+	uint32_t type32;
+	int32_t cleanup_fd;
+	int error = 0;
+	int pos;
+
+	if (zfs_ioctl_version >= ZFS_IOCVER_LZC)
+		return (0);
+
+	vecnum = *ioc;
+
+	switch (vecnum) {
+	case ZFS_IOC_CREATE:
+		type32 = fnvlist_lookup_int32(*source, "type");
+		zc->zc_objset_type = (uint64_t)type32;
+		nvlist_lookup_nvlist(*source, "props", &nvl);
+		*source = nvl;
+	break;
+	case ZFS_IOC_CLONE:
+		buf = fnvlist_lookup_string(*source, "origin");
+		strlcpy(zc->zc_value, buf, MAXPATHLEN);
+		nvlist_lookup_nvlist(*source, "props", &nvl);
+		*ioc = ZFS_IOC_CREATE;
+		*source = nvl;
+	break;
+	case ZFS_IOC_SNAPSHOT:
+		nvl = fnvlist_lookup_nvlist(*source, "snaps");
+		pair = nvlist_next_nvpair(nvl, NULL);
+		if (pair != NULL) {
+			buf = nvpair_name(pair);
+			pos = strcspn(buf, "@");
+			strlcpy(zc->zc_name, buf, pos + 1);
+			strlcpy(zc->zc_value, buf + pos + 1, MAXPATHLEN);
+		} else
+			error = EINVAL;
+		/* old kernel cannot create multiple snapshots */
+		if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
+			error = EOPNOTSUPP;
+		nvlist_free(nvl);
+		nvl = NULL;
+		nvlist_lookup_nvlist(*source, "props", &nvl);
+		*source = nvl;
+	break;
+	case ZFS_IOC_SPACE_SNAPS:
+		buf = fnvlist_lookup_string(*source, "firstsnap");
+		strlcpy(zc->zc_value, buf, MAXPATHLEN);
+	break;
+	case ZFS_IOC_DESTROY_SNAPS:
+		nvl = fnvlist_lookup_nvlist(*source, "snaps");
+		pair = nvlist_next_nvpair(nvl, NULL);
+		if (pair != NULL) {
+			buf = nvpair_name(pair);
+			pos = strcspn(buf, "@");
+			strlcpy(zc->zc_name, buf, pos + 1);
+		} else
+			error = EINVAL;
+		/* old kernel cannot atomically destroy multiple snaps */
+		if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
+			error = EOPNOTSUPP;
+		*source = nvl;
+	break;
+	case ZFS_IOC_HOLD:
+		nvl = fnvlist_lookup_nvlist(*source, "holds");
+		pair = nvlist_next_nvpair(nvl, NULL);
+		if (pair != NULL) {
+			buf = nvpair_name(pair);
+			pos = strcspn(buf, "@");
+			strlcpy(zc->zc_name, buf, pos + 1);
+			strlcpy(zc->zc_value, buf + pos + 1, MAXPATHLEN);
+			if (nvpair_value_string(pair, &val) == 0)
+				strlcpy(zc->zc_string, val, MAXNAMELEN);
+			else
+				error = EINVAL;
+		} else
+			error = EINVAL;
+		/* old kernel cannot atomically create multiple holds */
+		if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
+			error = EOPNOTSUPP;
+		nvlist_free(nvl);
+		if (nvlist_lookup_int32(*source, "cleanup_fd",
+		    &cleanup_fd) == 0)
+			zc->zc_cleanup_fd = cleanup_fd;
+		else
+			zc->zc_cleanup_fd = -1;
+	break;
+	case ZFS_IOC_RELEASE:
+		pair = nvlist_next_nvpair(*source, NULL);
+		if (pair != NULL) {
+			buf = nvpair_name(pair);
+			pos = strcspn(buf, "@");
+			strlcpy(zc->zc_name, buf, pos + 1);
+			strlcpy(zc->zc_value, buf + pos + 1, MAXPATHLEN);
+			if (nvpair_value_nvlist(pair, &nvl) == 0) {
+				hpair = nvlist_next_nvpair(nvl, NULL);
+				if (hpair != NULL)
+					strlcpy(zc->zc_string,
+					    nvpair_name(hpair), MAXNAMELEN);
+				else
+					error = EINVAL;
+				if (!error && nvlist_next_nvpair(nvl,
+				    hpair) != NULL)
+					error = EOPNOTSUPP;
+			} else
+				error = EINVAL;
+		} else
+			error = EINVAL;
+		/* old kernel cannot atomically release multiple holds */
+		if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
+			error = EOPNOTSUPP;
+	break;
+	}
+
+	return (error);
+}
+
+void
+lzc_compat_post(zfs_cmd_t *zc, const zfs_ioc_t ioc)
+{
+	if (zfs_ioctl_version >= ZFS_IOCVER_LZC)
+		return;
+
+	switch (ioc) {
+	case ZFS_IOC_CREATE:
+	case ZFS_IOC_CLONE:
+	case ZFS_IOC_SNAPSHOT:
+	case ZFS_IOC_SPACE_SNAPS:
+	case ZFS_IOC_DESTROY_SNAPS:
+		zc->zc_nvlist_dst_filled = B_FALSE;
+	break;
+	}
+}
+
+int
+lzc_compat_outnvl(zfs_cmd_t *zc, const zfs_ioc_t ioc, nvlist_t **outnvl)
+{
+	nvlist_t *nvl;
+
+	if (zfs_ioctl_version >= ZFS_IOCVER_LZC)
+		return (0);
+
+	switch (ioc) {
+	case ZFS_IOC_SPACE_SNAPS:
+		nvl = fnvlist_alloc();
+		fnvlist_add_uint64(nvl, "used", zc->zc_cookie);
+		fnvlist_add_uint64(nvl, "compressed", zc->zc_objset_type);
+		fnvlist_add_uint64(nvl, "uncompressed", zc->zc_perm_action);
+		*outnvl = nvl;
+	break;
+	}
+
+	return (0);
+}


Property changes on: trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.h
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.h	                        (rev 0)
+++ trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.h	2016-10-14 02:18:41 UTC (rev 9162)
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * 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]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2013 by Martin Matuska <mm at FreeBSD.org>. All rights reserved.
+ */
+
+#ifndef	_LIBZFS_CORE_COMPAT_H
+#define	_LIBZFS_CORE_COMPAT_H
+
+#include <libnvpair.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/fs/zfs.h>
+#include <sys/zfs_ioctl.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+int lzc_compat_pre(zfs_cmd_t *, zfs_ioc_t *, nvlist_t **);
+void lzc_compat_post(zfs_cmd_t *, const zfs_ioc_t);
+int lzc_compat_outnvl(zfs_cmd_t *, const zfs_ioc_t, nvlist_t **);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _LIBZFS_CORE_COMPAT_H */


Property changes on: trunk/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/cddl/contrib/opensolaris/lib/libzpool/common/util.c
===================================================================
--- trunk/cddl/contrib/opensolaris/lib/libzpool/common/util.c	2016-10-14 02:17:04 UTC (rev 9161)
+++ trunk/cddl/contrib/opensolaris/lib/libzpool/common/util.c	2016-10-14 02:18:41 UTC (rev 9162)
@@ -108,7 +108,7 @@
 		(void) printf("%*s%s%*s%*s%*s %5s %5s %5s %5s %5s %5s %5s\n",
 		    indent, "",
 		    prefix,
-		    (int)(indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12)),
+		    indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12),
 		    desc,
 		    vs->vs_space ? 6 : 0, vs->vs_space ? used : "",
 		    vs->vs_space ? 6 : 0, vs->vs_space ? avail : "",



More information about the Midnightbsd-cvs mailing list