aboutsummaryrefslogtreecommitdiff
path: root/cddl
diff options
context:
space:
mode:
Diffstat (limited to 'cddl')
-rw-r--r--cddl/compat/opensolaris/misc/thread_pool.c6
-rwxr-xr-xcddl/contrib/dtracetoolkit/Proc/pidpersec.d4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/dtrace.15
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/dtrace.c32
-rwxr-xr-xcddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d.out15
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.baddef1.d2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.badxlate.d2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c13
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d2
-rwxr-xr-xcddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh7
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh.out12
-rwxr-xr-xcddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh1
-rwxr-xr-xcddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh1
-rwxr-xr-xcddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh7
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh.out12
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NL.char.d4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NULL.char.d4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_STR_NL.string.d4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh8
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.roch.d4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/offsetof/err.D_UNKNOWN.badmemb.d2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.exe2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.exe2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.exe2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.exe2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.exe2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.exe2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.exe2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.coverage.exe2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.fork.d2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.manypids.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.available.exe2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.libmap.exe2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh9
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh8
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh13
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.selfarray2.d4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/Makefile13
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh11
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh6
-rw-r--r--cddl/contrib/opensolaris/cmd/lockstat/lockstat.c24
-rw-r--r--cddl/contrib/opensolaris/cmd/lockstat/sym.c19
-rw-r--r--cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c8
-rw-r--r--cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h2
-rw-r--r--cddl/contrib/opensolaris/cmd/plockstat/plockstat.c14
-rw-r--r--cddl/contrib/opensolaris/cmd/sgs/include/alist.h2
-rw-r--r--cddl/contrib/opensolaris/cmd/sgs/include/sgs.h2
-rw-r--r--cddl/contrib/opensolaris/cmd/zdb/zdb.c6
-rw-r--r--cddl/contrib/opensolaris/cmd/zfs/zfs.855
-rw-r--r--cddl/contrib/opensolaris/cmd/zfs/zfs_main.c27
-rw-r--r--cddl/contrib/opensolaris/cmd/zpool/zpool-features.72
-rw-r--r--cddl/contrib/opensolaris/cmd/zpool/zpool_main.c100
-rw-r--r--cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c18
-rw-r--r--cddl/contrib/opensolaris/common/ctf/ctf_create.c38
-rw-r--r--cddl/contrib/opensolaris/common/util/strtolctype.h2
-rw-r--r--cddl/contrib/opensolaris/lib/libctf/common/ctf.51140
-rw-r--r--cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c10
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c190
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/drti.c80
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c4
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c10
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c13
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c4
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c2
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c2
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c6
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h17
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l11
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c155
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c8
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c30
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c77
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c31
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c2
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c97
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c2
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c18
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c58
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c2
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c9
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c16
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c2
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h6
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c10
-rw-r--r--cddl/contrib/opensolaris/lib/libgen/common/gmatch.c4
-rw-r--r--cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c11
-rw-r--r--cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h2
-rw-r--r--cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c403
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h4
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c80
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c2
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c73
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c5
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c24
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c60
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c2
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c6
-rw-r--r--cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h2
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c8
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/barrier.h2
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c6
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c4
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c12
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h8
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c4
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/merge.c2
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/output.c8
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/tdata.c2
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/util.c2
-rw-r--r--cddl/lib/Makefile10
-rw-r--r--cddl/lib/libctf/Makefile1
-rw-r--r--cddl/lib/libdtrace/Makefile7
-rw-r--r--cddl/lib/libdtrace/Makefile.depend3
-rw-r--r--cddl/lib/libdtrace/libproc_compat.h2
-rw-r--r--cddl/lib/libdtrace/siftr.d100
-rw-r--r--cddl/lib/libnvpair/Makefile1
-rw-r--r--cddl/sbin/Makefile2
-rw-r--r--cddl/usr.bin/Makefile2
-rw-r--r--cddl/usr.bin/ctfconvert/Makefile5
-rw-r--r--cddl/usr.bin/ctfconvert/ctfconvert.14
-rw-r--r--cddl/usr.bin/ctfdump/Makefile3
-rw-r--r--cddl/usr.bin/ctfmerge/Makefile3
-rw-r--r--cddl/usr.sbin/Makefile8
-rw-r--r--cddl/usr.sbin/dtrace/Makefile5
-rw-r--r--cddl/usr.sbin/dtrace/tests/Makefile15
-rw-r--r--cddl/usr.sbin/dtrace/tests/Makefile.inc152
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/Makefile91
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/aggs/Makefile189
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/arithmetic/Makefile32
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/arrays/Makefile29
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/assocs/Makefile32
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/begin/Makefile22
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/bitfields/Makefile26
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/buffering/Makefile37
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/builtinvar/Makefile48
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/cg/Makefile18
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/clauses/Makefile26
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/cpc/Makefile27
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/decls/Makefile30
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/docsExamples/Makefile32
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/drops/Makefile24
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/dtraceUtil/Makefile118
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/end/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/enum/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/error/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/exit/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile26
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/funcs/Makefile113
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/grammar/Makefile20
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/include/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/inline/Makefile28
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/io/Makefile18
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/ip/Makefile36
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/java_api/Makefile44
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/json/Makefile23
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/lexer/Makefile30
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile50
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/mdb/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/mib/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/misc/Makefile30
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/multiaggs/Makefile34
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/nfs/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/offsetof/Makefile28
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/operators/Makefile18
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/pid/Makefile69
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/plockstat/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/pointers/Makefile48
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/pragma/Makefile30
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/predicates/Makefile25
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/preprocessor/Makefile53
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/print/Makefile32
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/printa/Makefile40
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/printf/Makefile68
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/privs/Makefile23
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/probes/Makefile36
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/proc/Makefile30
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/profile-n/Makefile53
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/providers/Makefile44
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/raise/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/rates/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/safety/Makefile54
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/scalars/Makefile35
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/sched/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/scripting/Makefile49
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/sdt/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/sizeof/Makefile31
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/speculation/Makefile75
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/stability/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/stack/Makefile22
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/stackdepth/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/stop/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/strlen/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/strtoll/Makefile20
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/struct/Makefile31
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/syscall/Makefile18
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/sysevent/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/tick-n/Makefile38
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/trace/Makefile24
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/tracemem/Makefile26
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/translators/Makefile51
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/typedef/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/types/Makefile69
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/uctf/Makefile41
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/union/Makefile27
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/usdt/Makefile65
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/ustack/Makefile20
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/vars/Makefile23
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/version/Makefile17
-rwxr-xr-xcddl/usr.sbin/dtrace/tests/tools/dtest.sh129
-rwxr-xr-xcddl/usr.sbin/dtrace/tests/tools/exclude.sh193
-rwxr-xr-xcddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh85
-rwxr-xr-xcddl/usr.sbin/dtrace/tests/tools/gentest.sh110
-rw-r--r--cddl/usr.sbin/lockstat/Makefile6
-rw-r--r--cddl/usr.sbin/lockstat/Makefile.depend2
-rw-r--r--cddl/usr.sbin/plockstat/Makefile5
259 files changed, 6364 insertions, 753 deletions
diff --git a/cddl/compat/opensolaris/misc/thread_pool.c b/cddl/compat/opensolaris/misc/thread_pool.c
index a6a834fb2bbd..6ae0055afceb 100644
--- a/cddl/compat/opensolaris/misc/thread_pool.c
+++ b/cddl/compat/opensolaris/misc/thread_pool.c
@@ -233,12 +233,11 @@ tpool_create(uint_t min_threads, uint_t max_threads, uint_t linger,
return (NULL);
}
- tpool = malloc(sizeof (*tpool));
+ tpool = calloc(1, sizeof (*tpool));
if (tpool == NULL) {
errno = ENOMEM;
return (NULL);
}
- bzero(tpool, sizeof(*tpool));
(void) pthread_mutex_init(&tpool->tp_mutex, NULL);
(void) pthread_cond_init(&tpool->tp_busycv, NULL);
(void) pthread_cond_init(&tpool->tp_workcv, NULL);
@@ -267,9 +266,8 @@ tpool_dispatch(tpool_t *tpool, void (*func)(void *), void *arg)
{
tpool_job_t *job;
- if ((job = malloc(sizeof (*job))) == NULL)
+ if ((job = calloc(1, sizeof (*job))) == NULL)
return (-1);
- bzero(job, sizeof(*job));
job->tpj_next = NULL;
job->tpj_func = func;
job->tpj_arg = arg;
diff --git a/cddl/contrib/dtracetoolkit/Proc/pidpersec.d b/cddl/contrib/dtracetoolkit/Proc/pidpersec.d
index 71080b9e7527..ab57b66ee581 100755
--- a/cddl/contrib/dtracetoolkit/Proc/pidpersec.d
+++ b/cddl/contrib/dtracetoolkit/Proc/pidpersec.d
@@ -41,7 +41,7 @@
dtrace:::BEGIN
{
- printf("%-22s %8s %6s\n", "TIME", "LASTPID", "PID/s");
+ printf("%-22s %6s\n", "TIME", "PID/s");
pids = 0;
}
@@ -52,6 +52,6 @@ proc:::exec-success
profile:::tick-1sec
{
- printf("%-22Y %8d %6d\n", walltimestamp, `mpid, pids);
+ printf("%-22Y %6d\n", walltimestamp, pids);
pids = 0;
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1
index 2d210a2cde84..907baee660b6 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1
+++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1
@@ -21,7 +21,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 5, 2013
+.Dd April 18, 2015
.Dt DTRACE 1
.Os
.Sh NAME
@@ -670,7 +670,8 @@ Invalid command line options or arguments were specified.
.Sh SEE ALSO
.Xr cpp 1 ,
.Xr dtruss 1 ,
-.Xr elf 5
+.Xr elf 5 ,
+.Xr SDT 9
.Rs
.%T Solaris Dynamic Tracing Guide
.Re
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
index 3a954ed40482..d8bdaa61faf4 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
@@ -43,11 +43,11 @@
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <libgen.h>
-#if defined(sun)
+#ifdef illumos
#include <libproc.h>
#endif
@@ -101,7 +101,7 @@ static int g_grabanon = 0;
static const char *g_ofile = NULL;
static FILE *g_ofp;
static dtrace_hdl_t *g_dtp;
-#if defined(sun)
+#ifdef illumos
static char *g_etcfile = "/etc/system";
static const char *g_etcbegin = "* vvvv Added by DTrace";
static const char *g_etcend = "* ^^^^ Added by DTrace";
@@ -211,7 +211,7 @@ fatal(const char *fmt, ...)
static void
dfatal(const char *fmt, ...)
{
-#if !defined(sun) && defined(NEED_ERRLOC)
+#if !defined(illumos) && defined(NEED_ERRLOC)
char *p_errfile = NULL;
int errline = 0;
#endif
@@ -232,7 +232,7 @@ dfatal(const char *fmt, ...)
(void) fprintf(stderr, "%s\n",
dtrace_errmsg(g_dtp, dtrace_errno(g_dtp)));
}
-#if !defined(sun) && defined(NEED_ERRLOC)
+#if !defined(illumos) && defined(NEED_ERRLOC)
dt_get_errloc(g_dtp, &p_errfile, &errline);
if (p_errfile != NULL)
printf("File '%s', line %d\n", p_errfile, errline);
@@ -397,7 +397,7 @@ dof_prune(const char *fname)
free(buf);
}
-#if defined(sun)
+#ifdef illumos
static void
etcsystem_prune(void)
{
@@ -508,7 +508,7 @@ etcsystem_add(void)
error("added forceload directives to %s\n", g_ofile);
}
-#endif
+#endif /* illumos */
static void
print_probe_info(const dtrace_probeinfo_t *p)
@@ -643,7 +643,7 @@ anon_prog(const dtrace_cmd_t *dcp, dof_hdr_t *dof, int n)
p = (uchar_t *)dof;
q = p + dof->dofh_loadsz;
-#if defined(sun)
+#ifdef illumos
oprintf("dof-data-%d=0x%x", n, *p++);
while (p < q)
@@ -793,7 +793,7 @@ compile_str(dtrace_cmd_t *dcp)
static void
prochandler(struct ps_prochandle *P, const char *msg, void *arg)
{
-#if defined(sun)
+#ifdef illumos
const psinfo_t *prp = Ppsinfo(P);
int pid = Pstatus(P)->pr_pid;
char name[SIG2STR_MAX];
@@ -807,13 +807,13 @@ prochandler(struct ps_prochandle *P, const char *msg, void *arg)
return;
}
-#if defined(sun)
+#ifdef illumos
switch (Pstate(P)) {
#else
switch (proc_state(P)) {
#endif
case PS_UNDEAD:
-#if defined(sun)
+#ifdef illumos
/*
* Ideally we would like to always report pr_wstat here, but it
* isn't possible given current /proc semantics. If we grabbed
@@ -831,7 +831,7 @@ prochandler(struct ps_prochandle *P, const char *msg, void *arg)
notice("pid %d terminated by %d\n", pid,
WTERMSIG(wstatus));
#endif
-#if defined(sun)
+#ifdef illumos
} else if (prp != NULL && WEXITSTATUS(prp->pr_wstat) != 0) {
notice("pid %d exited with status %d\n",
pid, WEXITSTATUS(prp->pr_wstat));
@@ -1238,7 +1238,7 @@ installsighands(void)
if (sigaction(SIGTERM, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
(void) sigaction(SIGTERM, &act, NULL);
-#if !defined(sun)
+#ifndef illumos
if (sigaction(SIGPIPE, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
(void) sigaction(SIGPIPE, &act, NULL);
@@ -1720,7 +1720,7 @@ main(int argc, char *argv[])
case DMODE_ANON:
if (g_ofile == NULL)
-#if defined(sun)
+#ifdef illumos
g_ofile = "/kernel/drv/dtrace.conf";
#else
/*
@@ -1732,7 +1732,7 @@ main(int argc, char *argv[])
#endif
dof_prune(g_ofile); /* strip out any old DOF directives */
-#if defined(sun)
+#ifdef illumos
etcsystem_prune(); /* string out any forceload directives */
#endif
@@ -1765,7 +1765,7 @@ main(int argc, char *argv[])
* that itself contains a #pragma D option quiet.
*/
error("saved anonymous enabling in %s\n", g_ofile);
-#if defined(sun)
+#ifdef illumos
etcsystem_add();
error("run update_drv(1M) or reboot to enable changes\n");
#endif
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl b/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl
index db157415b62b..f32dbcefb6a5 100755
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl
@@ -273,7 +273,7 @@ sub run_tests {
}
$fullname = "$dir/$name";
- $exe = "./$base.exe";
+ $exe = "$dir/$base.exe";
$exe_pid = -1;
if ($opt_a && ($status != 0 || $tag != 0 || $droptag != 0 ||
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d
index b7ffbfa4329c..63a850133b3f 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d
@@ -35,11 +35,11 @@ BEGIN
this->b = -2;
system("echo %s %d %d", "foo", this->a, this->b);
- system("ping localhost");
+ system("ping -q -c 1 localhost 2>/dev/null | grep -v '^round-trip '");
system("echo %d", ++this->a);
- system("ping localhost");
+ system("ping -q -c 1 localhost 2>/dev/null | grep -v '^round-trip '");
system("echo %d", ++this->a);
- system("ping localhost");
+ system("ping -q -c 1 localhost 2>/dev/null | grep -v '^round-trip '");
system("echo %d", ++this->a);
exit(0);
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d.out
index cd0d735f0fb2..fa61a5110615 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d.out
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.system.d.out
@@ -1,8 +1,17 @@
foo 9 -2
-localhost is alive
+PING localhost (127.0.0.1): 56 data bytes
+
+--- localhost ping statistics ---
+1 packets transmitted, 1 packets received, 0.0% packet loss
10
-localhost is alive
+PING localhost (127.0.0.1): 56 data bytes
+
+--- localhost ping statistics ---
+1 packets transmitted, 1 packets received, 0.0% packet loss
11
-localhost is alive
+PING localhost (127.0.0.1): 56 data bytes
+
+--- localhost ping statistics ---
+1 packets transmitted, 1 packets received, 0.0% packet loss
12
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.baddef1.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.baddef1.d
index a42afb747e97..1ac1b459d511 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.baddef1.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.baddef1.d
@@ -38,4 +38,4 @@
*
*/
-inline cyc_func_t i = "i am a cyclic function";
+inline dtrace_trap_func_t i = "i am a dtrace trap function";
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.badxlate.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.badxlate.d
index 963b604839a3..d67bdaf4e977 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.badxlate.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.badxlate.d
@@ -38,4 +38,4 @@
*
*/
-inline vfs_t *invalid = xlate<psinfo_t>(curthread->t_procp);
+inline struct vnode *invalid = xlate<psinfo_t>(curthread->td_proc);
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c
index 3cded11e8529..9b878a21b91d 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c
@@ -26,6 +26,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
+#include <sys/ioctl.h>
+
#include <assert.h>
#include <setjmp.h>
#include <signal.h>
@@ -69,7 +71,7 @@ main(int argc, char *argv[])
*/
if (sigsetjmp(env, 1) == 0) {
for (;;)
- (void) ioctl(-1, -1, NULL);
+ (void) ioctl(-1, 0, NULL);
}
/*
@@ -80,20 +82,19 @@ main(int argc, char *argv[])
fds[n++] = open(file, O_WRONLY);
fds[n++] = open(file, O_RDWR);
- fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT | O_DSYNC |
- O_LARGEFILE | O_NOCTTY | O_NONBLOCK | O_NDELAY | O_RSYNC |
- O_SYNC | O_TRUNC | O_XATTR, 0666);
+ fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT |
+ O_NOCTTY | O_NONBLOCK | O_NDELAY | O_SYNC | O_TRUNC | 0666);
fds[n++] = open(file, O_RDWR);
(void) lseek(fds[n - 1], 123, SEEK_SET);
/*
* Once we have all the file descriptors in the state we want to test,
- * issue a bogus ioctl() on each fd with cmd -1 and arg NULL to whack
+ * issue a bogus ioctl() on each fd with cmd 0 and arg NULL to whack
* our DTrace script into recording the content of the fds[] array.
*/
for (i = 0; i < n; i++)
- (void) ioctl(fds[i], -1, NULL);
+ (void) ioctl(fds[i], 0, NULL);
assert(n <= sizeof (fds) / sizeof (fds[0]));
exit(0);
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d
index 52a3312da984..86851421788c 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d
@@ -36,7 +36,7 @@ syscall::ioctl:entry
}
syscall::ioctl:entry
-/pid == $1 && arg0 != -1u && arg1 == -1u && arg2 == NULL/
+/pid == $1 && arg0 != -1u && arg1 == 0 && arg2 == NULL/
{
printf("fds[%d] fi_name = %s\n", arg0, fds[arg0].fi_name);
printf("fds[%d] fi_dirname = %s\n", arg0, fds[arg0].fi_dirname);
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh
index 0f2b64a2d902..18c774c58a50 100755
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh
@@ -45,12 +45,13 @@ fi
dtrace=$1
local=127.0.0.1
-$dtrace -c "/sbin/ping $local 3" -qs /dev/stdin <<EOF | sort -n
+$dtrace -c "/sbin/ping -q -c 1 -t 3 $local" -qs /dev/stdin <<EOF | sort -n | \
+ grep -v -e '^round-trip ' -e '^--- '
ip:::send
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
args[4]->ipv4_protocol == IPPROTO_ICMP/
{
- printf("1 ip:::send (");
+ printf("2 ip:::send (");
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
printf("args[4]: %d %d %d %d %d)\n",
args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags,
@@ -61,7 +62,7 @@ ip:::receive
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
args[4]->ipv4_protocol == IPPROTO_ICMP/
{
- printf("2 ip:::receive (");
+ printf("3 ip:::receive (");
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
printf("args[4]: %d %d %d %d %d)\n",
args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags,
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh.out
index 41d6e0c8ad41..c62b0c8e2557 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh.out
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh.out
@@ -1,6 +1,8 @@
-1 ip:::send (args[2]: 4 64, args[4]: 4 84 0 0 255)
-1 ip:::send (args[2]: 4 64, args[4]: 4 84 0 0 255)
-2 ip:::receive (args[2]: 4 64, args[4]: 4 84 0 0 255)
-2 ip:::receive (args[2]: 4 64, args[4]: 4 84 0 0 255)
-127.0.0.1 is alive
+
+PING 127.0.0.1 (127.0.0.1): 56 data bytes
+1 packets transmitted, 1 packets received, 0.0% packet loss
+2 ip:::send (args[2]: 4 64, args[4]: 4 84 0 0 64)
+2 ip:::send (args[2]: 4 64, args[4]: 4 84 0 0 64)
+3 ip:::receive (args[2]: 4 64, args[4]: 4 84 0 0 64)
+3 ip:::receive (args[2]: 4 64, args[4]: 4 84 0 0 64)
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh
index c18dc7625d8e..2e3ffec52ba6 100755
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh
@@ -73,6 +73,7 @@ cat > test.pl <<-EOPERL
Timeout => 3);
die "Could not connect to host $local port $tcpport" unless \$s;
close \$s;
+ sleep(2);
EOPERL
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh
index e513ace0be64..65ede66f5fe9 100755
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh
@@ -76,6 +76,7 @@ cat > test.pl <<-EOPERL
Timeout => 3);
die "Could not connect to host $dest port $tcpport" unless \$s;
close \$s;
+ sleep(2);
EOPERL
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh
index f63d1ed766bc..65efd2420b76 100755
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh
@@ -55,12 +55,13 @@ else
removeinet6=0
fi
-$dtrace -c "/sbin/ping -A inet6 $local 3" -qs /dev/stdin <<EOF | sort -n
+$dtrace -c "/sbin/ping6 -q -c 1 -X 3 $local" -qs /dev/stdin <<EOF | sort -n | \
+ grep -v -e '^round-trip ' -e '^--- '
ip:::send
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
{
- printf("1 ip:::send (");
+ printf("2 ip:::send (");
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
printf("args[5]: %d %d %d)\n",
args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
@@ -70,7 +71,7 @@ ip:::receive
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
{
- printf("2 ip:::receive (");
+ printf("3 ip:::receive (");
printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
printf("args[5]: %d %d %d)\n",
args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh.out
index 529d251fa06e..2e94ff35de88 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh.out
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh.out
@@ -1,6 +1,8 @@
-::1 is alive
-1 ip:::send (args[2]: 6 64, args[5]: 6 0 64)
-1 ip:::send (args[2]: 6 64, args[5]: 6 0 64)
-2 ip:::receive (args[2]: 6 64, args[5]: 6 0 64)
-2 ip:::receive (args[2]: 6 64, args[5]: 6 0 64)
+
+PING6(56=40+8+8 bytes) ::1 --> ::1
+1 packets transmitted, 1 packets received, 0.0% packet loss
+2 ip:::send (args[2]: 6 16, args[5]: 6 0 16)
+2 ip:::send (args[2]: 6 16, args[5]: 6 0 16)
+3 ip:::receive (args[2]: 6 16, args[5]: 6 0 16)
+3 ip:::receive (args[2]: 6 16, args[5]: 6 0 16)
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh
index 5e0c7474065f..9668ad5868b8 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh
@@ -79,6 +79,7 @@ cat > test.pl <<-EOPERL
die "Could not connect to host $local port $tcpport" unless \$s;
print \$s "testing state machine transitions";
close \$s;
+ sleep(2);
EOPERL
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh
index 4bf4362b61d2..67712803d978 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh
@@ -84,6 +84,7 @@ cat > test.pl <<-EOPERL
die "Could not connect to host $dest port $tcpport" unless \$s;
print \$s "testing state machine transitions";
close \$s;
+ sleep(2);
EOPERL
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c
index 307106d903b5..2a54d4974be0 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c
@@ -14,6 +14,8 @@
*/
#include <sys/sdt.h>
+#include <stdio.h>
+#include <stdlib.h>
#include "usdt.h"
#define FMT "{" \
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NL.char.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NL.char.d
index 9c0280c97964..abae0c147b45 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NL.char.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NL.char.d
@@ -36,8 +36,10 @@
BEGIN
{
-
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Winvalid-pp-token"
h = '
';
+#pragma clang diagnostic pop
exit(0);
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NULL.char.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NULL.char.d
index aef5dab6f4fe..8cfbcc2bab36 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NULL.char.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NULL.char.d
@@ -36,7 +36,9 @@
BEGIN
{
-
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Winvalid-pp-token"
h = '';
exit(0);
+#pragma clang diagnostic pop
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_STR_NL.string.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_STR_NL.string.d
index 68b4cd42e4df..c83e0c505dd3 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_STR_NL.string.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/lexer/err.D_STR_NL.string.d
@@ -36,9 +36,11 @@
BEGIN
{
-
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Winvalid-pp-token"
h = "hello
there";
exit(0);
+#pragma clang diagnostic pop
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh
index 30a2ce4175b3..9aa0f68bfc86 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh
@@ -31,7 +31,6 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-CC=/usr/bin/gcc
CFLAGS=
doit()
@@ -47,7 +46,7 @@ void
main()
{}
EOF
- if $CC $CFLAGS -o $cofile $cfile >/dev/null 2>&1; then
+ if cc $CFLAGS -o $cofile $cfile >/dev/null 2>&1; then
$dtrace -xerrtags -C -s /dev/stdin \
>/dev/null 2>$errfile <<EOF
#include <sys/$file>
@@ -67,11 +66,6 @@ EOF
rm -f $cofile $cfile 2>/dev/null
}
-if [ ! -x $CC ]; then
- echo "$0: bad compiler: $CC" >& 2
- exit 1
-fi
-
concurrency=`psrinfo | wc -l`
let concurrency=concurrency*4
let i=0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.roch.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.roch.d
index 67f446223462..cf209efbab1f 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.roch.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.roch.d
@@ -74,13 +74,13 @@ fbt:::return
(long long)curthread, pid, tid, (int)arg1, (int)arg0);
}
-mutex_enter:adaptive-acquire
+mtx_lock:adaptive-acquire
{
printf(" %u 0x%llX %d %d lock:0x%llX", timestamp,
(long long)curthread, pid, tid, arg0);
}
-mutex_exit:adaptive-release
+mtx_unlock:adaptive-release
{
printf(" %u 0x%llX %d %d lock:0x%llX", timestamp,
(long long) curthread, pid, tid, arg0);
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c
index bd89fffca676..dda3ef28c0b0 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c
@@ -28,6 +28,7 @@
#include <strings.h>
#include <rpc/rpc.h>
+#include <stdio.h>
#include <stdlib.h>
#include <sys/param.h>
#include <rpcsvc/mount.h>
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/offsetof/err.D_UNKNOWN.badmemb.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/offsetof/err.D_UNKNOWN.badmemb.d
index caf0a1d19384..67d4bd9e1b1a 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/offsetof/err.D_UNKNOWN.badmemb.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/offsetof/err.D_UNKNOWN.badmemb.d
@@ -40,5 +40,5 @@
BEGIN
{
- trace(offsetof(vnode_t, v_no_such_member));
+ trace(offsetof(struct vnode, v_no_such_member));
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.exe
index 595db1de33da..e360d25b465b 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.exe
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.exe
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/usr/bin/env ksh
#
# CDDL HEADER START
#
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.exe
index 595db1de33da..e360d25b465b 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.exe
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.exe
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/usr/bin/env ksh
#
# CDDL HEADER START
#
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.exe
index 595db1de33da..e360d25b465b 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.exe
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.exe
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/usr/bin/env ksh
#
# CDDL HEADER START
#
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.exe
index 595db1de33da..e360d25b465b 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.exe
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.exe
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/usr/bin/env ksh
#
# CDDL HEADER START
#
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.exe
index 595db1de33da..e360d25b465b 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.exe
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.exe
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/usr/bin/env ksh
#
# CDDL HEADER START
#
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.exe
index 595db1de33da..e360d25b465b 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.exe
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.exe
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/usr/bin/env ksh
#
# CDDL HEADER START
#
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.exe
index 595db1de33da..e360d25b465b 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.exe
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.exe
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/usr/bin/env ksh
#
# CDDL HEADER START
#
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c
index 23bbab22f424..28d0677ca5d2 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
+#include <stdlib.h>
#include <unistd.h>
int
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.coverage.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.coverage.exe
index 07e84583e74c..ddd0f60f63ce 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.coverage.exe
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.coverage.exe
@@ -1,4 +1,4 @@
-#!/usr/bin/ksh
+#!/usr/bin/env ksh
#
# CDDL HEADER START
#
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe
index a8bc8cb351e9..6369bc561412 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe
@@ -1,4 +1,4 @@
-#!/usr/bin/ksh
+#!/usr/bin/env ksh
#
# CDDL HEADER START
#
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.fork.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.fork.d
index f1b119785c97..5be6d301d23f 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.fork.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.fork.d
@@ -44,7 +44,7 @@ pid$1:a.out:waiting:entry
proc:::create
/pid == $1/
{
- child = args[0]->pr_pid;
+ child = args[0]->p_pid;
trace(pid);
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c
index 69df4723dc9f..b3959c35e8b3 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c
@@ -26,6 +26,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
+#include <sys/types.h>
+#include <sys/wait.h>
#include <spawn.h>
#include <signal.h>
#include <stdio.h>
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.manypids.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.manypids.ksh
index 869339bafb25..ce29cd406bde 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.manypids.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.manypids.ksh
@@ -66,5 +66,5 @@ $dtrace -s $tmpfile
status=$?
rm $tmpfile
-pkill sleep
+pkill -P $$ sleep
exit $status
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh
index 8951cb381f8c..867fa36a9c15 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh
@@ -52,7 +52,7 @@ main.o: main.c
cc -c main.c
altlib.so: altlib.o
- cc -z defs -G -o altlib.so altlib.o -lc
+ cc -shared -o altlib.so altlib.o -lc
altlib.o: altlib.c
cc -c altlib.c
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh
index 49e362b33b20..f8e9cafc03fe 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh
@@ -44,7 +44,7 @@ mkdir $DIR
cd $DIR
cat > Makefile <<EOF
- all: main
+all: main
main: main.o prov.o
cc -o main main.o prov.o
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh
index 865b9bbee5fd..26fb02596485 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh
@@ -59,7 +59,7 @@ provmain.o: prov.d main.o
$dtrace -G -32 -o provmain.o -s prov.d main.o
altlib.so: altlib.o provalt.o
- cc -z defs -G -o altlib.so altlib.o provalt.o -lc
+ cc -shared -o altlib.so altlib.o provalt.o -lc
altlib.o: altlib.c prov.h
cc -c altlib.c
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c
index cfb88a83dc7f..12b3f724cb17 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
+#include <stdlib.h>
#include <unistd.h>
/*
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c
index b64aa0515daa..ea5394e120f5 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
+#include <stdlib.h>
#include <unistd.h>
/*
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d
index b31bb7f3b361..e8fc9b4dfba1 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d
@@ -44,7 +44,7 @@ pid$1:a.out:waiting:entry
proc:::create
/pid == $1/
{
- child = args[0]->pr_pid;
+ child = args[0]->p_pid;
}
pid$1:a.out:go:
@@ -54,7 +54,7 @@ pid$1:a.out:go:
exit(1);
}
-syscall::rexit:entry
+syscall::exit:entry
/pid == $1/
{
exit(0);
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c
index 1418f2a3fea4..765c285dd964 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
+#include <stdlib.h>
#include <unistd.h>
/*
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c
index bb571d2ea33e..756745d99b1f 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
+#include <stdlib.h>
#include <unistd.h>
/*
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.available.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.available.exe
index 221e8b1d7434..c767848bb25d 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.available.exe
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.available.exe
@@ -1,4 +1,4 @@
-#!/usr/bin/ksh
+#!/usr/bin/env ksh
#
# CDDL HEADER START
#
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.libmap.exe b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.libmap.exe
index 221e8b1d7434..c767848bb25d 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.libmap.exe
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.libmap.exe
@@ -1,4 +1,4 @@
-#!/usr/bin/ksh
+#!/usr/bin/env ksh
#
# CDDL HEADER START
#
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d
index 4f45885d42a3..bf2c6da7b18f 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d
@@ -25,7 +25,7 @@
BEGIN
{
- print((void)`p0);
+ print((void)`proc0);
}
BEGIN
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d
index e8125d4f5cba..6455dd629b8e 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d
@@ -22,13 +22,13 @@
typedef struct pancakes {
int i;
string s;
- timespec_t t;
+ struct timespec t;
} pancakes_t;
translator pancakes_t < void *V > {
i = 2 * 10;
s = strjoin("I like ", "pancakes");
- t = *(timespec_t *)`dtrace_zero;
+ t = *(struct timespec *)`dtrace_zero;
};
BEGIN
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out
index 9b01402af34b..ed04f0a1ec72 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out
@@ -1,7 +1,7 @@
pancakes_t {
int i = 0x14
string s = [ "I like pancakes" ]
- timespec_t t = {
+ struct timespec t = {
time_t tv_sec = 0
long tv_nsec = 0
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d
index 3f54321df9de..1402b23ad6eb 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/probes/tst.probestar.d
@@ -44,7 +44,7 @@ BEGIN
i = 0;
}
-syscall::*lwp*:entry
+syscall::*wait*:entry
{
exit(0);
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh
index 5595c24aaa41..5b948407a50b 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh
@@ -36,8 +36,9 @@ script()
{
$dtrace -s /dev/stdin <<EOF
proc:::signal-discard
- /args[1]->pr_pid == $child &&
- args[1]->pr_psargs == "$longsleep" && args[2] == SIGHUP/
+ /args[1]->p_pid == $child &&
+ xlate<psinfo_t *>(args[1])->pr_psargs == "$longsleep" &&
+ args[2] == SIGHUP/
{
exit(0);
}
@@ -48,7 +49,7 @@ killer()
{
while true; do
sleep 1
- /usr/bin/kill -HUP $child
+ kill -HUP $child
done
}
@@ -58,7 +59,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-longsleep="/usr/bin/sleep 10000"
+longsleep="/bin/sleep 10000"
/usr/bin/nohup $longsleep &
child=$!
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh
index 8040ade6374b..86bef7604480 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh
@@ -48,7 +48,7 @@ sleeper()
{
while true; do
$longsleep &
- /usr/bin/sleep 1
+ sleep 1
kill -9 $!
done
}
@@ -59,7 +59,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-longsleep="/usr/bin/sleep 10000"
+longsleep="/bin/sleep 10000"
sleeper &
child=$!
@@ -67,9 +67,9 @@ child=$!
script
status=$?
-pstop $child
+kill -STOP $child
pkill -P $child
kill $child
-prun $child
+kill -CONT $child
exit $status
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh
index cd3c79180464..cb30eaeb8bb8 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh
@@ -37,12 +37,13 @@ script()
$dtrace -s /dev/stdin <<EOF
proc:::signal-send
/execname == "kill" && curpsinfo->pr_ppid == $child &&
- args[1]->pr_psargs == "$longsleep" && args[2] == SIGUSR1/
+ xlate<psinfo_t *>(args[1])->pr_psargs == "$longsleep" &&
+ args[2] == SIGUSR1/
{
/*
* This is guaranteed to not race with signal-handle.
*/
- target = args[1]->pr_pid;
+ target = args[1]->p_pid;
}
proc:::signal-handle
@@ -58,7 +59,7 @@ sleeper()
while true; do
$longsleep &
sleep 1
- /usr/bin/kill -USR1 $!
+ kill -USR1 $!
done
}
@@ -68,7 +69,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-longsleep="/usr/bin/sleep 10000"
+longsleep="/bin/sleep 10000"
sleeper &
child=$!
@@ -76,9 +77,9 @@ child=$!
script
status=$?
-pstop $child
+kill -STOP $child
pkill -P $child
kill $child
-prun $child
+kill -CONT $child
exit $status
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh
index 358d3625da39..0fef3e363106 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh
@@ -60,14 +60,14 @@ spinny &
child=$!
#
-# This is gutsy -- we're assuming that mutex_enter(9F) will show up in the
+# This is gutsy -- we're assuming that mtx_lock(9) will show up in the
# output. This is most likely _not_ to show up in the output if the
# platform does not support arbitrary resolution interval timers -- but
# the above script was stress-tested down to 100 hertz and still ran
# successfully on all platforms, so one is hopeful that this test will pass
# even in that case.
#
-script | tee /dev/fd/2 | grep mutex_enter > /dev/null
+script | tee /dev/fd/2 | grep mtx_lock > /dev/null
status=$?
kill $child
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh
index 4652ff32cd95..f62f6ed5a16f 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh
@@ -63,7 +63,7 @@ child=$!
# The only thing we can be sure of is that some module named "unix" (or
# "genunix") did some work -- so that's all we'll check.
#
-script | tee /dev/fd/2 | grep unix > /dev/null
+script | tee /dev/fd/2 | grep kernel > /dev/null
status=$?
kill $child
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh
index 218a651c9175..2bea32ef2b04 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh
@@ -63,7 +63,7 @@ child=$!
# This is the same gutsy test as that found in the func() test; see that
# test for the rationale.
#
-script | tee /dev/fd/2 | grep mutex_enter > /dev/null
+script | tee /dev/fd/2 | grep mtx_lock > /dev/null
status=$?
kill $child
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.selfarray2.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.selfarray2.d
index 2fd69c698394..036a6526fe7c 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.selfarray2.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.selfarray2.d
@@ -31,8 +31,8 @@
#pragma D option dynvarsize=1m
struct bar {
- int pid;
- kthread_t *curthread;
+ pid_t pid;
+ struct thread *curthread;
};
self struct bar foo[int];
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
index cc1e6dd9f745..3c493dffa50d 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
index 6ec078abf29d..89c6a6aebb13 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
@@ -42,7 +42,7 @@ fi
dtrace=$1
-bname=`/usr/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh
index afee24f83b71..2397db6e1b72 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh
@@ -43,7 +43,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/usr/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
@@ -77,7 +77,7 @@ fi
#Get the groupid of the calling process using ps
-groupid=`ps -o pid,pgid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+groupid=`ps -x -o pid,egid | 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 @@ fi
#Cleanup leftovers
-/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh
index 1b6b9b3e0d39..5bdc391dbbc0 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-userid=`ps -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+userid=`ps -x -o pid,uid | 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
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh
index 332b8e70d27d..0c4e77b54e4f 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-groupid=`ps -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+groupid=`ps -x -o pid,gid | 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
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh
index bbd9a5364797..37613ce1a5e1 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
@@ -75,12 +75,12 @@ fi
#Pass current pid (I mean parent pid for .d script).
-$dfilename $$ >/dev/null 2>&1
+$dfilename $$ #>/dev/null 2>&1
if [ $? -ne 0 ]; then
print -u2 "Error in executing $dfilename"
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh
index 62bc817af5f6..e11f1e56b47d 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-projectid=`ps -o pid,projid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+projectid=`ps -x -o pid,projid | 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
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh
index 477ebc0290a5..08a65b2d62dc 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-sessionid=`ps -o pid,sid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+sessionid=`ps -x -o pid,sid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get sid of the current process with pid = $$"
exit 1
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh
index 724bd5fda7f0..a8b1ec1fe61e 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh
index 88b450d381ff..e4de7fbfd3d4 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-taskidval=`ps -o pid,taskid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+taskidval=`ps -x -o pid,taskid | 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
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh
index fabf0eda7433..8cd6130ff644 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-userid=`ps -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+userid=`ps -x -o pid,uid | 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
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c
index 209160bd75f1..198d9db01b71 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <sys/syscall.h>
+#include <unistd.h>
/*ARGSUSED*/
int
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/Makefile b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/Makefile
deleted file mode 100644
index 77fe870aa91f..000000000000
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-all: main
-
-main: main.o prov.o
- $(CC) -o main main.o prov.o
-
-main.o: main.c prov.h
- $(CC) -c main.c
-
-prov.h: prov.d
- /usr/sbin/dtrace -h -s prov.d
-
-prov.o: prov.d main.o
- /usr/sbin/dtrace -G -32 -s prov.d main.o
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh
index 68dbb03456cc..696088c6d4a4 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh
@@ -48,7 +48,7 @@ fi
dtrace="$1"
startdir="$PWD"
-dir=$(mktemp -td drtiXXXXXX)
+dir=$(mktemp -d -t drtiXXXXXX)
if (( $? != 0 )); then
print -u2 'Could not create safe temporary directory'
exit 2
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh
index 1c155febb5ae..5aaf9a0ab3fe 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh
@@ -53,7 +53,7 @@ main.o: main.c
livelib.so: livelib.o prov.o
- cc -z defs -G -o livelib.so livelib.o prov.o -lc
+ cc -shared -o livelib.so livelib.o prov.o -lc
livelib.o: livelib.c prov.h
cc -c livelib.c
@@ -66,7 +66,7 @@ prov.h: prov.d
deadlib.so: deadlib.o
- cc -z defs -G -o deadlib.so deadlib.o -lc
+ cc -shared -o deadlib.so deadlib.o -lc
deadlib.o: deadlib.c
cc -c deadlib.c
@@ -106,11 +106,13 @@ cat > main.c <<EOF
#include <dlfcn.h>
#include <unistd.h>
#include <stdio.h>
+#include <signal.h>
int
main(int argc, char **argv)
{
void *live;
+ sigset_t mask;
if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) {
printf("dlopen of livelib.so failed: %s\n", dlerror());
@@ -119,7 +121,8 @@ main(int argc, char **argv)
(void) dlclose(live);
- pause();
+ (void) sigemptyset(&mask);
+ (void) sigsuspend(&mask);
return (0);
}
@@ -133,7 +136,7 @@ fi
script() {
$dtrace -w -x bufsize=1k -c ./main -qs /dev/stdin <<EOF
- syscall::pause:entry
+ syscall::sigsuspend:entry
/pid == \$target/
{
system("$dtrace -l -P test_prov*");
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh
index 107707ede32e..6ce1329c6ed2 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh
@@ -48,7 +48,7 @@ main.o: main.c
livelib.so: livelib.o prov.o
- cc -z defs -G -o livelib.so livelib.o prov.o -lc
+ cc -shared -o livelib.so livelib.o prov.o -lc
livelib.o: livelib.c prov.h
cc -c livelib.c
@@ -61,7 +61,7 @@ prov.h: prov.d
deadlib.so: deadlib.o
- cc -z defs -G -o deadlib.so deadlib.o -lc
+ cc -shared -o deadlib.so deadlib.o -lc
deadlib.o: deadlib.c
cc -c deadlib.c
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh
index a750b59e14e6..ad668cc1e772 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh
@@ -53,7 +53,7 @@ main.o: main.c
livelib.so: livelib.o prov.o
- cc -z defs -G -o livelib.so livelib.o prov.o -lc
+ cc -shared -o livelib.so livelib.o prov.o -lc
livelib.o: livelib.c prov.h
cc -c livelib.c
@@ -66,7 +66,7 @@ prov.h: prov.d
deadlib.so: deadlib.o
- cc -z defs -G -o deadlib.so deadlib.o -lc
+ cc -shared -o deadlib.so deadlib.o -lc
deadlib.o: deadlib.c
cc -c deadlib.c
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c
index ade7f83b3d53..e229c0c996a8 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c
@@ -26,6 +26,10 @@
#pragma ident "%Z%%M% %I% %E% SMI"
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <stdlib.h>
#include <unistd.h>
#include "forker.h"
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh
index 7def9ed2abce..bf267c7c27f4 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh
@@ -102,5 +102,5 @@ if [ $? -ne 0 ]; then
fi
cd /
-/usr/bin/rm -rf $DIR
+rm -rf $DIR
exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh
index a43970f56072..2c1aedcdece4 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh
@@ -55,5 +55,5 @@ if [ $? -eq 0 ]; then
fi
cd /
-/usr/bin/rm -rf $DIR
+rm -rf $DIR
exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
index 338dcdf03e6f..905fb5538fc8 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
@@ -51,7 +51,7 @@ provider test_prov {
};
EOF
-gcc -c test.c
+cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
@@ -123,6 +123,6 @@ else
fi
cd /
-/usr/bin/rm -rf $DIR
+rm -rf $DIR
exit $status
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
index a2e5edee3814..2afd78165fc4 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
@@ -51,7 +51,7 @@ provider test_prov {
};
EOF
-gcc -c test.c
+cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
@@ -119,6 +119,6 @@ fi
kill $background
cd /
-/usr/bin/rm -rf $DIR
+rm -rf $DIR
exit $status
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh
index f18c585ef6c8..4f6c0ac87d97 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh
@@ -51,7 +51,7 @@ provider test_prov {
};
EOF
-gcc -c test.c
+cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
@@ -110,6 +110,6 @@ grep D_PDESC_INVAL test.out 2> /dev/null 1>&2
status=$?
cd /
-/usr/bin/rm -rf $DIR
+rm -rf $DIR
exit $status
diff --git a/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c b/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c
index 0a609d773cf6..ad512c1c92c4 100644
--- a/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c
+++ b/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c
@@ -46,10 +46,9 @@
#include <signal.h>
#include <assert.h>
-#if defined(sun)
+#ifdef illumos
#define GETOPT_EOF EOF
#else
-/* FreeBSD */
#include <sys/time.h>
#include <sys/resource.h>
@@ -57,7 +56,7 @@
#define GETOPT_EOF (-1)
typedef uintptr_t pc_t;
-#endif /* defined(sun) */
+#endif
#define LOCKSTAT_OPTSTR "x:bths:n:d:i:l:f:e:ckwWgCHEATID:RpPo:V"
@@ -214,10 +213,9 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = {
{ 'H', "Lock", "Unknown event (type 53)", "units" },
{ 'H', "Lock", "Unknown event (type 54)", "units" },
{ 'H', "Lock", "Unknown event (type 55)", "units" },
-#if defined(sun)
+#ifdef illumos
{ 'I', "CPU+PIL", "Profiling interrupt", "nsec",
#else
- /* FreeBSD */
{ 'I', "CPU+Pri_Class", "Profiling interrupt", "nsec",
#endif
"profile:::profile-97", NULL },
@@ -231,7 +229,7 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = {
{ 'E', "Lock", "Lockstat record failure", "(N/A)" },
};
-#if !defined(sun)
+#ifndef illumos
static char *g_pri_class[] = {
"",
"Intr",
@@ -598,7 +596,7 @@ filter_add(char **filt, char *what, uintptr_t base, uintptr_t size)
*filt[0] = '\0';
}
-#if defined(sun)
+#ifdef illumos
(void) sprintf(c, "%s(%s >= 0x%p && %s < 0x%p)", *filt[0] != '\0' ?
" || " : "", what, (void *)base, what, (void *)(base + size));
#else
@@ -676,7 +674,7 @@ dprog_addevent(int event)
* the number of nanoseconds) is the number of nanoseconds
* late -- and it's stored in arg2.
*/
-#if defined(sun)
+#ifdef illumos
arg0 = "(uintptr_t)curthread->t_cpu + \n"
"\t curthread->t_cpu->cpu_profile_pil";
#else
@@ -824,7 +822,7 @@ dprog_compile()
}
static void
-#if defined(sun)
+#ifdef illumos
status_fire(void)
#else
status_fire(int i)
@@ -1423,7 +1421,7 @@ main(int argc, char **argv)
exit(127);
}
-#if defined(sun)
+#ifdef illumos
while (waitpid(child, &status, WEXITED) != child)
#else
while (waitpid(child, &status, 0) != child)
@@ -1468,7 +1466,7 @@ main(int argc, char **argv)
dfail("failed to walk aggregate");
}
-#if defined(sun)
+#ifdef illumos
if ((data_buf = memalign(sizeof (uint64_t),
(g_nrecs + 1) * g_recsize)) == NULL)
#else
@@ -1500,7 +1498,7 @@ main(int argc, char **argv)
if (g_gflag) {
lsrec_t *newlsp, *oldlsp;
-#if defined(sun)
+#ifdef illumos
newlsp = memalign(sizeof (uint64_t),
g_nrecs_used * LS_TIME * (g_stkdepth + 1));
#else
@@ -1664,7 +1662,7 @@ format_symbol(char *buf, uintptr_t addr, int show_size)
else if (symoff == 0)
(void) sprintf(buf, "%s", symname);
else if (symoff < 16 && bcmp(symname, "cpu[", 4) == 0) /* CPU+PIL */
-#if defined(sun)
+#ifdef illumos
(void) sprintf(buf, "%s+%ld", symname, (long)symoff);
#else
(void) sprintf(buf, "%s+%s", symname, g_pri_class[(int)symoff]);
diff --git a/cddl/contrib/opensolaris/cmd/lockstat/sym.c b/cddl/contrib/opensolaris/cmd/lockstat/sym.c
index 5940c938d96c..f3feb549c477 100644
--- a/cddl/contrib/opensolaris/cmd/lockstat/sym.c
+++ b/cddl/contrib/opensolaris/cmd/lockstat/sym.c
@@ -42,12 +42,11 @@
#include <libelf.h>
#include <link.h>
#include <elf.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/machelf.h>
#include <kstat.h>
#else
-/* FreeBSD */
#include <sys/elf.h>
#include <sys/ksyms.h>
#include <sys/param.h>
@@ -66,7 +65,7 @@ static syment_t *symbol_table;
static int nsyms, maxsyms;
static char maxsymname[64];
-#if defined(sun)
+#ifdef illumos
#ifdef _ELF64
#define elf_getshdr elf64_getshdr
#else
@@ -105,7 +104,7 @@ remove_symbol(uintptr_t addr)
sep->addr = 0;
}
-#if defined(sun)
+#ifdef illumos
static void
fake_up_certain_popular_kernel_symbols(void)
{
@@ -133,8 +132,7 @@ fake_up_certain_popular_kernel_symbols(void)
}
(void) kstat_close(kc);
}
-#else
-/* FreeBSD */
+#else /* !illumos */
static void
fake_up_certain_popular_kernel_symbols(void)
{
@@ -151,7 +149,7 @@ fake_up_certain_popular_kernel_symbols(void)
add_symbol(name, addr, sizeof (uintptr_t));
}
}
-#endif /* !defined(sun) */
+#endif /* illumos */
static int
symcmp(const void *p1, const void *p2)
@@ -177,12 +175,12 @@ symtab_init(void)
int fd;
int i;
int strindex = -1;
-#if !defined(sun)
+#ifndef illumos
void *ksyms;
size_t sz;
#endif
-#if defined(__FreeBSD__)
+#ifndef illumos
if ((fd = open("/dev/ksyms", O_RDONLY)) == -1) {
if (errno == ENOENT && modfind("ksyms") == -1) {
kldload("ksyms");
@@ -196,12 +194,11 @@ symtab_init(void)
return (-1);
#endif
-#if defined(sun)
+#ifdef illumos
(void) elf_version(EV_CURRENT);
elf = elf_begin(fd, ELF_C_READ, NULL);
#else
- /* FreeBSD */
/*
* XXX - libelf needs to be fixed so it will work with
* non 'ordinary' files like /dev/ksyms. The following
diff --git a/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c b/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c
index 602969e1abb3..7bfc06bf2285 100644
--- a/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c
+++ b/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c
@@ -40,7 +40,7 @@ die(char *format, ...)
{
va_list ap;
int err = errno;
-#if !defined(sun)
+#ifndef illumos
const char *progname = getprogname();
#endif
@@ -54,7 +54,7 @@ die(char *format, ...)
if (format[strlen(format) - 1] != '\n')
(void) fprintf(stderr, ": %s\n", strerror(err));
-#if defined(__FreeBSD__)
+#ifndef illumos
exit(0);
#else
exit(1);
@@ -65,7 +65,7 @@ void
elfdie(char *format, ...)
{
va_list ap;
-#if !defined(sun)
+#ifndef illumos
const char *progname = getprogname();
#endif
@@ -79,7 +79,7 @@ elfdie(char *format, ...)
if (format[strlen(format) - 1] != '\n')
(void) fprintf(stderr, ": %s\n", elf_errmsg(elf_errno()));
-#if defined(__FreeBSD__)
+#ifndef illumos
exit(0);
#else
exit(1);
diff --git a/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h b/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h
index a0932ada0d57..737d2221f62f 100644
--- a/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h
+++ b/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h
@@ -40,7 +40,7 @@ extern int findelfsecidx(Elf *, char *);
extern void die(char *, ...);
extern void elfdie(char *, ...);
-#if defined(sun)
+#ifdef illumos
extern const char *progname;
#endif
diff --git a/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c b/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c
index 12884682c4a5..8dfb0ba25b81 100644
--- a/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c
+++ b/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c
@@ -24,7 +24,7 @@
* Use is subject to license terms.
*/
-#if defined(sun)
+#ifdef illumos
#pragma ident "%Z%%M% %I% %E% SMI"
#endif
@@ -505,7 +505,7 @@ getsym(struct ps_prochandle *P, uintptr_t addr, char *buf, size_t size,
{
char name[256];
GElf_Sym sym;
-#if defined(sun)
+#ifdef illumos
prsyminfo_t info;
#else
prmap_t *map;
@@ -518,7 +518,7 @@ getsym(struct ps_prochandle *P, uintptr_t addr, char *buf, size_t size,
(void) snprintf(buf, size, "%#lx", addr);
return (0);
}
-#if defined(sun)
+#ifdef illumos
if (info.prs_object == NULL)
info.prs_object = "<unknown>";
@@ -668,7 +668,7 @@ process_aggregate(const dtrace_aggdata_t **aggsdata, int naggvars, void *arg)
static void
prochandler(struct ps_prochandle *P, const char *msg, void *arg)
{
-#if defined(sun)
+#ifdef illumos
const psinfo_t *prp = Ppsinfo(P);
int pid = Pstatus(P)->pr_pid;
#else
@@ -773,7 +773,7 @@ intr(int signo)
int
main(int argc, char **argv)
{
-#if defined(sun)
+#ifdef illumos
ucred_t *ucp;
#endif
int err;
@@ -785,7 +785,7 @@ main(int argc, char **argv)
g_pname = basename(argv[0]);
argv[0] = g_pname; /* rewrite argv[0] for getopt errors */
-#if defined(sun)
+#ifdef illumos
/*
* Make sure we have the required dtrace_proc privilege.
*/
@@ -988,7 +988,7 @@ main(int argc, char **argv)
if (opt_v)
(void) printf("%s: tracing enabled for pid %d\n", g_pname,
-#if defined(sun)
+#ifdef illumos
(int)Pstatus(g_pr)->pr_pid);
#else
(int)proc_getpid(g_pr));
diff --git a/cddl/contrib/opensolaris/cmd/sgs/include/alist.h b/cddl/contrib/opensolaris/cmd/sgs/include/alist.h
index c27160bd35cc..2b790b715176 100644
--- a/cddl/contrib/opensolaris/cmd/sgs/include/alist.h
+++ b/cddl/contrib/opensolaris/cmd/sgs/include/alist.h
@@ -39,7 +39,7 @@ extern "C" {
#endif
#include <sys/types.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/machelf.h>
#else
#include <sys/elf.h>
diff --git a/cddl/contrib/opensolaris/cmd/sgs/include/sgs.h b/cddl/contrib/opensolaris/cmd/sgs/include/sgs.h
index 9c37af2a1d4a..adfe5be36c65 100644
--- a/cddl/contrib/opensolaris/cmd/sgs/include/sgs.h
+++ b/cddl/contrib/opensolaris/cmd/sgs/include/sgs.h
@@ -48,7 +48,7 @@ extern "C" {
#ifndef _ASM
#include <sys/types.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/machelf.h>
#else
#include <elf.h>
diff --git a/cddl/contrib/opensolaris/cmd/zdb/zdb.c b/cddl/contrib/opensolaris/cmd/zdb/zdb.c
index 47ab7bf9a1db..34912cd8dfb0 100644
--- a/cddl/contrib/opensolaris/cmd/zdb/zdb.c
+++ b/cddl/contrib/opensolaris/cmd/zdb/zdb.c
@@ -1184,7 +1184,7 @@ visit_indirect(spa_t *spa, const dnode_phys_t *dnp,
print_indirect(bp, zb, dnp);
if (BP_GET_LEVEL(bp) > 0 && !BP_IS_HOLE(bp)) {
- uint32_t flags = ARC_WAIT;
+ arc_flags_t flags = ARC_FLAG_WAIT;
int i;
blkptr_t *cbp;
int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT;
@@ -1884,8 +1884,8 @@ dump_dir(objset_t *os)
if (dds.dds_type == DMU_OST_META) {
dds.dds_creation_txg = TXG_INITIAL;
usedobjs = BP_GET_FILL(os->os_rootbp);
- refdbytes = os->os_spa->spa_dsl_pool->
- dp_mos_dir->dd_phys->dd_used_bytes;
+ refdbytes = dsl_dir_phys(os->os_spa->spa_dsl_pool->dp_mos_dir)->
+ dd_used_bytes;
} else {
dmu_objset_space(os, &refdbytes, &scratch, &usedobjs, &scratch);
}
diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs.8 b/cddl/contrib/opensolaris/cmd/zfs/zfs.8
index e37b14868e96..f2852cfc84a3 100644
--- a/cddl/contrib/opensolaris/cmd/zfs/zfs.8
+++ b/cddl/contrib/opensolaris/cmd/zfs/zfs.8
@@ -23,15 +23,15 @@
.\" Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org>
.\" Copyright (c) 2012, Bryan Drewery <bdrewery@FreeBSD.org>
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
-.\" Copyright (c) 2013 Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
.\" Copyright (c) 2013, Steven Hartland <smh@FreeBSD.org>
+.\" Copyright (c) 2014 Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2014, Xin LI <delphij@FreeBSD.org>
.\" Copyright (c) 2014, The FreeBSD Foundation, All Rights Reserved.
.\"
.\" $FreeBSD$
.\"
-.Dd November 12, 2014
+.Dd December 12, 2014
.Dt ZFS 8
.Os
.Sh NAME
@@ -3505,10 +3505,9 @@ are also displayed.
.Bd -literal -offset 2n
.Li # Ic zfs allow cindys create,destroy,mount,snapshot tank/cindys
.Li # Ic zfs allow tank/cindys
--------------------------------------------------------------
-Local+Descendent permissions on (tank/cindys)
- user cindys create,destroy,mount,snapshot
--------------------------------------------------------------
+---- Permissions on tank/cindys --------------------------------------
+Local+Descendent permissions:
+ user cindys create,destroy,mount,snapshot
.Ed
.It Sy Example 18 No Delegating Create Time Permissions on a Tn ZFS No Dataset
.Pp
@@ -3524,12 +3523,11 @@ are also displayed.
.Li # Ic zfs allow staff create,mount tank/users
.Li # Ic zfs allow -c destroy tank/users
.Li # Ic zfs allow tank/users
--------------------------------------------------------------
-Create time permissions on (tank/users)
- create,destroy
-Local+Descendent permissions on (tank/users)
- group staff create,mount
--------------------------------------------------------------
+---- Permissions on tank/users ---------------------------------------
+Permission sets:
+ destroy
+Local+Descendent permissions:
+ group staff create,mount
.Ed
.It Xo
.Sy Example 19
@@ -3547,14 +3545,11 @@ are also displayed.
.Li # Ic zfs allow -s @pset create,destroy,snapshot,mount tank/users
.Li # Ic zfs allow staff @pset tank/users
.Li # Ic zfs allow tank/users
--------------------------------------------------------------
-Permission sets on (tank/users)
+---- Permissions on tank/users ---------------------------------------
+Permission sets:
@pset create,destroy,mount,snapshot
-Create time permissions on (tank/users)
- create,destroy
-Local+Descendent permissions on (tank/users)
- group staff @pset,create,mount
--------------------------------------------------------------
+Local+Descendent permissions:
+ group staff @pset
.Ed
.It Sy Example 20 No Delegating Property Permissions on a Tn ZFS No Dataset
.Pp
@@ -3566,16 +3561,15 @@ file system. The permissions on
are also displayed.
.Bd -literal -offset 2n
.Li # Ic zfs allow cindys quota,reservation users/home
-.Li # Ic zfs allow cindys
--------------------------------------------------------------
-Local+Descendent permissions on (users/home)
+.Li # Ic zfs allow users/home
+---- Permissions on users/home ---------------------------------------
+Local+Descendent permissions:
user cindys quota,reservation
--------------------------------------------------------------
.Li # Ic su - cindys
.Li cindys% Ic zfs set quota=10G users/home/marks
.Li cindys% Ic zfs get quota users/home/marks
-NAME PROPERTY VALUE SOURCE
-users/home/marks quota 10G local
+NAME PROPERTY VALUE SOURCE
+users/home/marks quota 10G local
.Ed
.It Sy Example 21 No Removing ZFS Delegated Permissions on a Tn ZFS No Dataset
.Pp
@@ -3589,14 +3583,11 @@ are also displayed.
.Bd -literal -offset 2n
.Li # Ic zfs unallow staff snapshot tank/users
.Li # Ic zfs allow tank/users
--------------------------------------------------------------
-Permission sets on (tank/users)
+---- Permissions on tank/users ---------------------------------------
+Permission sets:
@pset create,destroy,mount,snapshot
-Create time permissions on (tank/users)
- create,destroy
-Local+Descendent permissions on (tank/users)
- group staff @pset,create,mount
--------------------------------------------------------------
+Local+Descendent permissions:
+ group staff @pset
.Ed
.It Sy Example 22 Showing the differences between a snapshot and a ZFS Dataset
.Pp
diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
index baac993a0df7..d7c702b9b567 100644
--- a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
+++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
@@ -65,9 +65,10 @@
#include <zfs_prop.h>
#include <zfs_deleg.h>
#include <libuutil.h>
-#ifdef sun
+#ifdef illumos
#include <aclutils.h>
#include <directory.h>
+#include <idmap.h>
#endif
#include "zfs_iter.h"
@@ -2390,10 +2391,9 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space)
/* SMB */
char sid[ZFS_MAXNAMELEN + 32];
uid_t id;
- uint64_t classes;
-#ifdef sun
+#ifdef illumos
int err;
- directory_error_t e;
+ int flag = IDMAP_REQ_FLG_USE_CACHE;
#endif
smbentity = B_TRUE;
@@ -2402,24 +2402,27 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space)
if (prop == ZFS_PROP_GROUPUSED || prop == ZFS_PROP_GROUPQUOTA) {
type = USTYPE_SMB_GRP;
-#ifdef sun
+#ifdef illumos
err = sid_to_id(sid, B_FALSE, &id);
#endif
} else {
type = USTYPE_SMB_USR;
-#ifdef sun
+#ifdef illumos
err = sid_to_id(sid, B_TRUE, &id);
#endif
}
-#ifdef sun
+#ifdef illumos
if (err == 0) {
rid = id;
if (!cb->cb_sid2posix) {
- e = directory_name_from_sid(NULL, sid, &name,
- &classes);
- if (e != NULL)
- directory_error_free(e);
+ if (type == USTYPE_SMB_USR) {
+ (void) idmap_getwinnamebyuid(rid, flag,
+ &name, NULL);
+ } else {
+ (void) idmap_getwinnamebygid(rid, flag,
+ &name, NULL);
+ }
if (name == NULL)
name = sid;
}
@@ -6107,7 +6110,7 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
/*
* Search for the given (major,minor) pair in the mount table.
*/
-#ifdef sun
+#ifdef illumos
rewind(mnttab_file);
while ((ret = getextmntent(mnttab_file, &entry, 0)) == 0) {
if (entry.mnt_major == major(statbuf.st_dev) &&
diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 b/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
index d855f168cc60..6c3b6f9e3e61 100644
--- a/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
@@ -443,7 +443,7 @@ This feature becomes
.Sy active
once a
.Sy recordsize
-property has been set larger than 128KB, and will return to being
+property has been set larger than 128KB, and will return to being
.Sy enabled
once all filesystems that have ever had their recordsize larger than 128KB
are destroyed.
diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
index 31340b053a7a..d8243f32ad3a 100644
--- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
@@ -834,6 +834,8 @@ zpool_do_create(int argc, char **argv)
enable_all_pool_feat = B_FALSE;
}
}
+ if (zpool_name_to_prop(optarg) == ZPOOL_PROP_ALTROOT)
+ altroot = propval;
break;
case 'O':
if ((propval = strchr(optarg, '=')) == NULL) {
@@ -4509,11 +4511,12 @@ zpool_do_status(int argc, char **argv)
}
typedef struct upgrade_cbdata {
- int cb_first;
- char cb_poolname[ZPOOL_MAXNAMELEN];
- int cb_argc;
- uint64_t cb_version;
- char **cb_argv;
+ boolean_t cb_first;
+ boolean_t cb_unavail;
+ char cb_poolname[ZPOOL_MAXNAMELEN];
+ int cb_argc;
+ uint64_t cb_version;
+ char **cb_argv;
} upgrade_cbdata_t;
#ifdef __FreeBSD__
@@ -4629,6 +4632,14 @@ upgrade_cb(zpool_handle_t *zhp, void *arg)
boolean_t printnl = B_FALSE;
int ret;
+ if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
+ (void) fprintf(stderr, gettext("cannot upgrade '%s': pool is "
+ "currently unavailable.\n\n"), zpool_get_name(zhp));
+ cbp->cb_unavail = B_TRUE;
+ /* Allow iteration to continue. */
+ return (0);
+ }
+
config = zpool_get_config(zhp, NULL);
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
&version) == 0);
@@ -4690,12 +4701,41 @@ upgrade_cb(zpool_handle_t *zhp, void *arg)
}
static int
+upgrade_list_unavail(zpool_handle_t *zhp, void *arg)
+{
+ upgrade_cbdata_t *cbp = arg;
+
+ if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
+ if (cbp->cb_first) {
+ (void) fprintf(stderr, gettext("The following pools "
+ "are unavailable and cannot be upgraded as this "
+ "time.\n\n"));
+ (void) fprintf(stderr, gettext("POOL\n"));
+ (void) fprintf(stderr, gettext("------------\n"));
+ cbp->cb_first = B_FALSE;
+ }
+ (void) printf(gettext("%s\n"), zpool_get_name(zhp));
+ cbp->cb_unavail = B_TRUE;
+ }
+ return (0);
+}
+
+static int
upgrade_list_older_cb(zpool_handle_t *zhp, void *arg)
{
upgrade_cbdata_t *cbp = arg;
nvlist_t *config;
uint64_t version;
+ if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
+ /*
+ * This will have been reported by upgrade_list_unavail so
+ * just allow iteration to continue.
+ */
+ cbp->cb_unavail = B_TRUE;
+ return (0);
+ }
+
config = zpool_get_config(zhp, NULL);
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
&version) == 0);
@@ -4729,6 +4769,15 @@ upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg)
nvlist_t *config;
uint64_t version;
+ if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
+ /*
+ * This will have been reported by upgrade_list_unavail so
+ * just allow iteration to continue.
+ */
+ cbp->cb_unavail = B_TRUE;
+ return (0);
+ }
+
config = zpool_get_config(zhp, NULL);
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
&version) == 0);
@@ -4782,10 +4831,17 @@ upgrade_one(zpool_handle_t *zhp, void *data)
uint64_t cur_version;
int ret;
+ if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
+ (void) fprintf(stderr, gettext("cannot upgrade '%s': pool is "
+ "is currently unavailable.\n\n"), zpool_get_name(zhp));
+ cbp->cb_unavail = B_TRUE;
+ return (1);
+ }
+
if (strcmp("log", zpool_get_name(zhp)) == 0) {
(void) printf(gettext("'log' is now a reserved word\n"
"Pool 'log' must be renamed using export and import"
- " to upgrade.\n"));
+ " to upgrade.\n\n"));
return (1);
}
@@ -4829,7 +4885,7 @@ upgrade_one(zpool_handle_t *zhp, void *data)
#endif /* __FreeBSD __*/
} else if (cur_version == SPA_VERSION) {
(void) printf(gettext("Pool '%s' already has all "
- "supported features enabled.\n"),
+ "supported features enabled.\n\n"),
zpool_get_name(zhp));
}
}
@@ -4986,11 +5042,13 @@ zpool_do_upgrade(int argc, char **argv)
ret = zpool_iter(g_zfs, upgrade_cb, &cb);
if (ret == 0 && cb.cb_first) {
if (cb.cb_version == SPA_VERSION) {
- (void) printf(gettext("All pools are already "
- "formatted using feature flags.\n\n"));
- (void) printf(gettext("Every feature flags "
+ (void) printf(gettext("All %spools are already "
+ "formatted using feature flags.\n\n"),
+ cb.cb_unavail ? gettext("available ") : "");
+ (void) printf(gettext("Every %sfeature flags "
"pool already has all supported features "
- "enabled.\n"));
+ "enabled.\n"),
+ cb.cb_unavail ? gettext("available ") : "");
} else {
(void) printf(gettext("All pools are already "
"formatted with version %llu or higher.\n"),
@@ -4999,12 +5057,21 @@ zpool_do_upgrade(int argc, char **argv)
}
} else if (argc == 0) {
cb.cb_first = B_TRUE;
+ ret = zpool_iter(g_zfs, upgrade_list_unavail, &cb);
+ assert(ret == 0);
+
+ if (!cb.cb_first) {
+ (void) fprintf(stderr, "\n");
+ }
+
+ cb.cb_first = B_TRUE;
ret = zpool_iter(g_zfs, upgrade_list_older_cb, &cb);
assert(ret == 0);
if (cb.cb_first) {
- (void) printf(gettext("All pools are formatted "
- "using feature flags.\n\n"));
+ (void) printf(gettext("All %spools are formatted using "
+ "feature flags.\n\n"), cb.cb_unavail ?
+ gettext("available ") : "");
} else {
(void) printf(gettext("\nUse 'zpool upgrade -v' "
"for a list of available legacy versions.\n"));
@@ -5015,13 +5082,14 @@ zpool_do_upgrade(int argc, char **argv)
assert(ret == 0);
if (cb.cb_first) {
- (void) printf(gettext("Every feature flags pool has "
- "all supported features enabled.\n"));
+ (void) printf(gettext("Every %sfeature flags pool has "
+ "all supported features enabled.\n"),
+ cb.cb_unavail ? gettext("available ") : "");
} else {
(void) printf(gettext("\n"));
}
} else {
- ret = for_each_pool(argc, argv, B_FALSE, NULL,
+ ret = for_each_pool(argc, argv, B_TRUE, NULL,
upgrade_one, &cb);
}
diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c b/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
index e974b7519b02..efd828f49f36 100644
--- a/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
@@ -112,7 +112,7 @@ vdev_error(const char *fmt, ...)
va_end(ap);
}
-#ifdef sun
+#ifdef illumos
static void
libdiskmgt_error(int error)
{
@@ -274,7 +274,7 @@ check_device(const char *path, boolean_t force, boolean_t isspare)
return (check_slice(path, force, B_FALSE, isspare));
}
-#endif /* sun */
+#endif /* illumos */
/*
* Check that a file is valid. All we can do in this case is check that it's
@@ -290,7 +290,7 @@ check_file(const char *file, boolean_t force, boolean_t isspare)
pool_state_t state;
boolean_t inuse;
-#ifdef sun
+#ifdef illumos
if (dm_inuse_swap(file, &err)) {
if (err)
libdiskmgt_error(err);
@@ -377,7 +377,7 @@ check_device(const char *name, boolean_t force, boolean_t isspare)
static boolean_t
is_whole_disk(const char *arg)
{
-#ifdef sun
+#ifdef illumos
struct dk_gpt *label;
int fd;
char path[MAXPATHLEN];
@@ -915,7 +915,7 @@ check_replication(nvlist_t *config, nvlist_t *newroot)
return (ret);
}
-#ifdef sun
+#ifdef illumos
/*
* Go through and find any whole disks in the vdev specification, labelling them
* as appropriate. When constructing the vdev spec, we were unable to open this
@@ -1019,7 +1019,7 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv)
return (0);
}
-#endif /* sun */
+#endif /* illumos */
/*
* Determine if the given path is a hot spare within the given configuration.
@@ -1098,7 +1098,7 @@ is_device_in_use(nvlist_t *config, nvlist_t *nv, boolean_t force,
* regardless of what libdiskmgt or zpool_in_use() says.
*/
if (replacing) {
-#ifdef sun
+#ifdef illumos
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK,
&wholedisk) == 0 && wholedisk)
(void) snprintf(buf, sizeof (buf), "%ss0",
@@ -1422,7 +1422,7 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, nvlist_t *props,
return (NULL);
}
-#ifdef sun
+#ifdef illumos
if (!flags.dryrun && make_disks(zhp, newroot) != 0) {
nvlist_free(newroot);
return (NULL);
@@ -1507,7 +1507,7 @@ make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
return (NULL);
}
-#ifdef sun
+#ifdef illumos
/*
* Run through the vdev specification and label any whole disks found.
*/
diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_create.c b/cddl/contrib/opensolaris/common/ctf/ctf_create.c
index 736481482751..a2ca81960f73 100644
--- a/cddl/contrib/opensolaris/common/ctf/ctf_create.c
+++ b/cddl/contrib/opensolaris/common/ctf/ctf_create.c
@@ -583,10 +583,10 @@ ctf_discard(ctf_file_t *fp)
return (0); /* no update required */
for (dtd = ctf_list_prev(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
- if (dtd->dtd_type <= fp->ctf_dtoldid)
+ ntd = ctf_list_prev(dtd);
+ if (CTF_TYPE_TO_INDEX(dtd->dtd_type) <= fp->ctf_dtoldid)
continue; /* skip types that have been committed */
- ntd = ctf_list_prev(dtd);
ctf_dtd_delete(fp, dtd);
}
@@ -1313,10 +1313,13 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_file_t *src_fp, ctf_id_t src_type)
* unless dst_type is a forward declaration and src_type is a struct,
* union, or enum (i.e. the definition of the previous forward decl).
*/
- if (dst_type != CTF_ERR && dst_kind != kind && (
- dst_kind != CTF_K_FORWARD || (kind != CTF_K_ENUM &&
- kind != CTF_K_STRUCT && kind != CTF_K_UNION)))
- return (ctf_set_errno(dst_fp, ECTF_CONFLICT));
+ if (dst_type != CTF_ERR && dst_kind != kind) {
+ if (dst_kind != CTF_K_FORWARD || (kind != CTF_K_ENUM &&
+ kind != CTF_K_STRUCT && kind != CTF_K_UNION))
+ return (ctf_set_errno(dst_fp, ECTF_CONFLICT));
+ else
+ dst_type = CTF_ERR;
+ }
/*
* If the non-empty name was not found in the appropriate hash, search
@@ -1325,15 +1328,28 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_file_t *src_fp, ctf_id_t src_type)
* we are looking for. This is necessary to permit ctf_add_type() to
* operate recursively on entities such as a struct that contains a
* pointer member that refers to the same struct type.
+ *
+ * In the case of integer and floating point types, we match using the
+ * type encoding as well - else we may incorrectly return a bitfield
+ * type, for instance.
*/
if (dst_type == CTF_ERR && name[0] != '\0') {
for (dtd = ctf_list_prev(&dst_fp->ctf_dtdefs); dtd != NULL &&
- dtd->dtd_type > dst_fp->ctf_dtoldid;
+ CTF_TYPE_TO_INDEX(dtd->dtd_type) > dst_fp->ctf_dtoldid;
dtd = ctf_list_prev(dtd)) {
- if (CTF_INFO_KIND(dtd->dtd_data.ctt_info) == kind &&
- dtd->dtd_name != NULL &&
- strcmp(dtd->dtd_name, name) == 0)
- return (dtd->dtd_type);
+ if (CTF_INFO_KIND(dtd->dtd_data.ctt_info) != kind ||
+ dtd->dtd_name == NULL ||
+ strcmp(dtd->dtd_name, name) != 0)
+ continue;
+ if (kind == CTF_K_INTEGER || kind == CTF_K_FLOAT) {
+ if (ctf_type_encoding(src_fp, src_type,
+ &src_en) != 0)
+ continue;
+ if (bcmp(&src_en, &dtd->dtd_u.dtu_enc,
+ sizeof (ctf_encoding_t)) != 0)
+ continue;
+ }
+ return (dtd->dtd_type);
}
}
diff --git a/cddl/contrib/opensolaris/common/util/strtolctype.h b/cddl/contrib/opensolaris/common/util/strtolctype.h
index a1d18367d345..91609cede4e1 100644
--- a/cddl/contrib/opensolaris/common/util/strtolctype.h
+++ b/cddl/contrib/opensolaris/common/util/strtolctype.h
@@ -44,7 +44,7 @@ extern "C" {
* safe in probe context.
*/
-#if defined(sun) && (defined(_KERNEL) || defined(_BOOT))
+#if defined(illumos) && (defined(_KERNEL) || defined(_BOOT))
#define isalnum(ch) (isalpha(ch) || isdigit(ch))
#define isalpha(ch) (isupper(ch) || islower(ch))
diff --git a/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 b/cddl/contrib/opensolaris/lib/libctf/common/ctf.5
new file mode 100644
index 000000000000..316e97872c07
--- /dev/null
+++ b/cddl/contrib/opensolaris/lib/libctf/common/ctf.5
@@ -0,0 +1,1140 @@
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source. A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.\"
+.\" Copyright (c) 2014 Joyent, Inc.
+.\"
+.Dd Sep 26, 2014
+.Dt CTF 5
+.Os
+.Sh NAME
+.Nm ctf
+.Nd Compact C Type Format
+.Sh SYNOPSIS
+.In sys/ctf.h
+.Sh DESCRIPTION
+.Nm
+is designed to be a compact representation of the C programming
+language's type information focused on serving the needs of dynamic
+tracing, debuggers, and other in-situ and post-mortem introspection
+tools.
+.Nm
+data is generally included in
+.Sy ELF
+objects and is tagged as
+.Sy SHT_PROGBITS
+to ensure that the data is accessible in a running process and in subsequent
+core dumps, if generated.
+.Lp
+The
+.Nm
+data contained in each file has information about the layout and
+sizes of C types, including intrinsic types, enumerations, structures,
+typedefs, and unions, that are used by the corresponding
+.Sy ELF
+object. The
+.Nm
+data may also include information about the types of global objects and
+the return type and arguments of functions in the symbol table.
+.Lp
+Because a
+.Nm
+file is often embedded inside a file, rather than being a standalone
+file itself, it may also be referred to as a
+.Nm
+.Sy container .
+.Lp
+On illumos systems,
+.Nm
+data is consumed by multiple programs. It can be used by the modular
+debugger,
+.Xr mdb 1 ,
+as well as by
+.Xr dtrace 1M .
+Programmatic access to
+.Nm
+data can be obtained through
+.Xr libctf 3LIB .
+.Lp
+The
+.Nm
+file format is broken down into seven different sections. The first
+section is the
+.Sy preamble
+and
+.Sy header ,
+which describes the version of the
+.Nm
+file, links it has to other
+.Nm
+files, and the sizes of the other sections. The next section is the
+.Sy label
+section,
+which provides a way of identifying similar groups of
+.Nm
+data across multiple files. This is followed by the
+.Sy object
+information section, which describes the type of global
+symbols. The subsequent section is the
+.Sy function
+information section, which describes the return
+types and arguments of functions. The next section is the
+.Sy type
+information section, which describes
+the format and layout of the C types themselves, and finally the last
+section is the
+.Sy string
+section, which contains the names of types, enumerations, members, and
+labels.
+.Lp
+While strictly speaking, only the
+.Sy preamble
+and
+.Sy header
+are required, to be actually useful, both the type and string
+sections are necessary.
+.Lp
+A
+.Nm
+file may contain all of the type information that it requires, or it
+may optionally refer to another
+.Nm
+file which holds the remaining types. When a
+.Nm
+file refers to another file, it is called the
+.Sy child
+and the file it refers to is called the
+.Sy parent .
+A given file may only refer to one parent. This process is called
+.Em uniquification
+because it ensures each child only has type information that is
+unique to it. A common example of this is that most kernel modules in
+illumos are uniquified against the kernel module
+.Sy genunix
+and the type information that comes from the
+.Sy IP
+module. This means that a module only has types that are unique to
+itself and the most common types in the kernel are not duplicated.
+.Sh FILE FORMAT
+This documents version
+.Em two
+of the
+.Nm
+file format. All applications and tools currently produce and operate on
+this version.
+.Lp
+The file format can be summarized with the following image, the
+following sections will cover this in more detail.
+.Bd -literal
+
+ +-------------+ 0t0
++--------| Preamble |
+| +-------------+ 0t4
+|+-------| Header |
+|| +-------------+ 0t36 + cth_lbloff
+||+------| Labels |
+||| +-------------+ 0t36 + cth_objtoff
+|||+-----| Objects |
+|||| +-------------+ 0t36 + cth_funcoff
+||||+----| Functions |
+||||| +-------------+ 0t36 + cth_typeoff
+|||||+---| Types |
+|||||| +-------------+ 0t36 + cth_stroff
+||||||+--| Strings |
+||||||| +-------------+ 0t36 + cth_stroff + cth_strlen
+|||||||
+|||||||
+|||||||
+||||||| +-- magic - vers flags
+||||||| | | | |
+||||||| +------+------+------+------+
++---------| 0xcf | 0xf1 | 0x02 | 0x00 |
+ |||||| +------+------+------+------+
+ |||||| 0 1 2 3 4
+ ||||||
+ |||||| + parent label + objects
+ |||||| | + parent name | + functions + strings
+ |||||| | | + label | | + types | + strlen
+ |||||| | | | | | | | |
+ |||||| +------+------+------+------+------+-------+-------+-------+
+ +--------| 0x00 | 0x00 | 0x00 | 0x08 | 0x36 | 0x110 | 0x5f4 | 0x611 |
+ ||||| +------+------+------+------+------+-------+-------+-------+
+ ||||| 0x04 0x08 0x0c 0x10 0x14 0x18 0x1c 0x20 0x24
+ |||||
+ ||||| + Label name
+ ||||| | + Label type
+ ||||| | | + Next label
+ ||||| | | |
+ ||||| +-------+------+-----+
+ +-----------| 0x01 | 0x42 | ... |
+ |||| +-------+------+-----+
+ |||| cth_lbloff +0x4 +0x8 cth_objtoff
+ ||||
+ ||||
+ |||| Symidx 0t15 0t43 0t44
+ |||| +------+------+------+-----+
+ +----------| 0x00 | 0x42 | 0x36 | ... |
+ ||| +------+------+------+-----+
+ ||| cth_objtoff +0x2 +0x4 +0x6 cth_funcoff
+ |||
+ ||| + CTF_TYPE_INFO + CTF_TYPE_INFO
+ ||| | + Return type |
+ ||| | | + arg0 |
+ ||| +--------+------+------+-----+
+ +---------| 0x2c10 | 0x08 | 0x0c | ... |
+ || +--------+------+------+-----+
+ || cth_funcff +0x2 +0x4 +0x6 cth_typeoff
+ ||
+ || + ctf_stype_t for type 1
+ || | integer + integer encoding
+ || | | + ctf_stype_t for type 2
+ || | | |
+ || +--------------------+-----------+-----+
+ +--------| 0x19 * 0xc01 * 0x0 | 0x1000000 | ... |
+ | +--------------------+-----------+-----+
+ | cth_typeoff +0x08 +0x0c cth_stroff
+ |
+ | +--- str 0
+ | | +--- str 1 + str 2
+ | | | |
+ | v v v
+ | +----+---+---+---+----+---+---+---+---+---+----+
+ +---| \\0 | i | n | t | \\0 | f | o | o | _ | t | \\0 |
+ +----+---+---+---+----+---+---+---+---+---+----+
+ 0 1 2 3 4 5 6 7 8 9 10 11
+.Ed
+.Lp
+Every
+.Nm
+file begins with a
+.Sy preamble ,
+followed by a
+.Sy header .
+The
+.Sy preamble
+is defined as follows:
+.Bd -literal
+typedef struct ctf_preamble {
+ ushort_t ctp_magic; /* magic number (CTF_MAGIC) */
+ uchar_t ctp_version; /* data format version number (CTF_VERSION) */
+ uchar_t ctp_flags; /* flags (see below) */
+} ctf_preamble_t;
+.Ed
+.Pp
+The
+.Sy preamble
+is four bytes long and must be four byte aligned.
+This
+.Sy preamble
+defines the version of the
+.Nm
+file which defines the format of the rest of the header. While the
+header may change in subsequent versions, the preamble will not change
+across versions, though the interpretation of its flags may change from
+version to version. The
+.Em ctp_magic
+member defines the magic number for the
+.Nm
+file format. This must always be
+.Li 0xcff1 .
+If another value is encountered, then the file should not be treated as
+a
+.Nm
+file. The
+.Em ctp_version
+member defines the version of the
+.Nm
+file. The current version is
+.Li 2 .
+It is possible to encounter an unsupported version. In that case,
+software should not try to parse the format, as it may have changed.
+Finally, the
+.Em ctp_flags
+member describes aspects of the file which modify its interpretation.
+The following flags are currently defined:
+.Bd -literal
+#define CTF_F_COMPRESS 0x01
+.Ed
+.Pp
+The flag
+.Sy CTF_F_COMPRESS
+indicates that the body of the
+.Nm
+file, all the data following the
+.Sy header ,
+has been compressed through the
+.Sy zlib
+library and its
+.Sy deflate
+algorithm. If this flag is not present, then the body has not been
+compressed and no special action is needed to interpret it. All offsets
+into the data as described by
+.Sy header ,
+always refer to the
+.Sy uncompressed
+data.
+.Lp
+In version two of the
+.Nm
+file format, the
+.Sy header
+denotes whether whether or not this
+.Nm
+file is the child of another
+.Nm
+file and also indicates the size of the remaining sections. The
+structure for the
+.Sy header ,
+logically contains a copy of the
+.Sy preamble
+and the two have a combined size of 36 bytes.
+.Bd -literal
+typedef struct ctf_header {
+ ctf_preamble_t cth_preamble;
+ uint_t cth_parlabel; /* ref to name of parent lbl uniq'd against */
+ uint_t cth_parname; /* ref to basename of parent */
+ uint_t cth_lbloff; /* offset of label section */
+ uint_t cth_objtoff; /* offset of object section */
+ uint_t cth_funcoff; /* offset of function section */
+ uint_t cth_typeoff; /* offset of type section */
+ uint_t cth_stroff; /* offset of string section */
+ uint_t cth_strlen; /* length of string section in bytes */
+} ctf_header_t;
+.Ed
+.Pp
+After the
+.Sy preamble ,
+the next two members
+.Em cth_parlablel
+and
+.Em cth_parname ,
+are used to identify the parent. The value of both members are offsets
+into the
+.Sy string
+section which point to the start of a null-terminated string. For more
+information on the encoding of strings, see the subsection on
+.Sx String Identifiers .
+If the value of either is zero, then there is no entry for that
+member. If the member
+.Em cth_parlabel
+is set, then the
+.Em ctf_parname
+member must be set, otherwise it will not be possible to find the
+parent. If
+.Em ctf_parname
+is set, it is not necessary to define
+.Em cth_parlabel ,
+as the parent may not have a label. For more information on labels
+and their interpretation, see
+.Sx The Label Section .
+.Lp
+The remaining members (excepting
+.Em cth_strlen )
+describe the beginning of the corresponding sections. These offsets are
+relative to the end of the
+.Sy header .
+Therefore, something with an offset of 0 is at an offset of thirty-six
+bytes relative to the start of the
+.Nm
+file. The difference between members
+indicates the size of the section itself. Different offsets have
+different alignment requirements. The start of the
+.Em cth_objotoff
+and
+.Em cth_funcoff
+must be two byte aligned, while the sections
+.Em cth_lbloff
+and
+.Em cth_typeoff
+must be four-byte aligned. The section
+.Em cth_stroff
+has no alignment requirements. To calculate the size of a given section,
+excepting the
+.Sy string
+section, one should subtract the offset of the section from the following one. For
+example, the size of the
+.Sy types
+section can be calculated by subtracting
+.Em cth_stroff
+from
+.Em cth_typeoff .
+.Lp
+Finally, the member
+.Em cth_strlen
+describes the length of the string section itself. From it, you can also
+calculate the size of the entire
+.Nm
+file by adding together the size of the
+.Sy ctf_header_t ,
+the offset of the string section in
+.Em cth_stroff ,
+and the size of the string section in
+.Em cth_srlen .
+.Ss Type Identifiers
+Through the
+.Nm ctf
+data, types are referred to by identifiers. A given
+.Nm
+file supports up to 32767 (0x7fff) types. The first valid type identifier is 0x1.
+When a given
+.Nm
+file is a child, indicated by a non-zero entry for the
+.Sy header Ns 's
+.Em cth_parname ,
+then the first valid type identifier is 0x8000 and the last is 0xffff.
+In this case, type identifiers 0x1 through 0x7fff are references to the
+parent.
+.Lp
+The type identifier zero is a sentinel value used to indicate that there
+is no type information available or it is an unknown type.
+.Lp
+Throughout the file format, the identifier is stored in different sized
+values; however, the minimum size to represent a given identifier is a
+.Sy uint16_t .
+Other consumers of
+.Nm
+information may use larger or opaque identifiers.
+.Ss String Identifiers
+String identifiers are always encoded as four byte unsigned integers
+which are an offset into a string table. The
+.Nm
+format supports two different string tables which have an identifier of
+zero or one. This identifier is stored in the high-order bit of the
+unsigned four byte offset. Therefore, the maximum supported offset into
+one of these tables is 0x7ffffffff.
+.Lp
+Table identifier zero, always refers to the
+.Sy string
+section in the CTF file itself. String table identifier one refers to an
+external string table which is the ELF string table for the ELF symbol
+table associated with the
+.Nm
+container.
+.Ss Type Encoding
+Every
+.Nm
+type begins with metadata encoded into a
+.Sy uint16_t .
+This encoded information tells us three different pieces of information:
+.Bl -bullet -offset indent -compact
+.It
+The kind of the type
+.It
+Whether this type is a root type or not
+.It
+The length of the variable data
+.El
+.Lp
+The 16 bits that make up the encoding are broken down such that you have
+five bits for the kind, one bit for indicating whether or not it is a
+root type, and 10 bits for the variable length. This is laid out as
+follows:
+.Bd -literal -offset indent
++--------------------+
+| kind | root | vlen |
++--------------------+
+15 11 10 9 0
+.Ed
+.Lp
+The current version of the file format defines 14 different kinds. The
+interpretation of these different kinds will be discussed in the section
+.Sx The Type Section .
+If a kind is encountered that is not listed below, then it is not a valid
+.Nm
+file. The kinds are defined as follows:
+.Bd -literal -offset indent
+#define CTF_K_UNKNOWN 0
+#define CTF_K_INTEGER 1
+#define CTF_K_FLOAT 2
+#define CTF_K_POINTER 3
+#define CTF_K_ARRAY 4
+#define CTF_K_FUNCTION 5
+#define CTF_K_STRUCT 6
+#define CTF_K_UNION 7
+#define CTF_K_ENUM 8
+#define CTF_K_FORWARD 9
+#define CTF_K_TYPEDEF 10
+#define CTF_K_VOLATILE 11
+#define CTF_K_CONST 12
+#define CTF_K_RESTRICT 13
+.Ed
+.Lp
+Programs directly reference many types; however, other types are referenced
+indirectly because they are part of some other structure. These types that are
+referenced directly and used are called
+.Sy root
+types. Other types may be used indirectly, for example, a program may reference
+a structure directly, but not one of its members which has a type. That type is
+not considered a
+.Sy root
+type. If a type is a
+.Sy root
+type, then it will have bit 10 set.
+.Lp
+The variable length section is specific to each kind and is discussed in the
+section
+.Sx The Type Section .
+.Lp
+The following macros are useful for constructing and deconstructing the encoded
+type information:
+.Bd -literal -offset indent
+
+#define CTF_MAX_VLEN 0x3ff
+#define CTF_INFO_KIND(info) (((info) & 0xf800) >> 11)
+#define CTF_INFO_ISROOT(info) (((info) & 0x0400) >> 10)
+#define CTF_INFO_VLEN(info) (((info) & CTF_MAX_VLEN))
+
+#define CTF_TYPE_INFO(kind, isroot, vlen) \\
+ (((kind) << 11) | (((isroot) ? 1 : 0) << 10) | ((vlen) & CTF_MAX_VLEN))
+.Ed
+.Ss The Label Section
+When consuming
+.Nm
+data, it is often useful to know whether two different
+.Nm
+containers come from the same source base and version. For example, when
+building illumos, there are many kernel modules that are built against a
+single collection of source code. A label is encoded into the
+.Nm
+files that corresponds with the particular build. This ensures that if
+files on the system were to become mixed up from multiple releases, that
+they are not used together by tools, particularly when a child needs to
+refer to a type in the parent. Because they are linked used the type
+identifiers, if the wrong parent is used then the wrong type will be
+encountered.
+.Lp
+Each label is encoded in the file format using the following eight byte
+structure:
+.Bd -literal
+typedef struct ctf_lblent {
+ uint_t ctl_label; /* ref to name of label */
+ uint_t ctl_typeidx; /* last type associated with this label */
+} ctf_lblent_t;
+.Ed
+.Lp
+Each label has two different components, a name and a type identifier.
+The name is encoded in the
+.Em ctl_label
+member which is in the format defined in the section
+.Sx String Identifiers .
+Generally, the names of all labels are found in the internal string
+section.
+.Lp
+The type identifier encoded in the member
+.Em ctl_typeidx
+refers to the last type identifier that a label refers to in the current
+file. Labels only refer to types in the current file, if the
+.Nm
+file is a child, then it will have the same label as its parent;
+however, its label will only refer to its types, not its parents.
+.Lp
+It is also possible, though rather uncommon, for a
+.Nm
+file to have multiple labels. Labels are placed one after another, every
+eight bytes. When multiple labels are present, types may only belong to
+a single label.
+.Ss The Object Section
+The object section provides a mapping from ELF symbols of type
+.Sy STT_OBJECT
+in the symbol table to a type identifier. Every entry in this section is
+a
+.Sy uint16_t
+which contains a type identifier as described in the section
+.Sx Type Identifiers .
+If there is no information for an object, then the type identifier 0x0
+is stored for that entry.
+.Lp
+To walk the object section, you need to have a corresponding
+.Sy symbol table
+in the ELF object that contains the
+.Nm
+data. Not every object is included in this section. Specifically, when
+walking the symbol table. An entry is skipped if it matches any of the
+following conditions:
+.Lp
+.Bl -bullet -offset indent -compact
+.It
+The symbol type is not
+.Sy STT_OBJECT
+.It
+The symbol's section index is
+.Sy SHN_UNDEF
+.It
+The symbol's name offset is zero
+.It
+The symbol's section index is
+.Sy SHN_ABS
+and the value of the symbol is zero.
+.It
+The symbol's name is
+.Li _START_
+or
+.Li _END_ .
+These are skipped because they are used for scoping local symbols in
+ELF.
+.El
+.Lp
+The following sample code shows an example of iterating the object
+section and skipping the correct symbols:
+.Bd -literal
+#include <gelf.h>
+#include <stdio.h>
+
+/*
+ * Given the start of the object section in the CTF file, the number of symbols,
+ * and the ELF Data sections for the symbol table and the string table, this
+ * prints the type identifiers that correspond to objects. Note, a more robust
+ * implementation should ensure that they don't walk beyond the end of the CTF
+ * object section.
+ */
+static int
+walk_symbols(uint16_t *objtoff, Elf_Data *symdata, Elf_Data *strdata,
+ long nsyms)
+{
+ long i;
+ uintptr_t strbase = strdata->d_buf;
+
+ for (i = 1; i < nsyms; i++, objftoff++) {
+ const char *name;
+ GElf_Sym sym;
+
+ if (gelf_getsym(symdata, i, &sym) == NULL)
+ return (1);
+
+ if (GELF_ST_TYPE(sym.st_info) != STT_OBJECT)
+ continue;
+ if (sym.st_shndx == SHN_UNDEF || sym.st_name == 0)
+ continue;
+ if (sym.st_shndx == SHN_ABS && sym.st_value == 0)
+ continue;
+ name = (const char *)(strbase + sym.st_name);
+ if (strcmp(name, "_START_") == 0 || strcmp(name, "_END_") == 0)
+ continue;
+
+ (void) printf("Symbol %d has type %d\n", i, *objtoff);
+ }
+
+ return (0);
+}
+.Ed
+.Ss The Function Section
+The function section of the
+.Nm
+file encodes the types of both the function's arguments and the function's
+return type. Similar to
+.Sx The Object Section ,
+the function section encodes information for all symbols of type
+.Sy STT_FUNCTION ,
+excepting those that fit specific criteria. Unlike with objects, because
+functions have a variable number of arguments, they start with a type encoding
+as defined in
+.Sx Type Encoding ,
+which is the size of a
+.Sy uint16_t .
+For functions which have no type information available, they are encoded as
+.Li CTF_TYPE_INFO(CTF_K_UNKNOWN, 0, 0) .
+Functions with arguments are encoded differently. Here, the variable length is
+turned into the number of arguments in the function. If a function is a
+.Sy varargs
+type function, then the number of arguments is increased by one. Functions with
+type information are encoded as:
+.Li CTF_TYPE_INFO(CTF_K_FUNCTION, 0, nargs) .
+.Lp
+For functions that have no type information, nothing else is encoded, and the
+next function is encoded. For functions with type information, the next
+.Sy uint16_t
+is encoded with the type identifier of the return type of the function. It is
+followed by each of the type identifiers of the arguments, if any exist, in the
+order that they appear in the function. Therefore, argument 0 is the first type
+identifier and so on. When a function has a final varargs argument, that is
+encoded with the type identifier of zero.
+.Lp
+Like
+.Sx The Object Section ,
+the function section is encoded in the order of the symbol table. It has
+similar, but slightly different considerations from objects. While iterating the
+symbol table, if any of the following conditions are true, then the entry is
+skipped and no corresponding entry is written:
+.Lp
+.Bl -bullet -offset indent -compact
+.It
+The symbol type is not
+.Sy STT_FUNCTION
+.It
+The symbol's section index is
+.Sy SHN_UNDEF
+.It
+The symbol's name offset is zero
+.It
+The symbol's name is
+.Li _START_
+or
+.Li _END_ .
+These are skipped because they are used for scoping local symbols in
+ELF.
+.El
+.Ss The Type Section
+The type section is the heart of the
+.Nm
+data. It encodes all of the information about the types themselves. The base of
+the type information comes in two forms, a short form and a long form, each of
+which may be followed by a variable number of arguments. The following
+definitions describe the short and long forms:
+.Bd -literal
+#define CTF_MAX_SIZE 0xfffe /* max size of a type in bytes */
+#define CTF_LSIZE_SENT 0xffff /* sentinel for ctt_size */
+#define CTF_MAX_LSIZE UINT64_MAX
+
+typedef struct ctf_stype {
+ uint_t ctt_name; /* reference to name in string table */
+ ushort_t ctt_info; /* encoded kind, variant length */
+ union {
+ ushort_t _size; /* size of entire type in bytes */
+ ushort_t _type; /* reference to another type */
+ } _u;
+} ctf_stype_t;
+
+typedef struct ctf_type {
+ uint_t ctt_name; /* reference to name in string table */
+ ushort_t ctt_info; /* encoded kind, variant length */
+ union {
+ ushort_t _size; /* always CTF_LSIZE_SENT */
+ ushort_t _type; /* do not use */
+ } _u;
+ uint_t ctt_lsizehi; /* high 32 bits of type size in bytes */
+ uint_t ctt_lsizelo; /* low 32 bits of type size in bytes */
+} ctf_type_t;
+
+#define ctt_size _u._size /* for fundamental types that have a size */
+#define ctt_type _u._type /* for types that reference another type */
+.Ed
+.Pp
+Type sizes are stored in
+.Sy bytes .
+The basic small form uses a
+.Sy ushort_t
+to store the number of bytes. If the number of bytes in a structure would exceed
+0xfffe, then the alternate form, the
+.Sy ctf_type_t ,
+is used instead. To indicate that the larger form is being used, the member
+.Em ctt_size
+is set to value of
+.Sy CTF_LSIZE_SENT
+(0xffff). In general, when going through the type section, consumers use the
+.Sy ctf_type_t
+structure, but pay attention to the value of the member
+.Em ctt_size
+to determine whether they should increment their scan by the size of the
+.Sy ctf_stype_t
+or
+.Sy ctf_type_t .
+Not all kinds of types use
+.Sy ctt_size .
+Those which do not, will always use the
+.Sy ctf_stype_t
+structure. The individual sections for each kind have more information.
+.Lp
+Types are written out in order. Therefore the first entry encountered has a type
+id of 0x1, or 0x8000 if a child. The member
+.Em ctt_name
+is encoded as described in the section
+.Sx String Identifiers .
+The string that it points to is the name of the type. If the identifier points
+to an empty string (one that consists solely of a null terminator) then the type
+does not have a name, this is common with anonymous structures and unions that
+only have a typedef to name them, as well as, pointers and qualifiers.
+.Lp
+The next member, the
+.Em ctt_info ,
+is encoded as described in the section
+.Sx Type Encoding .
+The types kind tells us how to interpret the remaining data in the
+.Sy ctf_type_t
+and any variable length data that may exist. The rest of this section will be
+broken down into the interpretation of the various kinds.
+.Ss Encoding of Integers
+Integers, which are of type
+.Sy CTF_K_INTEGER ,
+have no variable length arguments. Instead, they are followed by a four byte
+.Sy uint_t
+which describes their encoding. All integers must be encoded with a variable
+length of zero. The
+.Em ctt_size
+member describes the length of the integer in bytes. In general, integer sizes
+will be rounded up to the closest power of two.
+.Lp
+The integer encoding contains three different pieces of information:
+.Bl -bullet -offset indent -compact
+.It
+The encoding of the integer
+.It
+The offset in
+.Sy bits
+of the type
+.It
+The size in
+.Sy bits
+of the type
+.El
+.Pp
+This encoding can be expressed through the following macros:
+.Bd -literal -offset indent
+#define CTF_INT_ENCODING(data) (((data) & 0xff000000) >> 24)
+#define CTF_INT_OFFSET(data) (((data) & 0x00ff0000) >> 16)
+#define CTF_INT_BITS(data) (((data) & 0x0000ffff))
+
+#define CTF_INT_DATA(encoding, offset, bits) \\
+ (((encoding) << 24) | ((offset) << 16) | (bits))
+.Ed
+.Pp
+The following flags are defined for the encoding at this time:
+.Bd -literal -offset indent
+#define CTF_INT_SIGNED 0x01
+#define CTF_INT_CHAR 0x02
+#define CTF_INT_BOOL 0x04
+#define CTF_INT_VARARGS 0x08
+.Ed
+.Lp
+By default, an integer is considered to be unsigned, unless it has the
+.Sy CTF_INT_SIGNED
+flag set. If the flag
+.Sy CTF_INT_CHAR
+is set, that indicates that the integer is of a type that stores character
+data, for example the intrinsic C type
+.Sy char
+would have the
+.Sy CTF_INT_CHAR
+flag set. If the flag
+.Sy CTF_INT_BOOL
+is set, that indicates that the integer represents a boolean type. For example,
+the intrinsic C type
+.Sy _Bool
+would have the
+.Sy CTF_INT_BOOL
+flag set. Finally, the flag
+.Sy CTF_INT_VARARGS
+indicates that the integer is used as part of a variable number of arguments.
+This encoding is rather uncommon.
+.Ss Encoding of Floats
+Floats, which are of type
+.Sy CTF_K_FLOAT ,
+are similar to their integer counterparts. They have no variable length
+arguments and are followed by a four byte encoding which describes the kind of
+float that exists. The
+.Em ctt_size
+member is the size, in bytes, of the float. The float encoding has three
+different pieces of information inside of it:
+.Lp
+.Bl -bullet -offset indent -compact
+.It
+The specific kind of float that exists
+.It
+The offset in
+.Sy bits
+of the float
+.It
+The size in
+.Sy bits
+of the float
+.El
+.Lp
+This encoding can be expressed through the following macros:
+.Bd -literal -offset indent
+#define CTF_FP_ENCODING(data) (((data) & 0xff000000) >> 24)
+#define CTF_FP_OFFSET(data) (((data) & 0x00ff0000) >> 16)
+#define CTF_FP_BITS(data) (((data) & 0x0000ffff))
+
+#define CTF_FP_DATA(encoding, offset, bits) \\
+ (((encoding) << 24) | ((offset) << 16) | (bits))
+.Ed
+.Lp
+Where as the encoding for integers was a series of flags, the encoding for
+floats maps to a specific kind of float. It is not a flag-based value. The kinds of floats
+correspond to both their size, and the encoding. This covers all of the basic C
+intrinsic floating point types. The following are the different kinds of floats
+represented in the encoding:
+.Bd -literal -offset indent
+#define CTF_FP_SINGLE 1 /* IEEE 32-bit float encoding */
+#define CTF_FP_DOUBLE 2 /* IEEE 64-bit float encoding */
+#define CTF_FP_CPLX 3 /* Complex encoding */
+#define CTF_FP_DCPLX 4 /* Double complex encoding */
+#define CTF_FP_LDCPLX 5 /* Long double complex encoding */
+#define CTF_FP_LDOUBLE 6 /* Long double encoding */
+#define CTF_FP_INTRVL 7 /* Interval (2x32-bit) encoding */
+#define CTF_FP_DINTRVL 8 /* Double interval (2x64-bit) encoding */
+#define CTF_FP_LDINTRVL 9 /* Long double interval (2x128-bit) encoding */
+#define CTF_FP_IMAGRY 10 /* Imaginary (32-bit) encoding */
+#define CTF_FP_DIMAGRY 11 /* Long imaginary (64-bit) encoding */
+#define CTF_FP_LDIMAGRY 12 /* Long double imaginary (128-bit) encoding */
+.Ed
+.Ss Encoding of Arrays
+Arrays, which are of type
+.Sy CTF_K_ARRAY ,
+have no variable length arguments. They are followed by a structure which
+describes the number of elements in the array, the type identifier of the
+elements in the array, and the type identifier of the index of the array. With
+arrays, the
+.Em ctt_size
+member is set to zero. The structure that follows an array is defined as:
+.Bd -literal
+typedef struct ctf_array {
+ ushort_t cta_contents; /* reference to type of array contents */
+ ushort_t cta_index; /* reference to type of array index */
+ uint_t cta_nelems; /* number of elements */
+} ctf_array_t;
+.Ed
+.Lp
+The
+.Em cta_contents
+and
+.Em cta_index
+members of the
+.Sy ctf_array_t
+are type identifiers which are encoded as per the section
+.Sx Type Identifiers .
+The member
+.Em cta_nelems
+is a simple four byte unsigned count of the number of elements. This count may
+be zero when encountering C99's flexible array members.
+.Ss Encoding of Functions
+Function types, which are of type
+.Sy CTF_K_FUNCTION ,
+use the variable length list to be the number of arguments in the function. When
+the function has a final member which is a varargs, then the argument count is
+incremented by one to account for the variable argument. Here, the
+.Em ctt_type
+member is encoded with the type identifier of the return type of the function.
+Note that the
+.Em ctt_size
+member is not used here.
+.Lp
+The variable argument list contains the type identifiers for the arguments of
+the function, if any. Each one is represented by a
+.Sy uint16_t
+and encoded according to the
+.Sx Type Identifiers
+section. If the function's last argument is of type varargs, then it is also
+written out, but the type identifier is zero. This is included in the count of
+the function's arguments.
+.Ss Encoding of Structures and Unions
+Structures and Unions, which are encoded with
+.Sy CTF_K_STRUCT
+and
+.Sy CTF_K_UNION
+respectively, are very similar constructs in C. The main difference
+between them is the fact that every member of a structure follows one another,
+where as in a union, all members share the same memory. They are also very
+similar in terms of their encoding in
+.Nm .
+The variable length argument for structures and unions represents the number of
+members that they have. The value of the member
+.Em ctt_size
+is the size of the structure and union. There are two different structures which
+are used to encode members in the variable list. When the size of a structure or
+union is greater than or equal to the large member threshold, 8192, then a
+different structure is used to encode the member, all members are encoded using
+the same structure. The structure for members is as follows:
+.Bd -literal
+typedef struct ctf_member {
+ uint_t ctm_name; /* reference to name in string table */
+ ushort_t ctm_type; /* reference to type of member */
+ ushort_t ctm_offset; /* offset of this member in bits */
+} ctf_member_t;
+
+typedef struct ctf_lmember {
+ uint_t ctlm_name; /* reference to name in string table */
+ ushort_t ctlm_type; /* reference to type of member */
+ ushort_t ctlm_pad; /* padding */
+ uint_t ctlm_offsethi; /* high 32 bits of member offset in bits */
+ uint_t ctlm_offsetlo; /* low 32 bits of member offset in bits */
+} ctf_lmember_t;
+.Ed
+.Lp
+Both the
+.Em ctm_name
+and
+.Em ctlm_name
+refer to the name of the member. The name is encoded as an offset into the
+string table as described by the section
+.Sx String Identifiers .
+The members
+.Sy ctm_type
+and
+.Sy ctlm_type
+both refer to the type of the member. They are encoded as per the section
+.Sx Type Identifiers .
+.Lp
+The last piece of information that is present is the offset which describes the
+offset in memory that the member begins at. For unions, this value will always
+be zero because the start of unions in memory is always zero. For structures,
+this is the offset in
+.Sy bits
+that the member begins at. Note that a compiler may lay out a type with padding.
+This means that the difference in offset between two consecutive members may be
+larger than the size of the member. When the size of the overall structure is
+strictly less than 8192 bytes, the normal structure,
+.Sy ctf_member_t ,
+is used and the offset in bits is stored in the member
+.Em ctm_offset .
+However, when the size of the structure is greater than or equal to 8192 bytes,
+then the number of bits is split into two 32-bit quantities. One member,
+.Em ctlm_offsethi ,
+represents the upper 32 bits of the offset, while the other member,
+.Em ctlm_offsetlo ,
+represents the lower 32 bits of the offset. These can be joined together to get
+a 64-bit sized offset in bits by shifting the member
+.Em ctlm_offsethi
+to the left by thirty two and then doing a binary or of
+.Em ctlm_offsetlo .
+.Ss Encoding of Enumerations
+Enumerations, noted by the type
+.Sy CTF_K_ENUM ,
+are similar to structures. Enumerations use the variable list to note the number
+of values that the enumeration contains, which we'll term enumerators. In C, an
+enumeration is always equivalent to the intrinsic type
+.Sy int ,
+thus the value of the member
+.Em ctt_size
+is always the size of an integer which is determined based on the current model.
+For illumos systems, this will always be 4, as an integer is always defined to
+be 4 bytes large in both
+.Sy ILP32
+and
+.Sy LP64 ,
+regardless of the architecture.
+.Lp
+The enumerators encoded in an enumeration have the following structure in the
+variable list:
+.Bd -literal
+typedef struct ctf_enum {
+ uint_t cte_name; /* reference to name in string table */
+ int cte_value; /* value associated with this name */
+} ctf_enum_t;
+.Ed
+.Pp
+The member
+.Em cte_name
+refers to the name of the enumerator's value, it is encoded according to the
+rules in the section
+.Sx String Identifiers .
+The member
+.Em cte_value
+contains the integer value of this enumerator.
+.Ss Encoding of Forward References
+Forward references, types of kind
+.Sy CTF_K_FORWARD ,
+in a
+.Nm
+file refer to types which may not have a definition at all, only a name. If
+the
+.Nm
+file is a child, then it may be that the forward is resolved to an
+actual type in the parent, otherwise the definition may be in another
+.Nm
+container or may not be known at all. The only member of the
+.Sy ctf_type_t
+that matters for a forward declaration is the
+.Em ctt_name
+which points to the name of the forward reference in the string table as
+described earlier. There is no other information recorded for forward
+references.
+.Ss Encoding of Pointers, Typedefs, Volatile, Const, and Restrict
+Pointers, typedefs, volatile, const, and restrict are all similar in
+.Nm .
+They all refer to another type. In the case of typedefs, they provide an
+alternate name, while volatile, const, and restrict change how the type is
+interpreted in the C programming language. This covers the
+.Nm
+kinds
+.Sy CTF_K_POINTER ,
+.Sy CTF_K_TYPEDEF ,
+.Sy CTF_K_VOLATILE ,
+.Sy CTF_K_RESTRICT ,
+and
+.Sy CTF_K_CONST .
+.Lp
+These types have no variable list entries and use the member
+.Em ctt_type
+to refer to the base type that they modify.
+.Ss Encoding of Unknown Types
+Types with the kind
+.Sy CTF_K_UNKNOWN
+are used to indicate gaps in the type identifier space. These entries consume an
+identifier, but do not define anything. Nothing should refer to these gap
+identifiers.
+.Ss Dependencies Between Types
+C types can be imagined as a directed, cyclic, graph. Structures and unions may
+refer to each other in a way that creates a cyclic dependency. In cases such as
+these, the entire type section must be read in and processed. Consumers must
+not assume that every type can be laid out in dependency order; they
+cannot.
+.Ss The String Section
+The last section of the
+.Nm
+file is the
+.Sy string
+section. This section encodes all of the strings that appear throughout
+the other sections. It is laid out as a series of characters followed by
+a null terminator. Generally, all names are written out in ASCII, as
+most C compilers do not allow and characters to appear in identifiers
+outside of a subset of ASCII. However, any extended characters sets
+should be written out as a series of UTF-8 bytes.
+.Lp
+The first entry in the section, at offset zero, is a single null
+terminator to reference the empty string. Following that, each C string
+should be written out, including the null terminator. Offsets that refer
+to something in this section should refer to the first byte which begins
+a string. Beyond the first byte in the section being the null
+terminator, the order of strings is unimportant.
+.Ss Data Encoding and ELF Considerations
+.Nm
+data is generally included in ELF objects which specify information to
+identify the architecture and endianness of the file. A
+.Nm
+container inside such an object must match the endianness of the ELF
+object. Aside from the question of the endian encoding of data, there
+should be no other differences between architectures. While many of the
+types in this document refer to non-fixed size C integral types, they
+are equivalent in the models
+.Sy ILP32
+and
+.Sy LP64 .
+If any other model is being used with
+.Nm
+data that has different sizes, then it must not use the model's sizes for
+those integral types and instead use the fixed size equivalents based on an
+.Sy ILP32
+environment.
+.Lp
+When placing a
+.Nm
+container inside of an ELF object, there are certain conventions that are
+expected for the purposes of tooling being able to find the
+.Nm
+data. In particular, a given ELF object should only contain a single
+.Nm
+section. Multiple containers should be merged together into a single
+one.
+.Lp
+The
+.Nm
+file should be included in its own ELF section. The section's name
+must be
+.Ql .SUNW_ctf .
+The type of the section must be
+.Sy SHT_PROGBITS .
+The section should have a link set to the symbol table and its address
+alignment must be 4.
+.Sh SEE ALSO
+.Xr dtrace 1 ,
+.Xr elf 3 ,
+.Xr gelf 3 ,
+.Xr a.out 5 ,
+.Xr elf 5
diff --git a/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c b/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
index 58222670f4ff..b9f512d37739 100644
--- a/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
+++ b/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
@@ -34,14 +34,14 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
-#if defined(sun)
+#ifdef illumos
#include <dlfcn.h>
#else
#include <zlib.h>
#endif
#include <gelf.h>
-#if defined(sun)
+#ifdef illumos
#ifdef _LP64
static const char *_libctf_zlib = "/usr/lib/64/libz.so";
#else
@@ -58,7 +58,7 @@ static struct {
static size_t _PAGESIZE;
static size_t _PAGEMASK;
-#if defined(sun)
+#ifdef illumos
#pragma init(_libctf_init)
#else
void _libctf_init(void) __attribute__ ((constructor));
@@ -66,7 +66,7 @@ void _libctf_init(void) __attribute__ ((constructor));
void
_libctf_init(void)
{
-#if defined(sun)
+#ifdef illumos
const char *p = getenv("LIBCTF_DECOMPRESSOR");
if (p != NULL)
@@ -87,7 +87,7 @@ _libctf_init(void)
void *
ctf_zopen(int *errp)
{
-#if defined(sun)
+#ifdef illumos
ctf_dprintf("decompressing CTF data using %s\n", _libctf_zlib);
if (zlib.z_dlp != NULL)
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c b/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c
new file mode 100644
index 000000000000..25a250dd525d
--- /dev/null
+++ b/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c
@@ -0,0 +1,190 @@
+/*
+ * 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.
+ *
+ * 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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ * Copyright 2014 Howard Su
+ * Copyright 2015 George V. Neville-Neil
+ *
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <stdlib.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <libgen.h>
+
+#include <dt_impl.h>
+#include <dt_pid.h>
+
+#if !defined(sun)
+#define PR_MODEL_ILP32 1
+#define PR_MODEL_LP64 2
+#include <libproc_compat.h>
+#endif
+
+#define OP(x) ((x) >> 30)
+#define OP2(x) (((x) >> 22) & 0x07)
+#define COND(x) (((x) >> 25) & 0x0f)
+#define A(x) (((x) >> 29) & 0x01)
+
+#define OP_BRANCH 0
+
+#define OP2_BPcc 0x1
+#define OP2_Bicc 0x2
+#define OP2_BPr 0x3
+#define OP2_FBPfcc 0x5
+#define OP2_FBfcc 0x6
+
+/*ARGSUSED*/
+int
+dt_pid_create_entry_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+ fasttrap_probe_spec_t *ftp, const GElf_Sym *symp)
+{
+ ftp->ftps_type = DTFTP_ENTRY;
+ ftp->ftps_pc = (uintptr_t)symp->st_value;
+ ftp->ftps_size = (size_t)symp->st_size;
+ ftp->ftps_noffs = 1;
+ ftp->ftps_offs[0] = 0;
+
+ if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+ dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+ strerror(errno));
+ return (dt_set_errno(dtp, errno));
+ }
+
+ return (1);
+}
+
+int
+dt_pid_create_return_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+ fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, uint64_t *stret)
+{
+
+ uint32_t *text;
+ int i;
+ int srdepth = 0;
+
+ dt_dprintf("%s: unimplemented\n", __func__);
+ return (DT_PROC_ERR);
+
+ if ((text = malloc(symp->st_size + 4)) == NULL) {
+ dt_dprintf("mr sparkle: malloc() failed\n");
+ return (DT_PROC_ERR);
+ }
+
+ if (Pread(P, text, symp->st_size, symp->st_value) != symp->st_size) {
+ dt_dprintf("mr sparkle: Pread() failed\n");
+ free(text);
+ return (DT_PROC_ERR);
+ }
+
+ /*
+ * Leave a dummy instruction in the last slot to simplify edge
+ * conditions.
+ */
+ text[symp->st_size / 4] = 0;
+
+ ftp->ftps_type = DTFTP_RETURN;
+ ftp->ftps_pc = symp->st_value;
+ ftp->ftps_size = symp->st_size;
+ ftp->ftps_noffs = 0;
+
+
+ free(text);
+ if (ftp->ftps_noffs > 0) {
+ if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+ dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+ strerror(errno));
+ return (dt_set_errno(dtp, errno));
+ }
+ }
+
+
+ return (ftp->ftps_noffs);
+}
+
+/*ARGSUSED*/
+int
+dt_pid_create_offset_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+ fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, ulong_t off)
+{
+ if (off & 0x3)
+ return (DT_PROC_ALIGN);
+
+ ftp->ftps_type = DTFTP_OFFSETS;
+ ftp->ftps_pc = (uintptr_t)symp->st_value;
+ ftp->ftps_size = (size_t)symp->st_size;
+ ftp->ftps_noffs = 1;
+ ftp->ftps_offs[0] = off;
+
+ if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+ dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+ strerror(errno));
+ return (dt_set_errno(dtp, errno));
+ }
+
+ return (1);
+}
+
+/*ARGSUSED*/
+int
+dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+ fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, const char *pattern)
+{
+ ulong_t i;
+
+ ftp->ftps_type = DTFTP_OFFSETS;
+ ftp->ftps_pc = (uintptr_t)symp->st_value;
+ ftp->ftps_size = (size_t)symp->st_size;
+ ftp->ftps_noffs = 0;
+
+ /*
+ * If we're matching against everything, just iterate through each
+ * instruction in the function, otherwise look for matching offset
+ * names by constructing the string and comparing it against the
+ * pattern.
+ */
+ if (strcmp("*", pattern) == 0) {
+ for (i = 0; i < symp->st_size; i += 4) {
+ ftp->ftps_offs[ftp->ftps_noffs++] = i;
+ }
+ } else {
+ char name[sizeof (i) * 2 + 1];
+
+ for (i = 0; i < symp->st_size; i += 4) {
+ (void) sprintf(name, "%lx", i);
+ if (gmatch(name, pattern))
+ ftp->ftps_offs[ftp->ftps_noffs++] = i;
+ }
+ }
+
+ if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+ dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+ strerror(errno));
+ return (dt_set_errno(dtp, errno));
+ }
+
+ return (ftp->ftps_noffs);
+}
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
index ccd4f9b7fb8d..5fab935ee94e 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
@@ -36,7 +36,6 @@
#include <string.h>
#include <errno.h>
#include <libelf.h>
-#include <gelf.h>
/*
* In Solaris 10 GA, the only mechanism for communicating helper information
@@ -56,15 +55,13 @@
*/
static const char *devnamep = "/dev/dtrace/helper";
-#if defined(sun)
+#ifdef illumos
static const char *olddevname = "/devices/pseudo/dtrace@0:helper";
#endif
static const char *modname; /* Name of this load object */
static int gen; /* DOF helper generation */
-#if defined(sun)
extern dof_hdr_t __SUNW_dof; /* DOF defined in the .SUNW_dof section */
-#endif
static boolean_t dof_init_debug = B_FALSE; /* From DTRACE_DOF_INIT_DEBUG */
static void
@@ -90,7 +87,7 @@ dprintf(int debug, const char *fmt, ...)
va_end(ap);
}
-#if defined(sun)
+#ifdef illumos
#pragma init(dtrace_dof_init)
#else
static void dtrace_dof_init(void) __attribute__ ((constructor));
@@ -99,35 +96,21 @@ static void dtrace_dof_init(void) __attribute__ ((constructor));
static void
dtrace_dof_init(void)
{
-#if defined(sun)
dof_hdr_t *dof = &__SUNW_dof;
-#else
- dof_hdr_t *dof = NULL;
-#endif
#ifdef _LP64
Elf64_Ehdr *elf;
#else
Elf32_Ehdr *elf;
#endif
dof_helper_t dh;
- Link_map *lmp;
-#if defined(sun)
+ Link_map *lmp = NULL;
+#ifdef illumos
Lmid_t lmid;
#else
u_long lmid = 0;
#endif
int fd;
const char *p;
-#if !defined(sun)
- Elf *e;
- Elf_Scn *scn = NULL;
- Elf_Data *dofdata = NULL;
- dof_hdr_t *dof_next = NULL;
- GElf_Shdr shdr;
- int efd;
- char *s;
- size_t shstridx;
-#endif
if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL)
return;
@@ -140,7 +123,7 @@ dtrace_dof_init(void)
return;
}
-#if defined(sun)
+#ifdef illumos
if (dlinfo(RTLD_SELF, RTLD_DI_LMID, &lmid) == -1) {
dprintf(1, "couldn't discover link map ID\n");
return;
@@ -151,39 +134,6 @@ dtrace_dof_init(void)
modname = lmp->l_name;
else
modname++;
-#if !defined(sun)
- elf_version(EV_CURRENT);
- if ((efd = open(lmp->l_name, O_RDONLY, 0)) < 0) {
- dprintf(1, "couldn't open file for reading\n");
- return;
- }
- if ((e = elf_begin(efd, ELF_C_READ, NULL)) == NULL) {
- dprintf(1, "elf_begin failed\n");
- close(efd);
- return;
- }
- elf_getshdrstrndx(e, &shstridx);
- dof = NULL;
- while ((scn = elf_nextscn(e, scn)) != NULL) {
- gelf_getshdr(scn, &shdr);
- if (shdr.sh_type == SHT_SUNW_dof) {
- s = elf_strptr(e, shstridx, shdr.sh_name);
- if (s != NULL && strcmp(s, ".SUNW_dof") == 0) {
- dofdata = elf_getdata(scn, NULL);
- dof = dofdata->d_buf;
- }
- }
- }
- if (dof == NULL) {
- dprintf(1, "SUNW_dof section not found\n");
- elf_end(e);
- close(efd);
- return;
- }
-
- while ((char *) dof < (char *) dofdata->d_buf + dofdata->d_size) {
- dof_next = (void *) ((char *) dof + dof->dofh_filesz);
-#endif
if (dof->dofh_ident[DOF_ID_MAG0] != DOF_MAG_MAG0 ||
dof->dofh_ident[DOF_ID_MAG1] != DOF_MAG_MAG1 ||
@@ -197,6 +147,9 @@ dtrace_dof_init(void)
dh.dofhp_dof = (uintptr_t)dof;
dh.dofhp_addr = elf->e_type == ET_DYN ? (uintptr_t) lmp->l_addr : 0;
+#ifdef __FreeBSD__
+ dh.dofhp_pid = getpid();
+#endif
if (lmid == 0) {
(void) snprintf(dh.dofhp_mod, sizeof (dh.dofhp_mod),
@@ -211,7 +164,7 @@ dtrace_dof_init(void)
if ((fd = open64(devnamep, O_RDWR)) < 0) {
dprintf(1, "failed to open helper device %s", devnamep);
-#if defined(sun)
+#ifdef illumos
/*
* If the device path wasn't explicitly set, try again with
* the old device path.
@@ -233,24 +186,15 @@ dtrace_dof_init(void)
dprintf(1, "DTrace ioctl failed for DOF at %p", dof);
else {
dprintf(1, "DTrace ioctl succeeded for DOF at %p\n", dof);
-#if !defined(sun)
- gen = dh.gen;
+#ifdef __FreeBSD__
+ gen = dh.dofhp_gen;
#endif
}
(void) close(fd);
-
-#if !defined(sun)
- /* End of while loop */
- dof = dof_next;
- }
-
- elf_end(e);
- (void) close(efd);
-#endif
}
-#if defined(sun)
+#ifdef illumos
#pragma fini(dtrace_dof_fini)
#else
static void dtrace_dof_fini(void) __attribute__ ((destructor));
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c
index 6b571fafdd04..5ea55a05faf0 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c
@@ -35,7 +35,7 @@
#include <unistd.h>
#include <dt_impl.h>
#include <assert.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#else
#include <sys/sysctl.h>
@@ -453,7 +453,7 @@ dt_aggregate_snap_cpu(dtrace_hdl_t *dtp, processorid_t cpu)
buf->dtbd_cpu = cpu;
-#if defined(sun)
+#ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, buf) == -1) {
#else
if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, &buf) == -1) {
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
index 35b8f0289b9f..84f8661e3fb4 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
@@ -1888,7 +1888,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
char **argv = malloc(sizeof (char *) * (argc + 5));
FILE *ofp = tmpfile();
-#if defined(sun)
+#ifdef illumos
char ipath[20], opath[20]; /* big enough for /dev/fd/ + INT_MAX + \0 */
#endif
char verdef[32]; /* big enough for -D__SUNW_D_VERSION=0x%08x + \0 */
@@ -1898,7 +1898,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
int wstat, estat;
pid_t pid;
-#if defined(sun)
+#ifdef illumos
off64_t off;
#else
off_t off = 0;
@@ -1929,7 +1929,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
(void) fseeko64(ifp, off, SEEK_SET);
}
-#if defined(sun)
+#ifdef illumos
(void) snprintf(ipath, sizeof (ipath), "/dev/fd/%d", fileno(ifp));
(void) snprintf(opath, sizeof (opath), "/dev/fd/%d", fileno(ofp));
#endif
@@ -1940,7 +1940,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
"-D__SUNW_D_VERSION=0x%08x", dtp->dt_vmax);
argv[argc++] = verdef;
-#if defined(sun)
+#ifdef illumos
switch (dtp->dt_stdcmode) {
case DT_STDC_XA:
case DT_STDC_XT:
@@ -1982,7 +1982,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
}
if (pid == 0) {
-#if !defined(sun)
+#ifndef illumos
if (isatty(fileno(ifp)) == 0)
lseek(fileno(ifp), off, SEEK_SET);
dup2(fileno(ifp), 0);
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
index 072cb0558813..04c022b7ad00 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
@@ -35,12 +35,12 @@
#include <limits.h>
#include <assert.h>
#include <ctype.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <dt_impl.h>
#include <dt_pq.h>
-#if !defined(sun)
+#ifndef illumos
#include <libproc_compat.h>
#endif
@@ -382,6 +382,9 @@ dt_stddev(uint64_t *data, uint64_t normal)
int64_t norm_avg;
uint64_t diff[2];
+ if (data[0] == 0)
+ return (0);
+
/*
* The standard approximation for standard deviation is
* sqrt(average(x**2) - average(x)**2), i.e. the square root
@@ -724,8 +727,8 @@ dt_print_packed(dtrace_hdl_t *dtp, FILE *fp,
utf8 = B_TRUE;
} else if ((term = getenv("TERM")) != NULL &&
(strcmp(term, "sun") == 0 ||
- strcmp(term, "sun-color") == 0) ||
- strcmp(term, "dumb") == 0) {
+ strcmp(term, "sun-color") == 0 ||
+ strcmp(term, "dumb") == 0)) {
utf8 = B_FALSE;
} else {
utf8 = B_TRUE;
@@ -2958,7 +2961,7 @@ dt_get_buf(dtrace_hdl_t *dtp, int cpu, dtrace_bufdesc_t **bufp)
buf->dtbd_size = size;
buf->dtbd_cpu = cpu;
-#if defined(sun)
+#ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
#else
if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &buf) == -1) {
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
index 0b531c5e6883..a4e325671f9f 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
@@ -26,12 +26,12 @@
*/
#include <sys/types.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/sysmacros.h>
#endif
#include <strings.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <assert.h>
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c
index 2327ff75e4d4..339e2de5d150 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c
@@ -145,7 +145,7 @@ dtrace_errno(dtrace_hdl_t *dtp)
return (dtp->dt_errno);
}
-#if defined(sun)
+#ifdef illumos
int
dt_set_errno(dtrace_hdl_t *dtp, int err)
{
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c
index fe1ec7a80f71..f26126bba517 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c
@@ -31,7 +31,7 @@
#include <errno.h>
#include <unistd.h>
#include <assert.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c
index 5a2f0e4c1f5c..b9164ac26cf9 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c
@@ -28,18 +28,18 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#if defined(sun)
+#ifdef illumos
#include <sys/sysmacros.h>
#endif
#include <strings.h>
#include <stdlib.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <assert.h>
#include <errno.h>
#include <ctype.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/procfs_isa.h>
#endif
#include <limits.h>
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
index 8cf5fe2d140b..51bed72556d0 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
@@ -34,7 +34,7 @@
#include <sys/param.h>
#include <sys/objfs.h>
-#if !defined(sun)
+#ifndef illumos
#include <sys/bitmap.h>
#include <sys/utsname.h>
#include <sys/ioccom.h>
@@ -45,7 +45,7 @@
#include <libctf.h>
#include <dtrace.h>
#include <gelf.h>
-#if defined(sun)
+#ifdef illumos
#include <synch.h>
#endif
@@ -142,7 +142,7 @@ typedef struct dt_module {
GElf_Addr dm_bss_va; /* virtual address of BSS */
GElf_Xword dm_bss_size; /* size in bytes of BSS */
dt_idhash_t *dm_extern; /* external symbol definitions */
-#if !defined(sun)
+#ifndef illumos
caddr_t dm_reloc_offset; /* Symbol relocation offset. */
uintptr_t *dm_sec_offsets;
#endif
@@ -275,6 +275,9 @@ struct dtrace_hdl {
int dt_cpp_argc; /* count of initialized cpp(1) arguments */
int dt_cpp_args; /* size of dt_cpp_argv[] array */
char *dt_ld_path; /* pathname of ld(1) to invoke if needed */
+#ifdef __FreeBSD__
+ char *dt_objcopy_path; /* pathname of objcopy(1) to invoke if needed */
+#endif
dt_list_t dt_lib_path; /* linked-list forming library search path */
uint_t dt_lazyload; /* boolean: set via -xlazyload */
uint_t dt_droptags; /* boolean: set via -xdroptags */
@@ -296,7 +299,7 @@ struct dtrace_hdl {
int dt_version; /* library version requested by client */
int dt_ctferr; /* error resulting from last CTF failure */
int dt_errno; /* error resulting from last failed operation */
-#if !defined(sun)
+#ifndef illumos
const char *dt_errfile;
int dt_errline;
#endif
@@ -305,7 +308,7 @@ struct dtrace_hdl {
int dt_fterr; /* saved errno from failed open of dt_ftfd */
int dt_cdefs_fd; /* file descriptor for C CTF debugging cache */
int dt_ddefs_fd; /* file descriptor for D CTF debugging cache */
-#if defined(sun)
+#ifdef illumos
int dt_stdout_fd; /* file descriptor for saved stdout */
#else
FILE *dt_freopen_fp; /* file pointer for freopened stdout */
@@ -596,7 +599,7 @@ extern int dt_version_defined(dt_version_t);
extern char *dt_cpp_add_arg(dtrace_hdl_t *, const char *);
extern char *dt_cpp_pop_arg(dtrace_hdl_t *);
-#if defined(sun)
+#ifdef illumos
extern int dt_set_errno(dtrace_hdl_t *, int);
#else
int _dt_set_errno(dtrace_hdl_t *, int, const char *, int);
@@ -606,7 +609,7 @@ void dt_get_errloc(dtrace_hdl_t *, const char **, int *);
extern void dt_set_errmsg(dtrace_hdl_t *, const char *, const char *,
const char *, int, const char *, va_list);
-#if defined(sun)
+#ifdef illumos
extern int dt_ioctl(dtrace_hdl_t *, int, void *);
#else
extern int dt_ioctl(dtrace_hdl_t *, u_long, void *);
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l
index 032d3034d67a..192e1e20d82c 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l
@@ -44,7 +44,7 @@
* We need to undefine lex's input and unput macros so that references to these
* call the functions provided at the end of this source file.
*/
-#if defined(sun)
+#ifdef illumos
#undef input
#undef unput
#else
@@ -79,7 +79,7 @@
#endif
static int id_or_type(const char *);
-#if defined(sun)
+#ifdef illumos
static int input(void);
static void unput(int);
#endif
@@ -740,9 +740,10 @@ yyinit(dt_pcb_t *pcb)
yypcb = pcb;
yylineno = 1;
yypragma = NULL;
-#if defined(sun)
+#ifdef illumos
yysptr = yysbuf;
#endif
+ YY_FLUSH_BUFFER;
}
/*
@@ -838,7 +839,7 @@ id_or_type(const char *s)
return (ttok);
}
-#if defined(sun)
+#ifdef illumos
static int
input(void)
{
@@ -880,4 +881,4 @@ unput(int c)
*yysptr++ = c;
yytchar = c;
}
-#endif
+#endif /* illumos */
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
index 597fef47f982..f9b9625d6af6 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
@@ -30,7 +30,7 @@
#include <elf.h>
#include <sys/types.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/sysmacros.h>
#else
#define P2ROUNDUP(x, align) (-(-(x) & -(align)))
@@ -38,7 +38,7 @@
#include <unistd.h>
#include <strings.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <limits.h>
@@ -47,7 +47,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
-#if defined(sun)
+#ifdef illumos
#include <wait.h>
#else
#include <sys/wait.h>
@@ -281,7 +281,11 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
sym->st_value = 0;
sym->st_size = dof->dofh_filesz;
sym->st_info = ELF32_ST_INFO(STB_GLOBAL, STT_OBJECT);
+#ifdef illumos
sym->st_other = 0;
+#else
+ sym->st_other = ELF32_ST_VISIBILITY(STV_HIDDEN);
+#endif
sym->st_shndx = ESHDR_DOF;
sym++;
@@ -322,7 +326,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep)
char *strtab;
int i, j, nrel;
size_t strtabsz = 1;
-#if defined(sun)
+#ifdef illumos
uint32_t count = 0;
#else
uint64_t count = 0;
@@ -434,7 +438,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep)
#elif defined(__i386) || defined(__amd64)
rel->r_offset = s->dofs_offset +
dofr[j].dofr_offset;
-#if defined(sun)
+#ifdef illumos
rel->r_info = ELF64_R_INFO(count + dep->de_global,
R_AMD64_64);
#else
@@ -471,7 +475,11 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep)
sym->st_value = 0;
sym->st_size = dof->dofh_filesz;
sym->st_info = GELF_ST_INFO(STB_GLOBAL, STT_OBJECT);
+#ifdef illumos
sym->st_other = 0;
+#else
+ sym->st_other = ELF64_ST_VISIBILITY(STV_HIDDEN);
+#endif
sym->st_shndx = ESHDR_DOF;
sym++;
@@ -685,8 +693,8 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd)
elf_file.ehdr.e_machine = EM_ARM;
#elif defined(__mips__)
elf_file.ehdr.e_machine = EM_MIPS;
-#elif defined(__powerpc__)
- elf_file.ehdr.e_machine = EM_PPC;
+#elif defined(__powerpc64__)
+ elf_file.ehdr.e_machine = EM_PPC64;
#elif defined(__sparc)
elf_file.ehdr.e_machine = EM_SPARCV9;
#elif defined(__i386) || defined(__amd64)
@@ -711,11 +719,7 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd)
shp = &elf_file.shdr[ESHDR_DOF];
shp->sh_name = 11; /* DTRACE_SHSTRTAB64[11] = ".SUNW_dof" */
-#if defined(sun)
shp->sh_flags = SHF_ALLOC;
-#else
- shp->sh_flags = SHF_WRITE | SHF_ALLOC;
-#endif
shp->sh_type = SHT_SUNW_dof;
shp->sh_offset = off;
shp->sh_size = dof->dofh_filesz;
@@ -784,21 +788,32 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd)
static int
dt_symtab_lookup(Elf_Data *data_sym, int nsym, uintptr_t addr, uint_t shn,
- GElf_Sym *sym)
+ GElf_Sym *sym, int uses_funcdesc, Elf *elf)
{
int i, ret = -1;
+ Elf64_Addr symval;
+ Elf_Scn *opd_scn;
+ Elf_Data *opd_desc;
GElf_Sym s;
for (i = 0; i < nsym && gelf_getsym(data_sym, i, sym) != NULL; i++) {
- if (GELF_ST_TYPE(sym->st_info) == STT_FUNC &&
- shn == sym->st_shndx &&
- sym->st_value <= addr &&
- addr < sym->st_value + sym->st_size) {
- if (GELF_ST_BIND(sym->st_info) == STB_GLOBAL)
- return (0);
-
- ret = 0;
- s = *sym;
+ if (GELF_ST_TYPE(sym->st_info) == STT_FUNC) {
+ symval = sym->st_value;
+ if (uses_funcdesc) {
+ opd_scn = elf_getscn(elf, sym->st_shndx);
+ opd_desc = elf_rawdata(opd_scn, NULL);
+ symval =
+ *(uint64_t*)((char *)opd_desc->d_buf + symval);
+ }
+ if ((uses_funcdesc || shn == sym->st_shndx) &&
+ symval <= addr &&
+ addr < symval + sym->st_size) {
+ if (GELF_ST_BIND(sym->st_info) == STB_GLOBAL)
+ return (0);
+
+ ret = 0;
+ s = *sym;
+ }
}
}
@@ -1375,7 +1390,8 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
continue;
if (dt_symtab_lookup(data_sym, isym, rela.r_offset,
- shdr_rel.sh_info, &fsym) != 0) {
+ shdr_rel.sh_info, &fsym,
+ (emachine1 == EM_PPC64), elf) != 0) {
dt_strtab_destroy(strtab);
goto err;
}
@@ -1536,7 +1552,8 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
p = strhyphenate(p + 3); /* strlen("___") */
if (dt_symtab_lookup(data_sym, isym, rela.r_offset,
- shdr_rel.sh_info, &fsym) != 0)
+ shdr_rel.sh_info, &fsym,
+ (emachine1 == EM_PPC64), elf) != 0)
goto err;
if (fsym.st_name > data_str->d_size)
@@ -1600,7 +1617,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
return (dt_link_error(dtp, elf, fd, bufs,
"failed to allocate space for probe"));
}
-#if !defined(sun)
+#ifndef illumos
/*
* Our linker doesn't understand the SUNW_IGNORE ndx and
* will try to use this relocation when we build the
@@ -1634,7 +1651,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
* already been processed by an earlier link
* invocation.
*/
-#if !defined(sun)
+#ifndef illumos
#define SHN_SUNW_IGNORE SHN_ABS
#endif
if (rsym.st_shndx != SHN_SUNW_IGNORE) {
@@ -1650,7 +1667,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
(void) elf_end(elf);
(void) close(fd);
-#if !defined(sun)
+#ifndef illumos
if (nsym > 0)
#endif
while ((pair = bufs) != NULL) {
@@ -1671,7 +1688,7 @@ int
dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
const char *file, int objc, char *const objv[])
{
-#if !defined(sun)
+#ifndef illumos
char tfile[PATH_MAX];
#endif
char drti[PATH_MAX];
@@ -1681,7 +1698,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
size_t len;
int eprobes = 0, ret = 0;
-#if !defined(sun)
+#ifndef illumos
if (access(file, R_OK) == 0) {
fprintf(stderr, "dtrace: target object (%s) already exists. "
"Please remove the target\ndtrace: object and rebuild all "
@@ -1757,7 +1774,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
if ((dof = dtrace_dof_create(dtp, pgp, dflags)) == NULL)
return (-1); /* errno is set for us */
-#if defined(sun)
+#ifdef illumos
/*
* Create a temporary file and then unlink it if we're going to
* combine it with drti.o later. We can still refer to it in child
@@ -1769,7 +1786,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
}
#else
snprintf(tfile, sizeof(tfile), "%s.XXXXXX", file);
- if ((fd = mkstemp(tfile)) == -1)
+ if ((fd = mkostemp(tfile, O_CLOEXEC)) == -1)
return (dt_link_error(dtp, NULL, -1, NULL,
"failed to create temporary file %s: %s",
tfile, strerror(errno)));
@@ -1803,7 +1820,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
}
-#if defined(sun)
+#ifdef illumos
if (!dtp->dt_lazyload)
(void) unlink(file);
#endif
@@ -1813,7 +1830,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
else
status = dump_elf32(dtp, dof, fd);
-#if defined(sun)
+#ifdef illumos
if (status != 0 || lseek(fd, 0, SEEK_SET) != 0) {
return (dt_link_error(dtp, NULL, -1, NULL,
"failed to write %s: %s", file, strerror(errno)));
@@ -1826,7 +1843,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
#endif
if (!dtp->dt_lazyload) {
-#if defined(sun)
+#ifdef illumos
const char *fmt = "%s -o %s -r -Blocal -Breduce /dev/fd/%d %s";
if (dtp->dt_oflags & DTRACE_O_LP64) {
@@ -1845,23 +1862,9 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
(void) snprintf(cmd, len, fmt, dtp->dt_ld_path, file, fd, drti);
#else
const char *fmt = "%s -o %s -r %s %s";
+ dt_dirpath_t *dp = dt_list_next(&dtp->dt_lib_path);
-#if defined(__amd64__)
- /*
- * Arches which default to 64-bit need to explicitly use
- * the 32-bit library path.
- */
- int use_32 = (dtp->dt_oflags & DTRACE_O_ILP32);
-#else
- /*
- * Arches which are 32-bit only just use the normal
- * library path.
- */
- int use_32 = 0;
-#endif
-
- (void) snprintf(drti, sizeof (drti), "/usr/lib%s/dtrace/drti.o",
- use_32 ? "32":"");
+ (void) snprintf(drti, sizeof (drti), "%s/drti.o", dp->dir_path);
len = snprintf(&tmp, 1, fmt, dtp->dt_ld_path, file, tfile,
drti) + 1;
@@ -1872,35 +1875,79 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
drti);
#endif
if ((status = system(cmd)) == -1) {
- ret = dt_link_error(dtp, NULL, -1, NULL,
+ ret = dt_link_error(dtp, NULL, fd, NULL,
"failed to run %s: %s", dtp->dt_ld_path,
strerror(errno));
goto done;
}
if (WIFSIGNALED(status)) {
- ret = dt_link_error(dtp, NULL, -1, NULL,
+ ret = dt_link_error(dtp, NULL, fd, NULL,
"failed to link %s: %s failed due to signal %d",
file, dtp->dt_ld_path, WTERMSIG(status));
goto done;
}
if (WEXITSTATUS(status) != 0) {
- ret = dt_link_error(dtp, NULL, -1, NULL,
+ ret = dt_link_error(dtp, NULL, fd, NULL,
"failed to link %s: %s exited with status %d\n",
file, dtp->dt_ld_path, WEXITSTATUS(status));
goto done;
}
(void) close(fd); /* release temporary file */
+
+#ifdef __FreeBSD__
+ /*
+ * Now that we've linked drti.o, reduce the global __SUNW_dof
+ * symbol to a local symbol. This is needed to so that multiple
+ * generated object files (for different providers, for
+ * instance) can be linked together. This is accomplished using
+ * the -Blocal flag with Sun's linker, but GNU ld doesn't appear
+ * to have an equivalent option.
+ */
+ asprintf(&cmd, "%s --localize-hidden %s", dtp->dt_objcopy_path,
+ file);
+ if ((status = system(cmd)) == -1) {
+ ret = dt_link_error(dtp, NULL, -1, NULL,
+ "failed to run %s: %s", dtp->dt_objcopy_path,
+ strerror(errno));
+ free(cmd);
+ goto done;
+ }
+ free(cmd);
+
+ if (WIFSIGNALED(status)) {
+ ret = dt_link_error(dtp, NULL, -1, NULL,
+ "failed to link %s: %s failed due to signal %d",
+ file, dtp->dt_objcopy_path, WTERMSIG(status));
+ goto done;
+ }
+
+ if (WEXITSTATUS(status) != 0) {
+ ret = dt_link_error(dtp, NULL, -1, NULL,
+ "failed to link %s: %s exited with status %d\n",
+ file, dtp->dt_objcopy_path, WEXITSTATUS(status));
+ goto done;
+ }
+#endif
} else {
+#ifdef __FreeBSD__
+ if (rename(tfile, file) != 0) {
+ ret = dt_link_error(dtp, NULL, fd, NULL,
+ "failed to rename %s to %s: %s", tfile, file,
+ strerror(errno));
+ goto done;
+ }
+#endif
(void) close(fd);
}
done:
dtrace_dof_destroy(dtp, dof);
-#if !defined(sun)
- unlink(tfile);
+#ifdef __FreeBSD__
+ if (!dtp->dt_lazyload)
+ (void) unlink(tfile);
#endif
return (ret);
}
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c
index 6ab7cd9619c3..20081edfe75a 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c
@@ -156,7 +156,7 @@ dt_epid_add(dtrace_hdl_t *dtp, dtrace_epid_t id)
enabled->dtepd_epid = id;
enabled->dtepd_nrecs = 1;
-#if defined(sun)
+#ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled) == -1) {
#else
if (dt_ioctl(dtp, DTRACEIOC_EPROBE, &enabled) == -1) {
@@ -180,7 +180,7 @@ dt_epid_add(dtrace_hdl_t *dtp, dtrace_epid_t id)
if ((enabled = nenabled) == NULL)
return (dt_set_errno(dtp, EDT_NOMEM));
-#if defined(sun)
+#ifdef illumos
rval = dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled);
#else
rval = dt_ioctl(dtp, DTRACEIOC_EPROBE, &enabled);
@@ -356,7 +356,7 @@ dt_aggid_add(dtrace_hdl_t *dtp, dtrace_aggid_t id)
agg->dtagd_id = id;
agg->dtagd_nrecs = 1;
-#if defined(sun)
+#ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg) == -1) {
#else
if (dt_ioctl(dtp, DTRACEIOC_AGGDESC, &agg) == -1) {
@@ -379,7 +379,7 @@ dt_aggid_add(dtrace_hdl_t *dtp, dtrace_aggid_t id)
if ((agg = nagg) == NULL)
return (dt_set_errno(dtp, EDT_NOMEM));
-#if defined(sun)
+#ifdef illumos
rval = dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg);
#else
rval = dt_ioctl(dtp, DTRACEIOC_AGGDESC, &agg);
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c
index e3905c1ff45a..b3fe51669cc0 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c
@@ -27,7 +27,7 @@
*/
#include <sys/types.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/modctl.h>
#include <sys/kobj.h>
#include <sys/kobj_impl.h>
@@ -41,7 +41,7 @@
#endif
#include <unistd.h>
-#if defined(sun)
+#ifdef illumos
#include <project.h>
#endif
#include <strings.h>
@@ -51,7 +51,7 @@
#include <assert.h>
#include <errno.h>
#include <dirent.h>
-#if !defined(sun)
+#ifndef illumos
#include <fcntl.h>
#include <libproc_compat.h>
#endif
@@ -572,7 +572,7 @@ dt_module_load_sect(dtrace_hdl_t *dtp, dt_module_t *dmp, ctf_sect_t *ctsp)
if (sp == NULL || (dp = elf_getdata(sp, NULL)) == NULL)
return (0);
-#if defined(sun)
+#ifdef illumos
ctsp->cts_data = dp->d_buf;
#else
if ((ctsp->cts_data = malloc(dp->d_size)) == NULL)
@@ -921,7 +921,7 @@ dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp)
ctf_close(dmp->dm_ctfp);
dmp->dm_ctfp = NULL;
-#if !defined(sun)
+#ifndef illumos
if (dmp->dm_ctdata.cts_data != NULL) {
free(dmp->dm_ctdata.cts_data);
}
@@ -1115,7 +1115,7 @@ dt_module_getctflib(dtrace_hdl_t *dtp, dt_module_t *dmp, const char *name)
* including the path.
*/
static void
-#if defined(sun)
+#ifdef illumos
dt_module_update(dtrace_hdl_t *dtp, const char *name)
#else
dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
@@ -1132,7 +1132,7 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
Elf_Data *dp;
Elf_Scn *sp;
-#if defined(sun)
+#ifdef illumos
(void) snprintf(fname, sizeof (fname),
"%s/%s/object", OBJFS_ROOT, name);
#else
@@ -1211,13 +1211,13 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
#if defined(__FreeBSD__)
if (sh.sh_size == 0)
continue;
- if (is_elf_obj && (sh.sh_type == SHT_PROGBITS ||
- sh.sh_type == SHT_NOBITS)) {
+ if (sh.sh_type == SHT_PROGBITS || sh.sh_type == SHT_NOBITS) {
alignmask = sh.sh_addralign - 1;
mapbase += alignmask;
mapbase &= ~alignmask;
sh.sh_addr = mapbase;
- dmp->dm_sec_offsets[elf_ndxscn(sp)] = sh.sh_addr;
+ if (is_elf_obj)
+ dmp->dm_sec_offsets[elf_ndxscn(sp)] = sh.sh_addr;
mapbase += sh.sh_size;
}
#endif
@@ -1242,7 +1242,7 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
}
dmp->dm_flags |= DT_DM_KERNEL;
-#if defined(sun)
+#ifdef illumos
dmp->dm_modid = (int)OBJFS_MODID(st.st_ino);
#else
/*
@@ -1265,7 +1265,7 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
}
}
#endif
-#endif
+#endif /* illumos */
if (dmp->dm_info.objfs_info_primary)
dmp->dm_flags |= DT_DM_PRIMARY;
@@ -1291,7 +1291,7 @@ dtrace_update(dtrace_hdl_t *dtp)
dmp != NULL; dmp = dt_list_next(dmp))
dt_module_unload(dtp, dmp);
-#if defined(sun)
+#ifdef illumos
/*
* Open /system/object and attempt to create a libdtrace module for
* each kernel module that is loaded on the current system.
@@ -1331,11 +1331,11 @@ dtrace_update(dtrace_hdl_t *dtp)
dt_idhash_lookup(dtp->dt_macros, "pid")->di_id = getpid();
dt_idhash_lookup(dtp->dt_macros, "pgid")->di_id = getpgid(0);
dt_idhash_lookup(dtp->dt_macros, "ppid")->di_id = getppid();
-#if defined(sun)
+#ifdef illumos
dt_idhash_lookup(dtp->dt_macros, "projid")->di_id = getprojid();
#endif
dt_idhash_lookup(dtp->dt_macros, "sid")->di_id = getsid(0);
-#if defined(sun)
+#ifdef illumos
dt_idhash_lookup(dtp->dt_macros, "taskid")->di_id = gettaskid();
#endif
dt_idhash_lookup(dtp->dt_macros, "uid")->di_id = getuid();
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
index 0eb2a2cdcc2f..80e4be9a32d9 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
@@ -26,11 +26,10 @@
*/
#include <sys/types.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/modctl.h>
#include <sys/systeminfo.h>
#else
-/* FreeBSD */
#include <sys/param.h>
#include <sys/module.h>
#include <sys/linker.h>
@@ -39,7 +38,7 @@
#include <libelf.h>
#include <strings.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <limits.h>
@@ -60,7 +59,7 @@
#include <dt_printf.h>
#include <dt_string.h>
#include <dt_provider.h>
-#if !defined(sun)
+#ifndef illumos
#include <sys/sysctl.h>
#include <string.h>
#endif
@@ -164,7 +163,7 @@ const dt_version_t _dtrace_versions[] = {
/*
* Global variables that are formatted on FreeBSD based on the kernel file name.
*/
-#if !defined(sun)
+#ifndef illumos
static char curthread_str[MAXPATHLEN];
static char intmtx_str[MAXPATHLEN];
static char threadmtx_str[MAXPATHLEN];
@@ -246,7 +245,7 @@ static const dt_ident_t _dtrace_globals[] = {
{ "curthread", DT_IDENT_SCALAR, 0, DIF_VAR_CURTHREAD,
{ DTRACE_STABILITY_STABLE, DTRACE_STABILITY_PRIVATE,
DTRACE_CLASS_COMMON }, DT_VERS_1_0,
-#if defined(sun)
+#ifdef illumos
&dt_idops_type, "genunix`kthread_t *" },
#else
&dt_idops_type, curthread_str },
@@ -297,13 +296,13 @@ static const dt_ident_t _dtrace_globals[] = {
{ "index", DT_IDENT_FUNC, 0, DIF_SUBR_INDEX, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "int(const char *, const char *, [int])" },
{ "inet_ntoa", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA, DT_ATTR_STABCMN,
-#if defined(sun)
+#ifdef illumos
DT_VERS_1_5, &dt_idops_func, "string(ipaddr_t *)" },
#else
DT_VERS_1_5, &dt_idops_func, "string(in_addr_t *)" },
#endif
{ "inet_ntoa6", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA6, DT_ATTR_STABCMN,
-#if defined(sun)
+#ifdef illumos
DT_VERS_1_5, &dt_idops_func, "string(in6_addr_t *)" },
#else
DT_VERS_1_5, &dt_idops_func, "string(struct in6_addr *)" },
@@ -328,7 +327,7 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "void(@)" },
{ "memref", DT_IDENT_FUNC, 0, DIF_SUBR_MEMREF, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "uintptr_t *(void *, size_t)" },
-#if !defined(sun)
+#ifndef illumos
{ "memstr", DT_IDENT_FUNC, 0, DIF_SUBR_MEMSTR, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "string(void *, char, size_t)" },
#endif
@@ -342,7 +341,7 @@ static const dt_ident_t _dtrace_globals[] = {
{ "msgsize", DT_IDENT_FUNC, 0, DIF_SUBR_MSGSIZE,
DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "size_t(mblk_t *)" },
-#if defined(sun)
+#ifdef illumos
{ "mutex_owned", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_OWNED,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "int(genunix`kmutex_t *)" },
@@ -413,7 +412,7 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "int()" },
{ "rindex", DT_IDENT_FUNC, 0, DIF_SUBR_RINDEX, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "int(const char *, const char *, [int])" },
-#if defined(sun)
+#ifdef illumos
{ "rw_iswriter", DT_IDENT_FUNC, 0, DIF_SUBR_RW_ISWRITER,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "int(genunix`krwlock_t *)" },
@@ -471,7 +470,7 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "string(const char *, int, [int])" },
{ "sum", DT_IDENT_AGGFUNC, 0, DTRACEAGG_SUM, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "void(@)" },
-#if !defined(sun)
+#ifndef illumos
{ "sx_isexclusive", DT_IDENT_FUNC, 0, DIF_SUBR_SX_ISEXCLUSIVE,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, sxlock_str },
@@ -531,12 +530,12 @@ static const dt_ident_t _dtrace_globals[] = {
{ "walltimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_WALLTIMESTAMP,
DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "int64_t" },
-#if defined(sun)
+#ifdef illumos
{ "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME,
DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
#endif
-#if !defined(sun)
+#ifndef illumos
{ "cpu", DT_IDENT_SCALAR, 0, DIF_VAR_CPU,
DT_ATTR_STABCMN, DT_VERS_1_6_3, &dt_idops_type, "int" },
#endif
@@ -780,18 +779,20 @@ const dtrace_pattr_t _dtrace_prvdesc = {
{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_COMMON },
};
-#if defined(sun)
+#ifdef illumos
const char *_dtrace_defcpp = "/usr/ccs/lib/cpp"; /* default cpp(1) to invoke */
const char *_dtrace_defld = "/usr/ccs/bin/ld"; /* default ld(1) to invoke */
#else
const char *_dtrace_defcpp = "cpp"; /* default cpp(1) to invoke */
const char *_dtrace_defld = "ld"; /* default ld(1) to invoke */
+const char *_dtrace_defobjcopy = "objcopy"; /* default objcopy(1) to invoke */
#endif
const char *_dtrace_libdir = "/usr/lib/dtrace"; /* default library directory */
-#if defined(sun)
+#ifdef illumos
const char *_dtrace_provdir = "/dev/dtrace/provider"; /* provider directory */
#else
+const char *_dtrace_libdir32 = "/usr/lib32/dtrace";
const char *_dtrace_provdir = "/dev/dtrace"; /* provider directory */
#endif
@@ -814,7 +815,7 @@ typedef struct dt_fdlist {
uint_t df_size; /* size of df_fds[] */
} dt_fdlist_t;
-#if defined(sun)
+#ifdef illumos
#pragma init(_dtrace_init)
#else
void _dtrace_init(void) __attribute__ ((constructor));
@@ -850,7 +851,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
dt_provmod_t *prov;
char path[PATH_MAX];
int fd;
-#if defined(sun)
+#ifdef illumos
struct dirent *dp, *ep;
DIR *dirp;
@@ -897,7 +898,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
}
(void) closedir(dirp);
-#else
+#else /* !illumos */
char *p;
char *p1;
char *p_providers = NULL;
@@ -982,7 +983,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
}
if (p_providers != NULL)
free(p_providers);
-#endif
+#endif /* illumos */
}
static void
@@ -999,7 +1000,7 @@ dt_provmod_destroy(dt_provmod_t **provmod)
*provmod = NULL;
}
-#if defined(sun)
+#ifdef illumos
static const char *
dt_get_sysinfo(int cmd, char *buf, size_t len)
{
@@ -1112,7 +1113,7 @@ dt_vopen(int version, int flags, int *errp,
err = errno;
}
#endif
-#if defined(sun)
+#ifdef illumos
ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR);
#else
ftfd = open("/dev/dtrace/fasttrap", O_RDWR);
@@ -1154,7 +1155,7 @@ alloc:
bzero(dtp, sizeof (dtrace_hdl_t));
dtp->dt_oflags = flags;
-#if defined(sun)
+#ifdef illumos
dtp->dt_prcmode = DT_PROC_STOP_PREINIT;
#else
dtp->dt_prcmode = DT_PROC_STOP_POSTINIT;
@@ -1170,7 +1171,7 @@ alloc:
dtp->dt_fterr = fterr;
dtp->dt_cdefs_fd = -1;
dtp->dt_ddefs_fd = -1;
-#if defined(sun)
+#ifdef illumos
dtp->dt_stdout_fd = -1;
#else
dtp->dt_freopen_fp = NULL;
@@ -1186,6 +1187,9 @@ alloc:
dtp->dt_cpp_argc = 1;
dtp->dt_cpp_args = 1;
dtp->dt_ld_path = strdup(_dtrace_defld);
+#ifdef __FreeBSD__
+ dtp->dt_objcopy_path = strdup(_dtrace_defobjcopy);
+#endif
dtp->dt_provmod = provmod;
dtp->dt_vector = vector;
dtp->dt_varg = arg;
@@ -1194,6 +1198,9 @@ alloc:
if (dtp->dt_mods == NULL || dtp->dt_provs == NULL ||
dtp->dt_procs == NULL || dtp->dt_ld_path == NULL ||
+#ifdef __FreeBSD__
+ dtp->dt_objcopy_path == NULL ||
+#endif
dtp->dt_cpp_path == NULL || dtp->dt_cpp_argv == NULL)
return (set_open_errno(dtp, errp, EDT_NOMEM));
@@ -1202,7 +1209,7 @@ alloc:
dtp->dt_cpp_argv[0] = (char *)strbasename(dtp->dt_cpp_path);
-#if defined(sun)
+#ifdef illumos
(void) snprintf(isadef, sizeof (isadef), "-D__SUNW_D_%u",
(uint_t)(sizeof (void *) * NBBY));
@@ -1242,7 +1249,7 @@ alloc:
return (set_open_errno(dtp, errp, EDT_NOMEM));
#endif
-#if defined(sun)
+#ifdef illumos
#ifdef __x86
/*
* On x86 systems, __i386 is defined for <sys/isa_defs.h> for 32-bit
@@ -1282,7 +1289,7 @@ alloc:
* 'kern.bootfile' sysctl value tells us exactly which file is being
* used as the kernel.
*/
-#if !defined(sun)
+#ifndef illumos
{
char bootfile[MAXPATHLEN];
char *p;
@@ -1575,8 +1582,19 @@ alloc:
* compile, and to provide better error reporting (because the full
* reporting of compiler errors requires dtrace_open() to succeed).
*/
+#ifdef __FreeBSD__
+#ifdef __LP64__
+ if ((dtp->dt_oflags & DTRACE_O_ILP32) != 0) {
+ if (dtrace_setopt(dtp, "libdir", _dtrace_libdir32) != 0)
+ return (set_open_errno(dtp, errp, dtp->dt_errno));
+ }
+#endif
+ if (dtrace_setopt(dtp, "libdir", _dtrace_libdir) != 0)
+ return (set_open_errno(dtp, errp, dtp->dt_errno));
+#else
if (dtrace_setopt(dtp, "libdir", _dtrace_libdir) != 0)
return (set_open_errno(dtp, errp, dtp->dt_errno));
+#endif
return (dtp);
}
@@ -1644,7 +1662,7 @@ dtrace_close(dtrace_hdl_t *dtp)
(void) close(dtp->dt_cdefs_fd);
if (dtp->dt_ddefs_fd != -1)
(void) close(dtp->dt_ddefs_fd);
-#if defined(sun)
+#ifdef illumos
if (dtp->dt_stdout_fd != -1)
(void) close(dtp->dt_stdout_fd);
#else
@@ -1674,6 +1692,9 @@ dtrace_close(dtrace_hdl_t *dtp)
free(dtp->dt_cpp_argv);
free(dtp->dt_cpp_path);
free(dtp->dt_ld_path);
+#ifdef __FreeBSD__
+ free(dtp->dt_objcopy_path);
+#endif
free(dtp->dt_mods);
free(dtp->dt_provs);
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c
index 832af888446a..758422e3407f 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c
@@ -38,7 +38,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <errno.h>
@@ -280,6 +280,28 @@ dt_opt_ld_path(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
return (0);
}
+#ifdef __FreeBSD__
+static int
+dt_opt_objcopy_path(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+ char *objcopy;
+
+ if (arg == NULL)
+ return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+ if (dtp->dt_pcb != NULL)
+ return (dt_set_errno(dtp, EDT_BADOPTCTX));
+
+ if ((objcopy = strdup(arg)) == NULL)
+ return (dt_set_errno(dtp, EDT_NOMEM));
+
+ free(dtp->dt_objcopy_path);
+ dtp->dt_objcopy_path = objcopy;
+
+ return (0);
+}
+#endif
+
/*ARGSUSED*/
static int
dt_opt_libdir(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
@@ -871,7 +893,7 @@ dt_options_load(dtrace_hdl_t *dtp)
bzero(&hdr, sizeof (dof_hdr_t));
hdr.dofh_loadsz = sizeof (dof_hdr_t);
-#if defined(sun)
+#ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &hdr) == -1)
#else
dof = &hdr;
@@ -889,7 +911,7 @@ dt_options_load(dtrace_hdl_t *dtp)
for (i = 0; i < DTRACEOPT_MAX; i++)
dtp->dt_options[i] = DTRACEOPT_UNSET;
-#if defined(sun)
+#ifdef illumos
if (dt_ioctl(dtp, DTRACEIOC_DOFGET, dof) == -1)
#else
if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &dof) == -1)
@@ -960,6 +982,9 @@ static const dt_option_t _dtrace_ctoptions[] = {
{ "linkmode", dt_opt_linkmode },
{ "linktype", dt_opt_linktype },
{ "nolibs", dt_opt_cflags, DTRACE_C_NOLIBS },
+#ifdef __FreeBSD__
+ { "objcopypath", dt_opt_objcopy_path },
+#endif
{ "pgmax", dt_opt_pgmax },
{ "pspec", dt_opt_cflags, DTRACE_C_PSPEC },
{ "setenv", dt_opt_setenv, 1 },
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c
index 6ce3dadd4e84..ee31cef5f28c 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c
@@ -102,7 +102,7 @@
#include <setjmp.h>
#include <strings.h>
#include <assert.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <stdlib.h>
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c
index 6c529e5e6033..c61a7106e239 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c
@@ -33,7 +33,7 @@
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <libgen.h>
@@ -44,10 +44,15 @@
#include <dt_program.h>
#include <dt_pid.h>
#include <dt_string.h>
-#if !defined(sun)
+#include <dt_module.h>
+
+#ifndef illumos
+#include <sys/sysctl.h>
+#include <unistd.h>
#include <libproc_compat.h>
+#include <libelf.h>
+#include <gelf.h>
#endif
-#include <dt_module.h>
typedef struct dt_pid_probe {
dtrace_hdl_t *dpp_dtp;
@@ -74,7 +79,7 @@ typedef struct dt_pid_probe {
static void
dt_pid_objname(char *buf, size_t len, Lmid_t lmid, const char *obj)
{
-#if defined(sun)
+#ifdef illumos
if (lmid == LM_ID_BASE)
(void) strncpy(buf, obj, len);
else
@@ -126,7 +131,7 @@ dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
int isdash = strcmp("-", func) == 0;
pid_t pid;
-#if defined(sun)
+#ifdef illumos
pid = Pstatus(pp->dpp_pr)->pr_pid;
#else
pid = proc_getpid(pp->dpp_pr);
@@ -270,7 +275,7 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
if (obj == NULL)
return (0);
-#if defined(sun)
+#ifdef illumos
(void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid);
#endif
@@ -279,7 +284,7 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
pp->dpp_obj = obj;
else
pp->dpp_obj++;
-#if defined(sun)
+#ifdef illumos
if (Pxlookup_by_name(pp->dpp_pr, pp->dpp_lmid, obj, ".stret1", &sym,
NULL) == 0)
pp->dpp_stret[0] = sym.st_value;
@@ -337,7 +342,7 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
GELF_ST_INFO(STB_LOCAL, STT_FUNC);
sym.st_other = 0;
sym.st_value = 0;
-#if defined(sun)
+#ifdef illumos
sym.st_size = Pstatus(pp->dpp_pr)->pr_dmodel ==
PR_MODEL_ILP32 ? -1U : -1ULL;
#else
@@ -404,7 +409,7 @@ dt_pid_mod_filt(void *arg, const prmap_t *pmp, const char *obj)
if (gmatch(obj, pp->dpp_mod))
return (dt_pid_per_mod(pp, pmp, obj));
-#if defined(sun)
+#ifdef illumos
(void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid);
#else
pp->dpp_lmid = 0;
@@ -418,7 +423,7 @@ dt_pid_mod_filt(void *arg, const prmap_t *pmp, const char *obj)
if (gmatch(pp->dpp_obj, pp->dpp_mod))
return (dt_pid_per_mod(pp, pmp, obj));
-#if defined(sun)
+#ifdef illumos
(void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid);
#endif
@@ -468,7 +473,7 @@ dt_pid_fix_mod(dtrace_probedesc_t *pdp, struct ps_prochandle *P)
else
obj++;
-#if defined(sun)
+#ifdef illumos
(void) Plmid(P, pmp->pr_vaddr, &lmid);
#endif
@@ -566,6 +571,12 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname)
prsyminfo_t sip;
dof_helper_t dh;
GElf_Half e_type;
+#ifdef __FreeBSD__
+ dof_hdr_t hdr;
+ size_t sz;
+ uint64_t dofmax;
+ void *dof;
+#endif
const char *mname;
const char *syms[] = { "___SUNW_dof", "__SUNW_dof" };
int i, fd = -1;
@@ -595,17 +606,61 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname)
continue;
}
- dh.dofhp_dof = sym.st_value;
+#ifdef __FreeBSD__
dh.dofhp_addr = (e_type == ET_EXEC) ? 0 : pmp->pr_vaddr;
+ if (Pread(P, &hdr, sizeof (hdr), sym.st_value) !=
+ sizeof (hdr)) {
+ dt_dprintf("read of DOF header failed\n");
+ continue;
+ }
+
+ sz = sizeof(dofmax);
+ if (sysctlbyname("kern.dtrace.dof_maxsize", &dofmax, &sz,
+ NULL, 0) != 0) {
+ dt_dprintf("failed to read dof_maxsize: %s\n",
+ strerror(errno));
+ continue;
+ }
+ if (dofmax < hdr.dofh_loadsz) {
+ dt_dprintf("DOF load size exceeds maximum\n");
+ continue;
+ }
+
+ if ((dof = malloc(hdr.dofh_loadsz)) == NULL)
+ return (-1);
+
+ if (Pread(P, dof, hdr.dofh_loadsz, sym.st_value) !=
+ hdr.dofh_loadsz) {
+ free(dof);
+ dt_dprintf("read of DOF section failed\n");
+ continue;
+ }
+
+ dh.dofhp_dof = (uintptr_t)dof;
+ dh.dofhp_pid = proc_getpid(P);
dt_pid_objname(dh.dofhp_mod, sizeof (dh.dofhp_mod),
-#if defined(sun)
sip.prs_lmid, mname);
+
+ if (fd == -1 &&
+ (fd = open("/dev/dtrace/helper", O_RDWR, 0)) < 0) {
+ dt_dprintf("open of helper device failed: %s\n",
+ strerror(errno));
+ free(dof);
+ return (-1); /* errno is set for us */
+ }
+
+ if (ioctl(fd, DTRACEHIOC_ADDDOF, &dh, sizeof (dh)) < 0)
+ dt_dprintf("DOF was rejected for %s\n", dh.dofhp_mod);
+
+ free(dof);
#else
- 0, mname);
-#endif
+ dh.dofhp_dof = sym.st_value;
+ dh.dofhp_addr = (e_type == ET_EXEC) ? 0 : pmp->pr_vaddr;
+
+ dt_pid_objname(dh.dofhp_mod, sizeof (dh.dofhp_mod),
+ sip.prs_lmid, mname);
-#if defined(sun)
if (fd == -1 &&
(fd = pr_open(P, "/dev/dtrace/helper", O_RDWR, 0)) < 0) {
dt_dprintf("pr_open of helper device failed: %s\n",
@@ -618,8 +673,10 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname)
#endif
}
-#if defined(sun)
if (fd != -1)
+#ifdef __FreeBSD__
+ (void) close(fd);
+#else
(void) pr_close(P, fd);
#endif
@@ -634,21 +691,17 @@ dt_pid_create_usdt_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
int ret = 0;
assert(DT_MUTEX_HELD(&dpr->dpr_lock));
-#if defined(sun)
(void) Pupdate_maps(P);
if (Pobject_iter(P, dt_pid_usdt_mapping, P) != 0) {
ret = -1;
(void) dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_USDT,
"failed to instantiate probes for pid %d: %s",
-#if defined(sun)
+#ifdef illumos
(int)Pstatus(P)->pr_pid, strerror(errno));
#else
(int)proc_getpid(P), strerror(errno));
#endif
}
-#else
- ret = 0;
-#endif
/*
* Put the module name in its canonical form.
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
index 7f49f640a944..bd0d708bde5a 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
@@ -28,7 +28,7 @@
#include <assert.h>
#include <strings.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <fcntl.h>
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c
index eeb8735f6f05..ae26d55ba8be 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c
@@ -25,7 +25,7 @@
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
-#if defined(sun)
+#ifdef illumos
#include <sys/sysmacros.h>
#else
#define ABS(a) ((a) < 0 ? -(a) : (a))
@@ -33,7 +33,7 @@
#include <string.h>
#include <strings.h>
#include <stdlib.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <assert.h>
@@ -467,7 +467,7 @@ pfprint_time(dtrace_hdl_t *dtp, FILE *fp, const char *format,
* Below, we turn this into the canonical adb/mdb /[yY] format,
* "1973 Dec 3 17:20:00".
*/
-#if defined(sun)
+#ifdef illumos
(void) ctime_r(&sec, src, sizeof (src));
#else
(void) ctime_r(&sec, src);
@@ -518,7 +518,7 @@ pfprint_port(dtrace_hdl_t *dtp, FILE *fp, const char *format,
char buf[256];
struct servent *sv, res;
-#if defined(sun)
+#ifdef illumos
if ((sv = getservbyport_r(port, NULL, &res, buf, sizeof (buf))) != NULL)
#else
if (getservbyport_r(port, NULL, &res, buf, sizeof (buf), &sv) > 0)
@@ -544,7 +544,7 @@ pfprint_inetaddr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
s[size] = '\0';
if (strchr(s, ':') == NULL && inet_pton(AF_INET, s, inetaddr) != -1) {
-#if defined(sun)
+#ifdef illumos
if ((host = gethostbyaddr_r(inetaddr, NS_INADDRSZ,
AF_INET, &res, buf, sizeof (buf), &e)) != NULL)
#else
@@ -694,7 +694,7 @@ static const dt_pfconv_t _dtrace_conversions[] = {
{ "S", "s", pfproto_cstr, pfcheck_str, pfprint_estr },
{ "T", "s", "int64_t", pfcheck_time, pfprint_time822 },
{ "u", "u", pfproto_xint, pfcheck_xint, pfprint_uint },
-#if defined(sun)
+#ifdef illumos
{ "wc", "wc", "int", pfcheck_type, pfprint_sint }, /* a.k.a. wchar_t */
{ "ws", "ws", pfproto_wstr, pfcheck_wstr, pfprint_wstr },
#else
@@ -1657,7 +1657,7 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
if (rval == -1 || fp == NULL)
return (rval);
-#if defined(sun)
+#ifdef illumos
if (pfd->pfd_preflen != 0 &&
strcmp(pfd->pfd_prefix, DT_FREOPEN_RESTORE) == 0) {
/*
@@ -1739,7 +1739,7 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
}
(void) fclose(nfp);
-#else
+#else /* !illumos */
/*
* The 'standard output' (which is not necessarily stdout)
* treatment on FreeBSD is implemented differently than on
@@ -1814,7 +1814,7 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
/* Remember that the output has been redirected to the new file. */
dtp->dt_freopen_fp = nfp;
-#endif
+#endif /* illumos */
return (rval);
}
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
index d40a0ae1eb18..79c187140de9 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
@@ -77,7 +77,7 @@
*/
#include <sys/wait.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/lwp.h>
#endif
#include <strings.h>
@@ -89,7 +89,7 @@
#include <dt_pid.h>
#include <dt_impl.h>
-#if !defined(sun)
+#ifndef illumos
#include <sys/syscall.h>
#include <libproc_compat.h>
#define SYS_forksys SYS_fork
@@ -143,7 +143,7 @@ dt_proc_bpdestroy(dt_proc_t *dpr, int delbkpts)
static void
dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr)
{
-#if defined(sun)
+#ifdef illumos
const lwpstatus_t *psp = &Pstatus(dpr->dpr_proc)->pr_lwp;
#else
unsigned long pc;
@@ -152,14 +152,14 @@ dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr)
assert(DT_MUTEX_HELD(&dpr->dpr_lock));
-#if !defined(sun)
+#ifndef illumos
proc_regget(dpr->dpr_proc, REG_PC, &pc);
proc_bkptregadj(&pc);
#endif
for (dbp = dt_list_next(&dpr->dpr_bps);
dbp != NULL; dbp = dt_list_next(dbp)) {
-#if defined(sun)
+#ifdef illumos
if (psp->pr_reg[R_PC] == dbp->dbp_addr)
break;
#else
@@ -170,7 +170,7 @@ dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr)
if (dbp == NULL) {
dt_dprintf("pid %d: spurious breakpoint wakeup for %lx\n",
-#if defined(sun)
+#ifdef illumos
(int)dpr->dpr_pid, (ulong_t)psp->pr_reg[R_PC]);
#else
(int)dpr->dpr_pid, pc);
@@ -342,7 +342,7 @@ dt_proc_rdwatch(dt_proc_t *dpr, rd_event_e event, const char *evname)
}
(void) dt_proc_bpcreate(dpr, rdn.u.bptaddr,
-#if defined(sun)
+#ifdef illumos
(dt_bkpt_f *)dt_proc_rdevent, (void *)evname);
#else
/* XXX ugly */
@@ -357,7 +357,7 @@ dt_proc_rdwatch(dt_proc_t *dpr, rd_event_e event, const char *evname)
static void
dt_proc_attach(dt_proc_t *dpr, int exec)
{
-#if defined(sun)
+#ifdef illumos
const pstatus_t *psp = Pstatus(dpr->dpr_proc);
#endif
rd_err_e err;
@@ -366,23 +366,23 @@ dt_proc_attach(dt_proc_t *dpr, int exec)
assert(DT_MUTEX_HELD(&dpr->dpr_lock));
if (exec) {
-#if defined(sun)
+#ifdef illumos
if (psp->pr_lwp.pr_errno != 0)
return; /* exec failed: nothing needs to be done */
#endif
dt_proc_bpdestroy(dpr, B_FALSE);
-#if defined(sun)
+#ifdef illumos
Preset_maps(dpr->dpr_proc);
#endif
}
if ((dpr->dpr_rtld = Prd_agent(dpr->dpr_proc)) != NULL &&
(err = rd_event_enable(dpr->dpr_rtld, B_TRUE)) == RD_OK) {
-#if defined(sun)
+#ifdef illumos
dt_proc_rdwatch(dpr, RD_PREINIT, "RD_PREINIT");
#endif
dt_proc_rdwatch(dpr, RD_POSTINIT, "RD_POSTINIT");
-#if defined(sun)
+#ifdef illumos
dt_proc_rdwatch(dpr, RD_DLACTIVITY, "RD_DLACTIVITY");
#endif
} else {
@@ -507,7 +507,7 @@ dt_proc_control(void *arg)
struct ps_prochandle *P = dpr->dpr_proc;
int pid = dpr->dpr_pid;
-#if defined(sun)
+#ifdef illumos
int pfd = Pctlfd(P);
const long wstop = PCWSTOP;
@@ -529,7 +529,7 @@ dt_proc_control(void *arg)
*/
(void) pthread_mutex_lock(&dpr->dpr_lock);
-#if defined(sun)
+#ifdef illumos
(void) Punsetflags(P, PR_ASYNC); /* require synchronous mode */
(void) Psetflags(P, PR_BPTADJ); /* always adjust eip on x86 */
(void) Punsetflags(P, PR_FORK); /* do not inherit on fork */
@@ -562,7 +562,7 @@ dt_proc_control(void *arg)
* If PR_KLC is set, we created the process; otherwise we grabbed it.
* Check for an appropriate stop request and wait for dt_proc_continue.
*/
-#if defined(sun)
+#ifdef illumos
if (Pstatus(P)->pr_flags & PR_KLC)
#else
if (proc_getflags(P) & PR_KLC)
@@ -590,7 +590,7 @@ dt_proc_control(void *arg)
while (!dpr->dpr_quit) {
const lwpstatus_t *psp;
-#if defined(sun)
+#ifdef illumos
if (write(pfd, &wstop, sizeof (wstop)) == -1 && errno == EINTR)
continue; /* check dpr_quit and continue waiting */
#else
@@ -602,7 +602,7 @@ dt_proc_control(void *arg)
(void) pthread_mutex_lock(&dpr->dpr_lock);
-#if defined(sun)
+#ifdef illumos
pwait_locked:
if (Pstopstatus(P, PCNULL, 0) == -1 && errno == EINTR) {
(void) pthread_mutex_unlock(&dpr->dpr_lock);
@@ -612,7 +612,7 @@ pwait_locked:
switch (Pstate(P)) {
case PS_STOP:
-#if defined(sun)
+#ifdef illumos
psp = &Pstatus(P)->pr_lwp;
#else
psp = proc_getlwpstatus(P);
@@ -661,7 +661,7 @@ pwait_locked:
break;
case PS_LOST:
-#if defined(sun)
+#ifdef illumos
if (Preopen(P) == 0)
goto pwait_locked;
#endif
@@ -734,7 +734,7 @@ dt_proc_t *
dt_proc_lookup(dtrace_hdl_t *dtp, struct ps_prochandle *P, int remove)
{
dt_proc_hash_t *dph = dtp->dt_procs;
-#if defined(sun)
+#ifdef illumos
pid_t pid = Pstatus(P)->pr_pid;
#else
pid_t pid = proc_getpid(P);
@@ -772,14 +772,14 @@ dt_proc_destroy(dtrace_hdl_t *dtp, struct ps_prochandle *P)
* an external debugger and we were waiting in dt_proc_waitrun().
* Leave the process in this condition using PRELEASE_HANG.
*/
-#if defined(sun)
+#ifdef illumos
if (!(Pstatus(dpr->dpr_proc)->pr_flags & (PR_KLC | PR_RLC))) {
#else
if (!(proc_getflags(dpr->dpr_proc) & (PR_KLC | PR_RLC))) {
#endif
dt_dprintf("abandoning pid %d\n", (int)dpr->dpr_pid);
rflag = PRELEASE_HANG;
-#if defined(sun)
+#ifdef illumos
} else if (Pstatus(dpr->dpr_proc)->pr_flags & PR_KLC) {
#else
} else if (proc_getflags(dpr->dpr_proc) & PR_KLC) {
@@ -808,7 +808,7 @@ dt_proc_destroy(dtrace_hdl_t *dtp, struct ps_prochandle *P)
*/
(void) pthread_mutex_lock(&dpr->dpr_lock);
dpr->dpr_quit = B_TRUE;
-#if defined(sun)
+#ifdef illumos
(void) _lwp_kill(dpr->dpr_tid, SIGCANCEL);
#else
pthread_kill(dpr->dpr_tid, SIGTHR);
@@ -880,7 +880,7 @@ dt_proc_create_thread(dtrace_hdl_t *dtp, dt_proc_t *dpr, uint_t stop)
(void) sigfillset(&nset);
(void) sigdelset(&nset, SIGABRT); /* unblocked for assert() */
-#if defined(sun)
+#ifdef illumos
(void) sigdelset(&nset, SIGCANCEL); /* see dt_proc_destroy() */
#else
(void) sigdelset(&nset, SIGUSR1); /* see dt_proc_destroy() */
@@ -912,7 +912,7 @@ dt_proc_create_thread(dtrace_hdl_t *dtp, dt_proc_t *dpr, uint_t stop)
* small amount of useful information to help figure it out.
*/
if (dpr->dpr_done) {
-#if defined(sun)
+#ifdef illumos
const psinfo_t *prp = Ppsinfo(dpr->dpr_proc);
int stat = prp ? prp->pr_wstat : 0;
int pid = dpr->dpr_pid;
@@ -963,7 +963,7 @@ dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv,
(void) pthread_mutex_init(&dpr->dpr_lock, NULL);
(void) pthread_cond_init(&dpr->dpr_cv, NULL);
-#if defined(sun)
+#ifdef illumos
if ((dpr->dpr_proc = Pcreate(file, argv, &err, NULL, 0)) == NULL) {
#else
if ((err = proc_create(file, argv, pcf, child_arg,
@@ -974,7 +974,7 @@ dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv,
}
dpr->dpr_hdl = dtp;
-#if defined(sun)
+#ifdef illumos
dpr->dpr_pid = Pstatus(dpr->dpr_proc)->pr_pid;
#else
dpr->dpr_pid = proc_getpid(dpr->dpr_proc);
@@ -1039,7 +1039,7 @@ dt_proc_grab(dtrace_hdl_t *dtp, pid_t pid, int flags, int nomonitor)
(void) pthread_mutex_init(&dpr->dpr_lock, NULL);
(void) pthread_cond_init(&dpr->dpr_cv, NULL);
-#if defined(sun)
+#ifdef illumos
if ((dpr->dpr_proc = Pgrab(pid, flags, &err)) == NULL) {
#else
if ((err = proc_attach(pid, flags, &dpr->dpr_proc)) != 0) {
@@ -1174,7 +1174,7 @@ dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv,
struct ps_prochandle *P = dt_proc_create(dtp, file, argv, pcf, child_arg);
if (P != NULL && idp != NULL && idp->di_id == 0) {
-#if defined(sun)
+#ifdef illumos
idp->di_id = Pstatus(P)->pr_pid; /* $target = created pid */
#else
idp->di_id = proc_getpid(P); /* $target = created pid */
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c
index a325c42cbf23..232a3723b11d 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c
@@ -30,7 +30,7 @@
#include <errno.h>
#include <assert.h>
#include <ctype.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c
index 6acb86b155ba..29138746cfd9 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c
@@ -28,7 +28,7 @@
*/
#include <sys/types.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/sysmacros.h>
#endif
@@ -36,7 +36,7 @@
#include <limits.h>
#include <strings.h>
#include <stdlib.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <unistd.h>
@@ -545,8 +545,9 @@ dt_probe_define(dt_provider_t *pvp, dt_probe_t *prp,
for (pip = prp->pr_inst; pip != NULL; pip = pip->pi_next) {
if (strcmp(pip->pi_fname, fname) == 0 &&
- ((rname == NULL && pip->pi_rname[0] == '\0') ||
- (rname != NULL && strcmp(pip->pi_rname, rname)) == 0))
+ ((rname == NULL && pip->pi_rname == NULL) ||
+ (rname != NULL && pip->pi_rname != NULL &&
+ strcmp(pip->pi_rname, rname) == 0)))
break;
}
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
index 4429019d5bf7..72fd08aee2c1 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
@@ -25,7 +25,7 @@
* Use is subject to license terms.
*/
-#if defined(sun)
+#ifdef illumos
#include <sys/sysmacros.h>
#endif
#include <sys/isa_defs.h>
@@ -38,7 +38,7 @@
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#else
#include <sys/sysctl.h>
@@ -477,7 +477,7 @@ dt_dprintf(const char *format, ...)
}
int
-#if defined(sun)
+#ifdef illumos
dt_ioctl(dtrace_hdl_t *dtp, int val, void *arg)
#else
dt_ioctl(dtrace_hdl_t *dtp, u_long val, void *arg)
@@ -485,7 +485,7 @@ dt_ioctl(dtrace_hdl_t *dtp, u_long val, void *arg)
{
const dtrace_vector_t *v = dtp->dt_vector;
-#if !defined(sun)
+#ifndef illumos
/* Avoid sign extension. */
val &= 0xffffffff;
#endif
@@ -506,7 +506,7 @@ dt_status(dtrace_hdl_t *dtp, processorid_t cpu)
const dtrace_vector_t *v = dtp->dt_vector;
if (v == NULL) {
-#if defined(sun)
+#ifdef illumos
return (p_online(cpu, P_STATUS));
#else
int maxid = 0;
@@ -583,7 +583,7 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...)
va_list ap;
int n;
-#if !defined(sun)
+#ifndef illumos
/*
* On FreeBSD, check if output is currently being re-directed
* to another file. If so, output to that file instead of the
@@ -845,7 +845,7 @@ dt_popcb(const ulong_t *bp, ulong_t n)
return (popc + dt_popc(bp[maxw] & ((1UL << maxb) - 1)));
}
-#if defined(sun)
+#ifdef illumos
struct _rwlock;
struct _lwp_mutex;
@@ -867,7 +867,7 @@ dt_rw_write_held(pthread_rwlock_t *lock)
int
dt_mutex_held(pthread_mutex_t *lock)
{
-#if defined(sun)
+#ifdef illumos
extern int _mutex_held(struct _lwp_mutex *);
return (_mutex_held((struct _lwp_mutex *)lock));
#else
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c
index d19fb88245e2..07565e0f7850 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c
@@ -82,7 +82,7 @@ dtrace_sleep(dtrace_hdl_t *dtp)
return; /* sleep duration has already past */
}
-#if defined(sun)
+#ifdef illumos
tv.tv_sec = (earliest - now) / NANOSEC;
tv.tv_nsec = (earliest - now) % NANOSEC;
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
index 6f88e6d46c42..f0088a939cb0 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
@@ -37,7 +37,7 @@
#include <stdio.h>
#include <gelf.h>
#include <libproc.h>
-#if !defined(sun)
+#ifndef illumos
#include <rtld_db.h>
#endif
@@ -554,7 +554,7 @@ extern int dtrace_probe_info(dtrace_hdl_t *,
* entry point to obtain a library handle.
*/
struct dtrace_vector {
-#if defined(sun)
+#ifdef illumos
int (*dtv_ioctl)(void *, int, void *);
#else
int (*dtv_ioctl)(void *, u_long, void *);
@@ -605,7 +605,7 @@ extern int _dtrace_debug;
}
#endif
-#if !defined(sun)
+#ifndef illumos
#define _SC_CPUID_MAX _SC_NPROCESSORS_CONF
#define _SC_NPROCESSORS_MAX _SC_NPROCESSORS_CONF
#endif
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c b/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c
index 9479e83dd777..34d558767b9e 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c
@@ -39,7 +39,7 @@
#include <dis_tables.h>
-#if !defined(sun)
+#ifndef illumos
#define PR_MODEL_ILP32 1
#define PR_MODEL_LP64 2
#include <libproc_compat.h>
@@ -88,7 +88,7 @@ dt_pid_has_jump_table(struct ps_prochandle *P, dtrace_hdl_t *dtp,
{
ulong_t i;
int size;
-#if defined(sun)
+#ifdef illumos
pid_t pid = Pstatus(P)->pr_pid;
char dmodel = Pstatus(P)->pr_dmodel;
#else
@@ -144,7 +144,7 @@ dt_pid_create_return_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
uint8_t *text;
ulong_t i, end;
int size;
-#if defined(sun)
+#ifdef illumos
pid_t pid = Pstatus(P)->pr_pid;
char dmodel = Pstatus(P)->pr_dmodel;
#else
@@ -305,7 +305,7 @@ dt_pid_create_offset_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
uint8_t *text;
ulong_t i;
int size;
-#if defined(sun)
+#ifdef illumos
pid_t pid = Pstatus(P)->pr_pid;
char dmodel = Pstatus(P)->pr_dmodel;
#else
@@ -388,7 +388,7 @@ dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp,
uint8_t *text;
int size;
ulong_t i, end = symp->st_size;
-#if defined(sun)
+#ifdef illumos
pid_t pid = Pstatus(P)->pr_pid;
char dmodel = Pstatus(P)->pr_dmodel;
#else
diff --git a/cddl/contrib/opensolaris/lib/libgen/common/gmatch.c b/cddl/contrib/opensolaris/lib/libgen/common/gmatch.c
index 199fbb356036..ae65019d3e9f 100644
--- a/cddl/contrib/opensolaris/lib/libgen/common/gmatch.c
+++ b/cddl/contrib/opensolaris/lib/libgen/common/gmatch.c
@@ -29,7 +29,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#if defined(sun)
+#ifdef illumos
#pragma weak gmatch = _gmatch
#include "gen_synonyms.h"
@@ -38,7 +38,7 @@
#include <libgen.h>
#include <stdlib.h>
#include <limits.h>
-#if defined(sun)
+#ifdef illumos
#include <widec.h>
#include "_range.h"
#else
diff --git a/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c b/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c
index 7a265bdc39d4..7ad5141a1a69 100644
--- a/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c
+++ b/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c
@@ -793,6 +793,7 @@ dump_nvlist(nvlist_t *list, int indent)
{
nvpair_t *elem = NULL;
boolean_t bool_value;
+ boolean_t *bool_array_value;
nvlist_t *nvlist_value;
nvlist_t **nvlist_array_value;
uint_t i, count;
@@ -853,6 +854,16 @@ dump_nvlist(nvlist_t *list, int indent)
NVP(elem, string, char *, char *, "'%s'");
break;
+ case DATA_TYPE_BOOLEAN_ARRAY:
+ (void) nvpair_value_boolean_array(elem,
+ &bool_array_value, &count);
+ for (i = 0; i < count; i++) {
+ (void) printf("%*s%s[%d]: %s\n", indent, "",
+ nvpair_name(elem), i,
+ bool_array_value[i] ? "true" : "false");
+ }
+ break;
+
case DATA_TYPE_BYTE_ARRAY:
NVPA(elem, byte_array, uchar_t, int, "%u");
break;
diff --git a/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h b/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h
index 4c2615d924a5..b05669e506ba 100644
--- a/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h
+++ b/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#ifndef _LIBNVPAIR_H
@@ -46,6 +47,7 @@ extern int nvpair_value_match_regex(nvpair_t *, int, char *, regex_t *,
char **);
extern void nvlist_print(FILE *, nvlist_t *);
+extern int nvlist_print_json(FILE *, nvlist_t *);
extern void dump_nvlist(nvlist_t *, int);
/*
diff --git a/cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c b/cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c
new file mode 100644
index 000000000000..7cece36ced1b
--- /dev/null
+++ b/cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c
@@ -0,0 +1,403 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+/*
+ * Copyright (c) 2014, Joyent, Inc.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <wchar.h>
+#include <sys/debug.h>
+
+#include "libnvpair.h"
+
+#define FPRINTF(fp, ...) \
+ do { \
+ if (fprintf(fp, __VA_ARGS__) < 0) \
+ return (-1); \
+ } while (0)
+
+/*
+ * When formatting a string for JSON output we must escape certain characters,
+ * as described in RFC4627. This applies to both member names and
+ * DATA_TYPE_STRING values.
+ *
+ * This function will only operate correctly if the following conditions are
+ * met:
+ *
+ * 1. The input String is encoded in the current locale.
+ *
+ * 2. The current locale includes the Basic Multilingual Plane (plane 0)
+ * as defined in the Unicode standard.
+ *
+ * The output will be entirely 7-bit ASCII (as a subset of UTF-8) with all
+ * representable Unicode characters included in their escaped numeric form.
+ */
+static int
+nvlist_print_json_string(FILE *fp, const char *input)
+{
+ mbstate_t mbr;
+ wchar_t c;
+ size_t sz;
+
+ bzero(&mbr, sizeof (mbr));
+
+ FPRINTF(fp, "\"");
+ while ((sz = mbrtowc(&c, input, MB_CUR_MAX, &mbr)) > 0) {
+ switch (c) {
+ case '"':
+ FPRINTF(fp, "\\\"");
+ break;
+ case '\n':
+ FPRINTF(fp, "\\n");
+ break;
+ case '\r':
+ FPRINTF(fp, "\\r");
+ break;
+ case '\\':
+ FPRINTF(fp, "\\\\");
+ break;
+ case '\f':
+ FPRINTF(fp, "\\f");
+ break;
+ case '\t':
+ FPRINTF(fp, "\\t");
+ break;
+ case '\b':
+ FPRINTF(fp, "\\b");
+ break;
+ default:
+ if ((c >= 0x00 && c <= 0x1f) ||
+ (c > 0x7f && c <= 0xffff)) {
+ /*
+ * Render both Control Characters and Unicode
+ * characters in the Basic Multilingual Plane
+ * as JSON-escaped multibyte characters.
+ */
+ FPRINTF(fp, "\\u%04x", (int)(0xffff & c));
+ } else if (c >= 0x20 && c <= 0x7f) {
+ /*
+ * Render other 7-bit ASCII characters directly
+ * and drop other, unrepresentable characters.
+ */
+ FPRINTF(fp, "%c", (int)(0xff & c));
+ }
+ break;
+ }
+ input += sz;
+ }
+
+ if (sz == (size_t)-1 || sz == (size_t)-2) {
+ /*
+ * We last read an invalid multibyte character sequence,
+ * so return an error.
+ */
+ return (-1);
+ }
+
+ FPRINTF(fp, "\"");
+ return (0);
+}
+
+/*
+ * Dump a JSON-formatted representation of an nvlist to the provided FILE *.
+ * This routine does not output any new-lines or additional whitespace other
+ * than that contained in strings, nor does it call fflush(3C).
+ */
+int
+nvlist_print_json(FILE *fp, nvlist_t *nvl)
+{
+ nvpair_t *curr;
+ boolean_t first = B_TRUE;
+
+ FPRINTF(fp, "{");
+
+ for (curr = nvlist_next_nvpair(nvl, NULL); curr;
+ curr = nvlist_next_nvpair(nvl, curr)) {
+ data_type_t type = nvpair_type(curr);
+
+ if (!first)
+ FPRINTF(fp, ",");
+ else
+ first = B_FALSE;
+
+ if (nvlist_print_json_string(fp, nvpair_name(curr)) == -1)
+ return (-1);
+ FPRINTF(fp, ":");
+
+ switch (type) {
+ case DATA_TYPE_STRING: {
+ char *string = fnvpair_value_string(curr);
+ if (nvlist_print_json_string(fp, string) == -1)
+ return (-1);
+ break;
+ }
+
+ case DATA_TYPE_BOOLEAN: {
+ FPRINTF(fp, "true");
+ break;
+ }
+
+ case DATA_TYPE_BOOLEAN_VALUE: {
+ FPRINTF(fp, "%s", fnvpair_value_boolean_value(curr) ==
+ B_TRUE ? "true" : "false");
+ break;
+ }
+
+ case DATA_TYPE_BYTE: {
+ FPRINTF(fp, "%hhu", fnvpair_value_byte(curr));
+ break;
+ }
+
+ case DATA_TYPE_INT8: {
+ FPRINTF(fp, "%hhd", fnvpair_value_int8(curr));
+ break;
+ }
+
+ case DATA_TYPE_UINT8: {
+ FPRINTF(fp, "%hhu", fnvpair_value_uint8_t(curr));
+ break;
+ }
+
+ case DATA_TYPE_INT16: {
+ FPRINTF(fp, "%hd", fnvpair_value_int16(curr));
+ break;
+ }
+
+ case DATA_TYPE_UINT16: {
+ FPRINTF(fp, "%hu", fnvpair_value_uint16(curr));
+ break;
+ }
+
+ case DATA_TYPE_INT32: {
+ FPRINTF(fp, "%d", fnvpair_value_int32(curr));
+ break;
+ }
+
+ case DATA_TYPE_UINT32: {
+ FPRINTF(fp, "%u", fnvpair_value_uint32(curr));
+ break;
+ }
+
+ case DATA_TYPE_INT64: {
+ FPRINTF(fp, "%lld",
+ (long long)fnvpair_value_int64(curr));
+ break;
+ }
+
+ case DATA_TYPE_UINT64: {
+ FPRINTF(fp, "%llu",
+ (unsigned long long)fnvpair_value_uint64(curr));
+ break;
+ }
+
+ case DATA_TYPE_HRTIME: {
+ hrtime_t val;
+ VERIFY0(nvpair_value_hrtime(curr, &val));
+ FPRINTF(fp, "%llu", (unsigned long long)val);
+ break;
+ }
+
+ case DATA_TYPE_DOUBLE: {
+ double val;
+ VERIFY0(nvpair_value_double(curr, &val));
+ FPRINTF(fp, "%f", val);
+ break;
+ }
+
+ case DATA_TYPE_NVLIST: {
+ if (nvlist_print_json(fp,
+ fnvpair_value_nvlist(curr)) == -1)
+ return (-1);
+ break;
+ }
+
+ case DATA_TYPE_STRING_ARRAY: {
+ char **val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_string_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ if (nvlist_print_json_string(fp, val[i]) == -1)
+ return (-1);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_NVLIST_ARRAY: {
+ nvlist_t **val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_nvlist_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ if (nvlist_print_json(fp, val[i]) == -1)
+ return (-1);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_BOOLEAN_ARRAY: {
+ boolean_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_boolean_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, val[i] == B_TRUE ?
+ "true" : "false");
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_BYTE_ARRAY: {
+ uchar_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_byte_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%hhu", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_UINT8_ARRAY: {
+ uint8_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_uint8_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%hhu", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_INT8_ARRAY: {
+ int8_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_int8_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%hhd", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_UINT16_ARRAY: {
+ uint16_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_uint16_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%hu", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_INT16_ARRAY: {
+ int16_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_int16_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%hd", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_UINT32_ARRAY: {
+ uint32_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_uint32_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%u", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_INT32_ARRAY: {
+ int32_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_int32_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%d", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_UINT64_ARRAY: {
+ uint64_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_uint64_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%llu",
+ (unsigned long long)val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_INT64_ARRAY: {
+ int64_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_int64_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%lld", (long long)val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_UNKNOWN:
+ return (-1);
+ }
+ }
+
+ FPRINTF(fp, "}");
+ return (0);
+}
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
index 8a707d1f795c..fbfaab1d6cc5 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
@@ -789,10 +789,10 @@ extern boolean_t libzfs_fru_compare(libzfs_handle_t *, const char *,
extern boolean_t libzfs_fru_notself(libzfs_handle_t *, const char *);
extern int zpool_fru_set(zpool_handle_t *, uint64_t, const char *);
-#ifndef sun
+#ifndef illumos
extern int zmount(const char *, const char *, int, char *, char *, int, char *,
int);
-#endif /* !sun */
+#endif
#ifdef __cplusplus
}
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
index 063df4a3c234..6d9b68ffde49 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
@@ -1112,7 +1112,7 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
}
case ZFS_PROP_MLSLABEL:
{
-#ifdef sun
+#ifdef illumos
/*
* Verify the mlslabel string and convert to
* internal hex label string.
@@ -1161,11 +1161,11 @@ badlabel:
"invalid mlslabel '%s'"), strval);
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
m_label_free(new_sl); /* OK if null */
-#else /* !sun */
+#else /* !illumos */
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"mlslabel is not supported on FreeBSD"));
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
-#endif /* !sun */
+#endif /* illumos */
goto error;
}
@@ -2423,7 +2423,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
case ZFS_PROP_MLSLABEL:
{
-#ifdef sun
+#ifdef illumos
m_label_t *new_sl = NULL;
char *ascii = NULL; /* human readable label */
@@ -2457,9 +2457,9 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
(void) strlcpy(propbuf, ascii, proplen);
free(ascii);
-#else /* !sun */
+#else /* !illumos */
propbuf[0] = '\0';
-#endif /* !sun */
+#endif /* illumos */
}
break;
@@ -2569,7 +2569,7 @@ static int
idmap_id_to_numeric_domain_rid(uid_t id, boolean_t isuser,
char **domainp, idmap_rid_t *ridp)
{
-#ifdef sun
+#ifdef illumos
idmap_get_handle_t *get_hdl = NULL;
idmap_stat status;
int err = EINVAL;
@@ -2594,10 +2594,10 @@ out:
if (get_hdl)
idmap_get_destroy(get_hdl);
return (err);
-#else /* !sun */
+#else /* !illumos */
assert(!"invalid code path");
return (EINVAL); // silence compiler warning
-#endif /* !sun */
+#endif /* illumos */
}
/*
@@ -2615,7 +2615,7 @@ userquota_propname_decode(const char *propname, boolean_t zoned,
boolean_t isuser;
domain[0] = '\0';
-
+ *ridp = 0;
/* Figure out the property type ({user|group}{quota|space}) */
for (type = 0; type < ZFS_NUM_USERQUOTA_PROPS; type++) {
if (strncmp(propname, zfs_userquota_prop_prefixes[type],
@@ -2632,43 +2632,69 @@ userquota_propname_decode(const char *propname, boolean_t zoned,
cp = strchr(propname, '@') + 1;
if (strchr(cp, '@')) {
-#ifdef sun
+#ifdef illumos
/*
* It's a SID name (eg "user@domain") that needs to be
* turned into S-1-domainID-RID.
*/
- directory_error_t e;
+ int flag = 0;
+ idmap_stat stat, map_stat;
+ uid_t pid;
+ idmap_rid_t rid;
+ idmap_get_handle_t *gh = NULL;
+
+ stat = idmap_get_create(&gh);
+ if (stat != IDMAP_SUCCESS) {
+ idmap_get_destroy(gh);
+ return (ENOMEM);
+ }
if (zoned && getzoneid() == GLOBAL_ZONEID)
return (ENOENT);
if (isuser) {
- e = directory_sid_from_user_name(NULL,
- cp, &numericsid);
+ stat = idmap_getuidbywinname(cp, NULL, flag, &pid);
+ if (stat < 0)
+ return (ENOENT);
+ stat = idmap_get_sidbyuid(gh, pid, flag, &numericsid,
+ &rid, &map_stat);
} else {
- e = directory_sid_from_group_name(NULL,
- cp, &numericsid);
+ stat = idmap_getgidbywinname(cp, NULL, flag, &pid);
+ if (stat < 0)
+ return (ENOENT);
+ stat = idmap_get_sidbygid(gh, pid, flag, &numericsid,
+ &rid, &map_stat);
+ }
+ if (stat < 0) {
+ idmap_get_destroy(gh);
+ return (ENOENT);
}
- if (e != NULL) {
- directory_error_free(e);
+ stat = idmap_get_mappings(gh);
+ idmap_get_destroy(gh);
+
+ if (stat < 0) {
return (ENOENT);
}
if (numericsid == NULL)
return (ENOENT);
cp = numericsid;
+ *ridp = rid;
/* will be further decoded below */
-#else /* !sun */
+#else /* !illumos */
return (ENOENT);
-#endif /* !sun */
+#endif /* illumos */
}
if (strncmp(cp, "S-1-", 4) == 0) {
/* It's a numeric SID (eg "S-1-234-567-89") */
(void) strlcpy(domain, cp, domainlen);
- cp = strrchr(domain, '-');
- *cp = '\0';
- cp++;
-
errno = 0;
- *ridp = strtoull(cp, &end, 10);
+ if (*ridp == 0) {
+ cp = strrchr(domain, '-');
+ *cp = '\0';
+ cp++;
+ *ridp = strtoull(cp, &end, 10);
+ } else {
+ end = "";
+ }
if (numericsid) {
free(numericsid);
numericsid = NULL;
@@ -4158,7 +4184,7 @@ zfs_prune_proplist(zfs_handle_t *zhp, uint8_t *props)
}
}
-#ifdef sun
+#ifdef illumos
static int
zfs_smb_acl_mgmt(libzfs_handle_t *hdl, char *dataset, char *path,
zfs_smb_acl_op_t cmd, char *resource1, char *resource2)
@@ -4240,7 +4266,7 @@ zfs_smb_acl_rename(libzfs_handle_t *hdl, char *dataset, char *path,
return (zfs_smb_acl_mgmt(hdl, dataset, path, ZFS_SMB_ACL_RENAME,
oldname, newname));
}
-#endif /* sun */
+#endif /* illumos */
int
zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type,
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
index ab2007d98a33..dde329a8226f 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
@@ -494,7 +494,7 @@ find_shares_object(differ_info_t *di)
(void) strlcat(fullpath, ZDIFF_SHARESDIR, MAXPATHLEN);
if (stat64(fullpath, &sb) != 0) {
-#ifdef sun
+#ifdef illumos
(void) snprintf(di->errbuf, sizeof (di->errbuf),
dgettext(TEXT_DOMAIN, "Cannot stat %s"), fullpath);
return (zfs_error(di->zhp->zfs_hdl, EZFS_DIFF, di->errbuf));
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
index 49a43855d5fe..c4e9adae98ab 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
@@ -18,10 +18,11 @@
*
* CDDL HEADER END
*/
+
/*
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
- * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -198,8 +199,10 @@ fix_paths(nvlist_t *nv, name_entry_t *names)
if ((devid = get_devid(best->ne_name)) == NULL) {
(void) nvlist_remove_all(nv, ZPOOL_CONFIG_DEVID);
} else {
- if (nvlist_add_string(nv, ZPOOL_CONFIG_DEVID, devid) != 0)
+ if (nvlist_add_string(nv, ZPOOL_CONFIG_DEVID, devid) != 0) {
+ devid_str_free(devid);
return (-1);
+ }
devid_str_free(devid);
}
@@ -665,8 +668,10 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok)
nvlist_add_uint64(holey,
ZPOOL_CONFIG_ID, c) != 0 ||
nvlist_add_uint64(holey,
- ZPOOL_CONFIG_GUID, 0ULL) != 0)
+ ZPOOL_CONFIG_GUID, 0ULL) != 0) {
+ nvlist_free(holey);
goto nomem;
+ }
child[c] = holey;
}
}
@@ -952,7 +957,7 @@ slice_cache_compare(const void *arg1, const void *arg2)
return (rv > 0 ? 1 : -1);
}
-#ifdef sun
+#ifdef illumos
static void
check_one_slice(avl_tree_t *r, char *diskname, uint_t partno,
diskaddr_t size, uint_t blksz)
@@ -975,12 +980,12 @@ check_one_slice(avl_tree_t *r, char *diskname, uint_t partno,
(node = avl_find(r, &tmpnode, NULL)))
node->rn_nozpool = B_TRUE;
}
-#endif /* sun */
+#endif /* illumos */
static void
nozpool_all_slices(avl_tree_t *r, const char *sname)
{
-#ifdef sun
+#ifdef illumos
char diskname[MAXNAMELEN];
char *ptr;
int i;
@@ -996,10 +1001,10 @@ nozpool_all_slices(avl_tree_t *r, const char *sname)
ptr[0] = 'p';
for (i = 0; i <= FD_NUMPART; i++)
check_one_slice(r, diskname, i, 0, 1);
-#endif /* sun */
+#endif /* illumos */
}
-#ifdef sun
+#ifdef illumos
static void
check_slices(avl_tree_t *r, int fd, const char *sname)
{
@@ -1033,7 +1038,7 @@ check_slices(avl_tree_t *r, int fd, const char *sname)
efi_free(gpt);
}
}
-#endif /* sun */
+#endif /* illumos */
static void
zpool_open_func(void *arg)
@@ -1063,7 +1068,7 @@ zpool_open_func(void *arg)
return;
}
/* this file is too small to hold a zpool */
-#ifdef sun
+#ifdef illumos
if (S_ISREG(statbuf.st_mode) &&
statbuf.st_size < SPA_MINDEVSIZE) {
(void) close(fd);
@@ -1075,12 +1080,12 @@ zpool_open_func(void *arg)
*/
check_slices(rn->rn_avl, fd, rn->rn_name);
}
-#else /* !sun */
+#else /* !illumos */
if (statbuf.st_size < SPA_MINDEVSIZE) {
(void) close(fd);
return;
}
-#endif /* sun */
+#endif /* illumos */
if ((zpool_read_label(fd, &config)) != 0) {
(void) close(fd);
@@ -1118,8 +1123,10 @@ zpool_clear_label(int fd)
for (l = 0; l < VDEV_LABELS; l++) {
if (pwrite64(fd, label, sizeof (vdev_label_t),
- label_offset(size, l)) != sizeof (vdev_label_t))
+ label_offset(size, l)) != sizeof (vdev_label_t)) {
+ free(label);
return (-1);
+ }
}
free(label);
@@ -1137,7 +1144,6 @@ static nvlist_t *
zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
{
int i, dirs = iarg->paths;
- DIR *dirp = NULL;
struct dirent64 *dp;
char path[MAXPATHLEN];
char *end, **dir = iarg->path;
@@ -1167,6 +1173,8 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
tpool_t *t;
char *rdsk;
int dfd;
+ boolean_t config_failed = B_FALSE;
+ DIR *dirp;
/* use realpath to normalize the path */
if (realpath(dir[i], path) == 0) {
@@ -1191,6 +1199,8 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
if ((dfd = open64(rdsk, O_RDONLY)) < 0 ||
(dirp = fdopendir(dfd)) == NULL) {
+ if (dfd >= 0)
+ (void) close(dfd);
zfs_error_aux(hdl, strerror(errno));
(void) zfs_error_fmt(hdl, EZFS_BADPATH,
dgettext(TEXT_DOMAIN, "cannot open '%s'"),
@@ -1272,7 +1282,7 @@ skipdir:
cookie = NULL;
while ((slice = avl_destroy_nodes(&slice_cache,
&cookie)) != NULL) {
- if (slice->rn_config != NULL) {
+ if (slice->rn_config != NULL && !config_failed) {
nvlist_t *config = slice->rn_config;
boolean_t matched = B_TRUE;
@@ -1293,13 +1303,16 @@ skipdir:
}
if (!matched) {
nvlist_free(config);
- config = NULL;
- continue;
+ } else {
+ /*
+ * use the non-raw path for the config
+ */
+ (void) strlcpy(end, slice->rn_name,
+ pathleft);
+ if (add_config(hdl, &pools, path,
+ config) != 0)
+ config_failed = B_TRUE;
}
- /* use the non-raw path for the config */
- (void) strlcpy(end, slice->rn_name, pathleft);
- if (add_config(hdl, &pools, path, config) != 0)
- goto error;
}
free(slice->rn_name);
free(slice);
@@ -1307,7 +1320,9 @@ skipdir:
avl_destroy(&slice_cache);
(void) closedir(dirp);
- dirp = NULL;
+
+ if (config_failed)
+ goto error;
}
ret = get_configs(hdl, &pools, iarg->can_be_active);
@@ -1330,14 +1345,10 @@ error:
for (ne = pools.names; ne != NULL; ne = nenext) {
nenext = ne->ne_next;
- if (ne->ne_name)
- free(ne->ne_name);
+ free(ne->ne_name);
free(ne);
}
- if (dirp)
- (void) closedir(dirp);
-
return (ret);
}
@@ -1695,9 +1706,9 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
cb.cb_type = ZPOOL_CONFIG_SPARES;
if (zpool_iter(hdl, find_aux, &cb) == 1) {
name = (char *)zpool_get_name(cb.cb_zhp);
- ret = TRUE;
+ ret = B_TRUE;
} else {
- ret = FALSE;
+ ret = B_FALSE;
}
break;
@@ -1711,9 +1722,9 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
cb.cb_type = ZPOOL_CONFIG_L2CACHE;
if (zpool_iter(hdl, find_aux, &cb) == 1) {
name = (char *)zpool_get_name(cb.cb_zhp);
- ret = TRUE;
+ ret = B_TRUE;
} else {
- ret = FALSE;
+ ret = B_FALSE;
}
break;
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
index 9698a720b112..aadc1f96deaa 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
@@ -24,7 +24,7 @@
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
#include <stdio.h>
@@ -193,9 +193,6 @@ zfs_iter_bookmarks(zfs_handle_t *zhp, zfs_iter_f func, void *data)
fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATETXG));
fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATION));
- /* Allocate an nvlist to hold the bookmarks. */
- bmarks = fnvlist_alloc();
-
if ((err = lzc_get_bookmarks(zhp->zfs_name, props, &bmarks)) != 0)
goto out;
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
index f8596ede3ba6..6c115153bf07 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
@@ -139,7 +139,7 @@ is_shared(libzfs_handle_t *hdl, const char *mountpoint, zfs_share_proto_t proto)
*tab = '\0';
if (strcmp(buf, mountpoint) == 0) {
-#ifdef sun
+#ifdef illumos
/*
* the protocol field is the third field
* skip over second field
@@ -172,7 +172,7 @@ is_shared(libzfs_handle_t *hdl, const char *mountpoint, zfs_share_proto_t proto)
return (SHARED_NOT_SHARED);
}
-#ifdef sun
+#ifdef illumos
/*
* Returns true if the specified directory is empty. If we can't open the
* directory at all, return true so that the mount can fail with a more
@@ -297,7 +297,7 @@ zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
}
}
-#ifdef sun /* FreeBSD: overlay mounts are not checked. */
+#ifdef illumos /* FreeBSD: overlay mounts are not checked. */
/*
* Determine if the mountpoint is empty. If so, refuse to perform the
* mount. We don't perform this check if MS_OVERLAY is specified, which
@@ -507,7 +507,7 @@ zfs_is_shared_smb(zfs_handle_t *zhp, char **where)
* initialized in _zfs_init_libshare() are actually present.
*/
-#ifdef sun
+#ifdef illumos
static sa_handle_t (*_sa_init)(int);
static void (*_sa_fini)(sa_handle_t);
static sa_share_t (*_sa_find_share)(sa_handle_t, char *);
@@ -534,7 +534,7 @@ static void (*_sa_update_sharetab_ts)(sa_handle_t);
static void
_zfs_init_libshare(void)
{
-#ifdef sun
+#ifdef illumos
void *libshare;
char path[MAXPATHLEN];
char isa[MAXISALEN];
@@ -605,7 +605,7 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int service)
{
int ret = SA_OK;
-#ifdef sun
+#ifdef illumos
if (_sa_init == NULL)
ret = SA_CONFIG_ERR;
@@ -646,7 +646,7 @@ void
zfs_uninit_libshare(libzfs_handle_t *zhandle)
{
if (zhandle != NULL && zhandle->libzfs_sharehdl != NULL) {
-#ifdef sun
+#ifdef illumos
if (_sa_fini != NULL)
_sa_fini(zhandle->libzfs_sharehdl);
#endif
@@ -663,7 +663,7 @@ zfs_uninit_libshare(libzfs_handle_t *zhandle)
int
zfs_parse_options(char *options, zfs_share_proto_t proto)
{
-#ifdef sun
+#ifdef illumos
if (_sa_parse_legacy_options != NULL) {
return (_sa_parse_legacy_options(NULL, options,
proto_table[proto].p_name));
@@ -674,7 +674,7 @@ zfs_parse_options(char *options, zfs_share_proto_t proto)
#endif
}
-#ifdef sun
+#ifdef illumos
/*
* zfs_sa_find_share(handle, path)
*
@@ -716,7 +716,7 @@ zfs_sa_disable_share(sa_share_t share, char *proto)
return (_sa_disable_share(share, proto));
return (SA_CONFIG_ERR);
}
-#endif /* sun */
+#endif /* illumos */
/*
* Share the given filesystem according to the options in the specified
@@ -767,7 +767,7 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED))
continue;
-#ifdef sun
+#ifdef illumos
share = zfs_sa_find_share(hdl->libzfs_sharehdl, mountpoint);
if (share == NULL) {
/*
@@ -856,7 +856,7 @@ static int
unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint,
zfs_share_proto_t proto)
{
-#ifdef sun
+#ifdef illumos
sa_share_t share;
int err;
char *mntpt;
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
index e09417aa2dfb..b9db421dcbcf 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
@@ -20,8 +20,8 @@
*/
/*
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2011, 2014 by Delphix. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
@@ -256,7 +256,8 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len,
break;
case ZPOOL_PROP_HEALTH:
- (void) strlcpy(buf, "FAULTED", len);
+ (void) strlcpy(buf,
+ zpool_pool_state_to_name(POOL_STATE_UNAVAIL), len);
break;
case ZPOOL_PROP_GUID:
@@ -408,7 +409,7 @@ bootfs_name_valid(const char *pool, char *bootfs)
static boolean_t
pool_uses_efi(nvlist_t *config)
{
-#ifdef sun
+#ifdef illumos
nvlist_t **child;
uint_t c, children;
@@ -420,7 +421,7 @@ pool_uses_efi(nvlist_t *config)
if (pool_uses_efi(child[c]))
return (B_TRUE);
}
-#endif /* sun */
+#endif /* illumos */
return (B_FALSE);
}
@@ -574,7 +575,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL),
ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0);
-#ifdef sun
+#ifdef illumos
/*
* bootfs property cannot be set on a disk which has
* been EFI labeled.
@@ -587,7 +588,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
zpool_close(zhp);
goto error;
}
-#endif /* sun */
+#endif /* illumos */
zpool_close(zhp);
break;
@@ -1714,7 +1715,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
thename = origname;
}
- if (props) {
+ if (props != NULL) {
uint64_t version;
prop_flags_t flags = { .create = B_FALSE, .import = B_TRUE };
@@ -1722,12 +1723,13 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
&version) == 0);
if ((props = zpool_valid_proplist(hdl, origname,
- props, version, flags, errbuf)) == NULL) {
+ props, version, flags, errbuf)) == NULL)
return (-1);
- } else if (zcmd_write_src_nvlist(hdl, &zc, props) != 0) {
+ if (zcmd_write_src_nvlist(hdl, &zc, props) != 0) {
nvlist_free(props);
return (-1);
}
+ nvlist_free(props);
}
(void) strlcpy(zc.zc_name, thename, sizeof (zc.zc_name));
@@ -1736,11 +1738,11 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
&zc.zc_guid) == 0);
if (zcmd_write_conf_nvlist(hdl, &zc, config) != 0) {
- nvlist_free(props);
+ zcmd_free_nvlists(&zc);
return (-1);
}
if (zcmd_alloc_dst_nvlist(hdl, &zc, zc.zc_nvlist_conf_size * 2) != 0) {
- nvlist_free(props);
+ zcmd_free_nvlists(&zc);
return (-1);
}
@@ -1756,6 +1758,9 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
error = errno;
(void) zcmd_read_dst_nvlist(hdl, &zc, &nv);
+
+ zcmd_free_nvlists(&zc);
+
zpool_get_rewind_policy(config, &policy);
if (error) {
@@ -1861,9 +1866,6 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
return (0);
}
- zcmd_free_nvlists(&zc);
- nvlist_free(props);
-
return (ret);
}
@@ -1915,6 +1917,7 @@ zpool_scan(zpool_handle_t *zhp, pool_scan_func_t func)
}
}
+#ifdef illumos
/*
* This provides a very minimal check whether a given string is likely a
* c#t#d# style string. Users of this are expected to do their own
@@ -1946,6 +1949,7 @@ ctd_check_path(char *str) {
}
return (CTD_CHECK(str));
}
+#endif
/*
* Find a vdev that matches the search criteria specified. We use the
@@ -2001,6 +2005,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
*
* Otherwise, all other searches are simple string compares.
*/
+#ifdef illumos
if (strcmp(srchkey, ZPOOL_CONFIG_PATH) == 0 &&
ctd_check_path(val)) {
uint64_t wholedisk = 0;
@@ -2040,6 +2045,9 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
break;
}
} else if (strcmp(srchkey, ZPOOL_CONFIG_TYPE) == 0 && val) {
+#else
+ if (strcmp(srchkey, ZPOOL_CONFIG_TYPE) == 0 && val) {
+#endif
char *type, *idx, *end, *p;
uint64_t id, vdev_id;
@@ -2377,7 +2385,7 @@ zpool_get_physpath(zpool_handle_t *zhp, char *physpath, size_t phypath_size)
static int
zpool_relabel_disk(libzfs_handle_t *hdl, const char *name)
{
-#ifdef sun
+#ifdef illumos
char path[MAXPATHLEN];
char errbuf[1024];
int fd, error;
@@ -2407,7 +2415,7 @@ zpool_relabel_disk(libzfs_handle_t *hdl, const char *name)
"relabel '%s': unable to read disk capacity"), name);
return (zfs_error(hdl, EZFS_NOCAP, errbuf));
}
-#endif /* sun */
+#endif /* illumos */
return (0);
}
@@ -3325,8 +3333,10 @@ devid_to_path(char *devid_str)
if (ret != 0)
return (NULL);
- if ((path = strdup(list[0].devname)) == NULL)
- return (NULL);
+ /*
+ * In a case the strdup() fails, we will just return NULL below.
+ */
+ path = strdup(list[0].devname);
devid_free_nmlist(list);
@@ -3463,7 +3473,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
devid_str_free(newdevid);
}
-#ifdef sun
+#ifdef illumos
if (strncmp(path, "/dev/dsk/", 9) == 0)
path += 9;
@@ -3488,10 +3498,10 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
}
return (tmp);
}
-#else /* !sun */
+#else /* !illumos */
if (strncmp(path, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
path += sizeof(_PATH_DEV) - 1;
-#endif /* !sun */
+#endif /* illumos */
} else {
verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &path) == 0);
@@ -3881,7 +3891,7 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
free(mntpnt);
}
-#ifdef sun
+#ifdef illumos
/*
* Read the EFI label from the config, if a label does not exist then
* pass back the error to the caller. If the caller has passed a non-NULL
@@ -3946,7 +3956,7 @@ find_start_block(nvlist_t *config)
}
return (MAXOFFSET_T);
}
-#endif /* sun */
+#endif /* illumos */
/*
* Label an individual disk. The name provided is the short name,
@@ -3955,7 +3965,7 @@ find_start_block(nvlist_t *config)
int
zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name)
{
-#ifdef sun
+#ifdef illumos
char path[MAXPATHLEN];
struct dk_gpt *vtoc;
int fd;
@@ -4060,7 +4070,7 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name)
(void) close(fd);
efi_free(vtoc);
-#endif /* sun */
+#endif /* illumos */
return (0);
}
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
index 91857b65a8d6..954adac6c239 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
@@ -949,7 +949,7 @@ dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, uint64_t fromsnap_obj,
case EIO:
case ENOLINK:
case ENOSPC:
-#ifdef sun
+#ifdef illumos
case ENOSTR:
#endif
case ENXIO:
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
index 3b5991422155..427b2fd8dee4 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
@@ -687,7 +687,7 @@ libzfs_fini(libzfs_handle_t *hdl)
(void) fclose(hdl->libzfs_sharetab);
zfs_uninit_libshare(hdl);
zpool_free_handles(hdl);
-#ifdef sun
+#ifdef illumos
libzfs_fru_clear(hdl, B_TRUE);
#endif
namespace_clear(hdl);
@@ -739,7 +739,7 @@ zfs_path_to_zhandle(libzfs_handle_t *hdl, char *path, zfs_type_t argtype)
return (NULL);
}
-#ifdef sun
+#ifdef illumos
rewind(hdl->libzfs_mnttab);
while ((ret = getextmntent(hdl->libzfs_mnttab, &entry, 0)) == 0) {
if (makedevice(entry.mnt_major, entry.mnt_minor) ==
@@ -759,7 +759,7 @@ zfs_path_to_zhandle(libzfs_handle_t *hdl, char *path, zfs_type_t argtype)
strerror(errno));
}
}
-#endif /* sun */
+#endif /* illumos */
if (ret != 0) {
return (NULL);
}
diff --git a/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h b/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
index 03027c35dc05..493be334891f 100644
--- a/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
+++ b/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
@@ -535,7 +535,7 @@ extern vnode_t *rootdir;
extern void delay(clock_t ticks);
#define SEC_TO_TICK(sec) ((sec) * hz)
-#define NSEC_TO_TICK(usec) ((usec) / (NANOSEC / hz))
+#define NSEC_TO_TICK(nsec) ((nsec) / (NANOSEC / hz))
#define gethrestime_sec() time(NULL)
#define gethrestime(t) \
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c b/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c
index bc278b063de1..c0719620dbde 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c
@@ -38,7 +38,7 @@
*/
#include <pthread.h>
-#if defined(sun)
+#ifdef illumos
#include <synch.h>
#endif
#include <stdio.h>
@@ -49,7 +49,7 @@ void
barrier_init(barrier_t *bar, int nthreads)
{
pthread_mutex_init(&bar->bar_lock, NULL);
-#if defined(sun)
+#ifdef illumos
sema_init(&bar->bar_sem, 0, USYNC_THREAD, NULL);
#else
sem_init(&bar->bar_sem, 0, 0);
@@ -66,7 +66,7 @@ barrier_wait(barrier_t *bar)
if (++bar->bar_numin < bar->bar_nthr) {
pthread_mutex_unlock(&bar->bar_lock);
-#if defined(sun)
+#ifdef illumos
sema_wait(&bar->bar_sem);
#else
sem_wait(&bar->bar_sem);
@@ -80,7 +80,7 @@ barrier_wait(barrier_t *bar)
/* reset for next use */
bar->bar_numin = 0;
for (i = 1; i < bar->bar_nthr; i++)
-#if defined(sun)
+#ifdef illumos
sema_post(&bar->bar_sem);
#else
sem_post(&bar->bar_sem);
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.h b/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.h
index c7e6212a69c5..babf2e64e33f 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.h
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.h
@@ -33,7 +33,7 @@
* APIs for the barrier synchronization primitive.
*/
-#if defined(sun)
+#ifdef illumos
#include <synch.h>
#else
#include <semaphore.h>
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c b/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c
index 82ec5fafda4a..823e25e81edb 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c
@@ -169,12 +169,12 @@ write_objects(iidesc_t *idp, ctf_buf_t *b)
{
ushort_t id = (idp ? idp->ii_dtype->t_id : 0);
- ctf_buf_write(b, &id, sizeof (id));
-
if (target_requires_swap) {
SWAP_16(id);
}
+ ctf_buf_write(b, &id, sizeof (id));
+
debug(3, "Wrote object %s (%d)\n", (idp ? idp->ii_name : "(null)"), id);
}
@@ -492,7 +492,7 @@ write_type(void *arg1, void *arg2)
if (i > CTF_MAX_VLEN) {
terminate("function %s has too many args: %d > %d\n",
- i, CTF_MAX_VLEN);
+ tdesc_name(tp), i, CTF_MAX_VLEN);
}
ctt.ctt_info = CTF_TYPE_INFO(CTF_K_FUNCTION, isroot, i);
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c b/cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c
index efe6c279a0b7..d40be25da27f 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c
@@ -155,7 +155,7 @@ main(int argc, char **argv)
int keep_stabs = 0;
int c;
-#if defined(sun)
+#ifdef illumos
sighold(SIGINT);
sighold(SIGQUIT);
sighold(SIGTERM);
@@ -221,7 +221,7 @@ main(int argc, char **argv)
*/
set_terminate_cleanup(terminate_cleanup);
-#if defined(sun)
+#ifdef illumos
sigset(SIGINT, handle_sig);
sigset(SIGQUIT, handle_sig);
sigset(SIGTERM, handle_sig);
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c b/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c
index 3e030c7e251a..a3d05ad20b28 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c
@@ -176,20 +176,20 @@
#include <unistd.h>
#include <pthread.h>
#include <assert.h>
-#if defined(sun)
+#ifdef illumos
#include <synch.h>
#endif
#include <signal.h>
#include <libgen.h>
#include <string.h>
#include <errno.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <sys/param.h>
#include <sys/types.h>
#include <sys/mman.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/sysconf.h>
#endif
@@ -232,7 +232,7 @@ usage(void)
progname, progname);
}
-#if defined(sun)
+#ifdef illumos
static void
bigheap(void)
{
@@ -280,7 +280,7 @@ bigheap(void)
(void) memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mha, 0, 0);
}
-#endif
+#endif /* illumos */
static void
finalize_phase_one(workqueue_t *wq)
@@ -707,7 +707,7 @@ start_threads(workqueue_t *wq)
(void *(*)(void *))worker_thread, wq);
}
-#if defined(sun)
+#ifdef illumos
sigset(SIGINT, handle_sig);
sigset(SIGQUIT, handle_sig);
sigset(SIGTERM, handle_sig);
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h b/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h
index 9b2ee3d7565c..11885002ee84 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h
@@ -26,8 +26,6 @@
#ifndef _CTFTOOLS_H
#define _CTFTOOLS_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Functions and data structures used in the manipulation of stabs and CTF data
*/
@@ -39,6 +37,8 @@
#include <gelf.h>
#include <pthread.h>
+#include <sys/ccompile.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -435,8 +435,8 @@ int streq(const char *, const char *);
int findelfsecidx(Elf *, const char *, const char *);
size_t elf_ptrsz(Elf *);
char *mktmpname(const char *, const char *);
-void terminate(const char *, ...);
-void aborterr(const char *, ...);
+void terminate(const char *, ...) __NORETURN;
+void aborterr(const char *, ...) __NORETURN;
void set_terminate_cleanup(void (*)(void));
void elfterminate(const char *, const char *, ...);
void warning(const char *, ...);
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c b/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c
index 5dfeab3c0bea..b7cb66fee9ab 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c
@@ -1390,7 +1390,7 @@ die_base_type2enc(dwarf_t *dw, Dwarf_Off off, Dwarf_Signed enc, size_t sz)
mult = 2;
col = 1;
} else if (enc == DW_ATE_imaginary_float
-#if defined(sun)
+#ifdef illumos
|| enc == DW_ATE_SUN_imaginary_float
#endif
)
@@ -1441,7 +1441,7 @@ die_base_from_dwarf(dwarf_t *dw, Dwarf_Die base, Dwarf_Off off, size_t sz)
case DW_ATE_float:
case DW_ATE_complex_float:
case DW_ATE_imaginary_float:
-#if defined(sun)
+#ifdef illumos
case DW_ATE_SUN_imaginary_float:
case DW_ATE_SUN_interval_float:
#endif
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c b/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c
index d366f3182731..27966af0cf50 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c
@@ -349,7 +349,7 @@ equiv_node(tdesc_t *ctdp, tdesc_t *mtdp, equiv_data_t *ed)
int (*equiv)(tdesc_t *, tdesc_t *, equiv_data_t *);
int mapping;
- if (ctdp->t_emark > ed->ed_clear_mark &&
+ if (ctdp->t_emark > ed->ed_clear_mark ||
mtdp->t_emark > ed->ed_clear_mark)
return (ctdp->t_emark == mtdp->t_emark);
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/output.c b/cddl/contrib/opensolaris/tools/ctf/cvt/output.c
index af797690a259..3385e4b2d09f 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/output.c
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/output.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Routines for preparing tdata trees for conversion into CTF data, and
* for placing the resulting data into an output file.
@@ -576,7 +574,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname,
shdr.sh_name);
}
-#if !defined(sun)
+#ifndef illumos
if (gelf_update_shdr(dscn, &shdr) == 0)
elfterminate(dstname, "Cannot update sect %s", sname);
#endif
@@ -585,7 +583,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname,
elfterminate(srcname, "Cannot get sect %s data", sname);
if ((ddata = elf_newdata(dscn)) == NULL)
elfterminate(dstname, "Can't make sect %s data", sname);
-#if defined(sun)
+#ifdef illumos
bcopy(sdata, ddata, sizeof (Elf_Data));
#else
/*
@@ -645,7 +643,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname,
}
}
-#if !defined(sun)
+#ifndef illumos
if (ddata->d_buf == NULL && sdata->d_buf != NULL) {
ddata->d_buf = xmalloc(shdr.sh_size);
bcopy(sdata->d_buf, ddata->d_buf, shdr.sh_size);
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/tdata.c b/cddl/contrib/opensolaris/tools/ctf/cvt/tdata.c
index 1ccd6cde5f59..d1a1ad0e7d05 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/tdata.c
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/tdata.c
@@ -173,7 +173,7 @@ tdesc_namecmp(void *arg1, void *arg2)
return (!streq(tdp1->t_name, tdp2->t_name));
}
-#if defined(sun)
+#ifdef illumos
/*ARGSUSED1*/
static int
tdesc_print(void *data, void *private __unused)
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/util.c b/cddl/contrib/opensolaris/tools/ctf/cvt/util.c
index 82dfe63ad579..fb76cbaeb422 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/util.c
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/util.c
@@ -171,7 +171,7 @@ aborterr(const char *format, ...)
whine("ERROR", format, ap);
va_end(ap);
-#if defined(sun)
+#ifdef illumos
abort();
#else
exit(0);
diff --git a/cddl/lib/Makefile b/cddl/lib/Makefile
index 634d70eea5fa..48a77abb5107 100644
--- a/cddl/lib/Makefile
+++ b/cddl/lib/Makefile
@@ -27,9 +27,17 @@ _libzpool= libzpool
.endif
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || \
- ${MACHINE_CPUARCH} == "mips" || ${MACHINE_CPUARCH} == "powerpc"
+ ${MACHINE_CPUARCH} == "mips" || ${MACHINE_CPUARCH} == "powerpc" || \
+ ${MACHINE_CPUARCH} == "arm"
_drti= drti
_libdtrace= libdtrace
.endif
+SUBDIR_DEPEND_libdtrace= libctf
+SUBDIR_DEPEND_libzfs_core= libnvpair
+SUBDIR_DEPEND_libzfs= libavl libnvpair libumem libuutil libzfs_core
+SUBDIR_DEPEND_libzpool= libavl libnvpair libumem
+
+SUBDIR_PARALLEL=
+
.include <bsd.subdir.mk>
diff --git a/cddl/lib/libctf/Makefile b/cddl/lib/libctf/Makefile
index 50c7937b89b1..d8a645ebbc54 100644
--- a/cddl/lib/libctf/Makefile
+++ b/cddl/lib/libctf/Makefile
@@ -16,6 +16,7 @@ SRCS= ctf_create.c \
ctf_subr.c \
ctf_types.c \
ctf_util.c
+MAN= ctf.5
WARNS?= 0
CFLAGS+= -DCTF_OLD_VERSIONS
diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile
index 006740adf01f..128ccf5f9071 100644
--- a/cddl/lib/libdtrace/Makefile
+++ b/cddl/lib/libdtrace/Makefile
@@ -50,6 +50,7 @@ DSRCS= errno.d \
io.d \
ip.d \
psinfo.d \
+ siftr.d \
signal.d \
tcp.d \
udp.d \
@@ -81,6 +82,10 @@ CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/sparc
CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/mips
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/mips
.PATH: ${.CURDIR}/../../../sys/cddl/dev/dtrace/mips
+.elif ${MACHINE_CPUARCH} == "arm"
+CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/arm
+.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/arm
+.PATH: ${.CURDIR}/../../../sys/cddl/dev/dtrace/arm
.elif ${MACHINE_CPUARCH} == "powerpc"
CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/powerpc
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/powerpc
@@ -99,6 +104,8 @@ LFLAGS+=-l
YFLAGS+=-d
+LIBADD= ctf elf proc pthread rtld_db
+
CLEANFILES= dt_errtags.c dt_names.c
dt_errtags.c:
diff --git a/cddl/lib/libdtrace/Makefile.depend b/cddl/lib/libdtrace/Makefile.depend
index 8d30ace22df6..08a9c5d99d0c 100644
--- a/cddl/lib/libdtrace/Makefile.depend
+++ b/cddl/lib/libdtrace/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ cddl/lib/libctf \
gnu/lib/csu \
gnu/lib/libgcc \
include \
@@ -14,7 +15,9 @@ DIRDEPS = \
lib/libelf \
lib/libproc \
lib/librtld_db \
+ lib/libthr \
usr.bin/xinstall.host \
+ usr.bin/yacc.host \
.include <dirdeps.mk>
diff --git a/cddl/lib/libdtrace/libproc_compat.h b/cddl/lib/libdtrace/libproc_compat.h
index 0d99d967553a..8704b820df58 100644
--- a/cddl/lib/libdtrace/libproc_compat.h
+++ b/cddl/lib/libdtrace/libproc_compat.h
@@ -59,6 +59,6 @@
#define Pstate proc_state
#define Psymbol_iter_by_addr proc_iter_symbyaddr
#define Punsetflags proc_clearflags
-#define Pupdate_maps(p) do { } while (0)
+#define Pupdate_maps proc_rdagent
#define Pupdate_syms proc_updatesyms
#define Pxecbkpt proc_bkptexec
diff --git a/cddl/lib/libdtrace/siftr.d b/cddl/lib/libdtrace/siftr.d
new file mode 100644
index 000000000000..a6ff844901dc
--- /dev/null
+++ b/cddl/lib/libdtrace/siftr.d
@@ -0,0 +1,100 @@
+/*
+ * 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
+ *
+ * $FreeBSD$
+ */
+
+#pragma D depends_on module siftr
+#pragma D depends_on provider tcp
+
+/*
+ * Convert a SIFTR direction value to a string
+ */
+#pragma D binding "1.12.1" SIFTR_IN
+inline int SIFTR_IN = 1;
+#pragma D binding "1.12.1" SIFTR_OUT
+inline int SIFTR_OUT = 2;
+
+/* SIFTR direction strings. */
+#pragma D binding "1.12.1" siftr_dir_string
+inline string siftr_dir_string[uint8_t direction] =
+ direction == SIFTR_IN ? "in" :
+ direction == SIFTR_OUT ? "out" :
+ "unknown" ;
+
+typedef struct siftrinfo {
+ struct timeval tval;
+ uint8_t direction;
+ uint8_t ipver;
+ uint32_t hash;
+ uint16_t tcp_localport;
+ uint16_t tcp_foreignport;
+ uint64_t snd_cwnd;
+ u_long snd_wnd;
+ u_long rcv_wnd;
+ u_long snd_bwnd;
+ u_long snd_ssthresh;
+ int conn_state;
+ u_int max_seg_size;
+ int smoothed_rtt;
+ u_char sack_enabled;
+ u_char snd_scale;
+ u_char rcv_scale;
+ u_int flags;
+ int rxt_length;
+ u_int snd_buf_hiwater;
+ u_int snd_buf_cc;
+ u_int rcv_buf_hiwater;
+ u_int rcv_buf_cc;
+ u_int sent_inflight_bytes;
+ int t_segqlen;
+ u_int flowid;
+ u_int flowtype;
+} siftrinfo_t;
+
+#pragma D binding "1.12.1" translator
+translator siftrinfo_t < struct pkt_node *p > {
+ direction = p == NULL ? 0 : p->direction;
+ ipver = p == NULL ? 0 : p->ipver;
+ hash = p == NULL ? 0 : p->hash;
+ tcp_localport = p == NULL ? 0 : ntohs(p->tcp_localport);
+ tcp_foreignport = p == NULL ? 0 : ntohs(p->tcp_foreignport);
+ snd_cwnd = p == NULL ? 0 : p->snd_cwnd;
+ snd_wnd = p == NULL ? 0 : p->snd_wnd;
+ rcv_wnd = p == NULL ? 0 : p->rcv_wnd;
+ snd_bwnd = p == NULL ? 0 : p->snd_bwnd;
+ snd_ssthresh = p == NULL ? 0 : p->snd_ssthresh;
+ conn_state = p == NULL ? 0 : p->conn_state;
+ max_seg_size = p == NULL ? 0 : p->max_seg_size;
+ smoothed_rtt = p == NULL ? 0 : p->smoothed_rtt;
+ sack_enabled = p == NULL ? 0 : p->sack_enabled;
+ snd_scale = p == NULL ? 0 : p->snd_scale;
+ rcv_scale = p == NULL ? 0 : p->rcv_scale;
+ flags = p == NULL ? 0 : p->flags;
+ rxt_length = p == NULL ? 0 : p->rxt_length;
+ snd_buf_hiwater = p == NULL ? 0 : p->snd_buf_hiwater;
+ snd_buf_cc = p == NULL ? 0 : p->snd_buf_cc;
+ rcv_buf_hiwater = p == NULL ? 0 : p->rcv_buf_hiwater;
+ rcv_buf_cc = p == NULL ? 0 : p->rcv_buf_cc;
+ sent_inflight_bytes = p == NULL ? 0 : p->sent_inflight_bytes;
+ t_segqlen = p == NULL ? 0 : p->t_segqlen;
+ flowid = p == NULL ? 0 : p->flowid;
+ flowtype = p == NULL ? 0 : p->flowtype;
+};
diff --git a/cddl/lib/libnvpair/Makefile b/cddl/lib/libnvpair/Makefile
index 677068fdc8c3..6b6f51d53259 100644
--- a/cddl/lib/libnvpair/Makefile
+++ b/cddl/lib/libnvpair/Makefile
@@ -9,6 +9,7 @@ SRCS= libnvpair.c \
nvpair_alloc_system.c \
nvpair_alloc_fixed.c \
nvpair.c \
+ nvpair_json.c \
fnvpair.c
WARNS?= 0
diff --git a/cddl/sbin/Makefile b/cddl/sbin/Makefile
index f40f2a45e759..19daabd02b57 100644
--- a/cddl/sbin/Makefile
+++ b/cddl/sbin/Makefile
@@ -13,4 +13,6 @@ _zfs= zfs
_zpool= zpool
.endif
+SUBDIR_PARALLEL=
+
.include <bsd.subdir.mk>
diff --git a/cddl/usr.bin/Makefile b/cddl/usr.bin/Makefile
index 533697d1ed00..69179c5545c8 100644
--- a/cddl/usr.bin/Makefile
+++ b/cddl/usr.bin/Makefile
@@ -26,4 +26,6 @@ _zstreamdump = zstreamdump
.endif
.endif
+SUBDIR_PARALLEL=
+
.include <bsd.subdir.mk>
diff --git a/cddl/usr.bin/ctfconvert/Makefile b/cddl/usr.bin/ctfconvert/Makefile
index 7e4a05a4db0b..b1dd8a231f81 100644
--- a/cddl/usr.bin/ctfconvert/Makefile
+++ b/cddl/usr.bin/ctfconvert/Makefile
@@ -3,8 +3,6 @@
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/tools/ctf/common
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/tools/ctf/cvt
-DEBUG_FLAGS= -g
-
PROG= ctfconvert
SRCS= alist.c \
ctf.c \
@@ -36,7 +34,6 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
-I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
-DPADD= ${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
-LDADD= -lctf -ldwarf -lelf -lz -lpthread
+LIBADD= dwarf elf z pthread
.include <bsd.prog.mk>
diff --git a/cddl/usr.bin/ctfconvert/ctfconvert.1 b/cddl/usr.bin/ctfconvert/ctfconvert.1
index 4de07ec17b4d..c5def3ea5bd9 100644
--- a/cddl/usr.bin/ctfconvert/ctfconvert.1
+++ b/cddl/usr.bin/ctfconvert/ctfconvert.1
@@ -74,8 +74,8 @@ Write the output to file in
.Sh EXIT STATUS
.Ex -std
.Sh SEE ALSO
-.Xr ctfmerge 1 ,
-.Xr ctfdump 1
+.Xr ctfdump 1 ,
+.Xr ctfmerge 1
.Sh HISTORY
The
.Nm
diff --git a/cddl/usr.bin/ctfdump/Makefile b/cddl/usr.bin/ctfdump/Makefile
index e87e7a0a6a5a..74adad254124 100644
--- a/cddl/usr.bin/ctfdump/Makefile
+++ b/cddl/usr.bin/ctfdump/Makefile
@@ -17,7 +17,6 @@ CFLAGS+= -I${OPENSOLARIS_USR_DISTDIR} \
-I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/common \
-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
-DPADD= ${LIBPTHREAD} ${LIBELF} ${LIBZ}
-LDADD= -lpthread -lelf -lz
+LIBADD= elf z
.include <bsd.prog.mk>
diff --git a/cddl/usr.bin/ctfmerge/Makefile b/cddl/usr.bin/ctfmerge/Makefile
index ba4840e672f1..86e8a0df78c1 100644
--- a/cddl/usr.bin/ctfmerge/Makefile
+++ b/cddl/usr.bin/ctfmerge/Makefile
@@ -33,7 +33,6 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
-I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
-DPADD= ${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
-LDADD= -lctf -ldwarf -lelf -lz -lpthread
+LIBADD= elf z pthread
.include <bsd.prog.mk>
diff --git a/cddl/usr.sbin/Makefile b/cddl/usr.sbin/Makefile
index 0d34afd025bb..d309075a4306 100644
--- a/cddl/usr.sbin/Makefile
+++ b/cddl/usr.sbin/Makefile
@@ -30,6 +30,12 @@ _plockstat= plockstat
.endif
.endif
+.if ${MACHINE_CPUARCH} == "arm"
+_dtrace= dtrace
+_dtruss= dtruss
+_lockstat= lockstat
+.endif
+
.if ${MACHINE_CPUARCH} == "mips"
_dtrace= dtrace
.endif
@@ -40,4 +46,6 @@ _dtruss= dtruss
_lockstat= lockstat
.endif
+SUBDIR_PARALLEL=
+
.include <bsd.subdir.mk>
diff --git a/cddl/usr.sbin/dtrace/Makefile b/cddl/usr.sbin/dtrace/Makefile
index dfccf886e6af..8c5e3abe5a07 100644
--- a/cddl/usr.sbin/dtrace/Makefile
+++ b/cddl/usr.sbin/dtrace/Makefile
@@ -20,9 +20,6 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
#CFLAGS+= -DNEED_ERRLOC
#YFLAGS+= -d
-DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \
- ${LIBCTF} ${LIBELF} ${LIBZ} ${LIBUTIL} ${LIBRTLD_DB}
-LDADD= -lpthread -ldtrace -ly -ll -lproc -lctf -lelf -lz -lutil \
- -lrtld_db
+LIBADD= dtrace
.include <bsd.prog.mk>
diff --git a/cddl/usr.sbin/dtrace/tests/Makefile b/cddl/usr.sbin/dtrace/tests/Makefile
new file mode 100644
index 000000000000..dfd2b54e1e2c
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/cddl/usr.sbin/dtrace
+TESTS_SUBDIRS+= common
+
+.PATH: ${.CURDIR:H:H:H:H}/tests
+KYUAFILE= YES
+
+.PATH: ${.CURDIR}/tools
+SCRIPTSDIR= ${TESTSDIR}
+SCRIPTS= dtest.sh
+
+.include <bsd.test.mk>
diff --git a/cddl/usr.sbin/dtrace/tests/Makefile.inc1 b/cddl/usr.sbin/dtrace/tests/Makefile.inc1
new file mode 100644
index 000000000000..6958f787343a
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/Makefile.inc1
@@ -0,0 +1,52 @@
+# $FreeBSD$
+
+TESTGROUP= ${.CURDIR:H:T}/${.CURDIR:T}
+TESTSRC= ${.CURDIR:H:H:H:H:H}/contrib/opensolaris/cmd/dtrace/test/tst/${TESTGROUP}
+TESTSDIR= ${TESTSBASE}/cddl/usr.sbin/dtrace/${TESTGROUP}
+
+.if !defined(_RECURSING_PROGS)
+FILESGROUPS+= FILES ${TESTGROUP} ${TESTGROUP}EXE
+
+${TESTGROUP}= ${TESTFILES}
+${TESTGROUP}EXE= ${TESTEXES}
+${TESTGROUP}EXEMODE= 0555
+
+${TESTGROUP}DIR= ${TESTSDIR}
+${TESTGROUP}EXEDIR= ${TESTSDIR}
+
+TESTWRAPPER= t_dtrace_contrib
+ATF_TESTS_SH+= ${TESTWRAPPER}
+TEST_METADATA.t_dtrace_contrib+= required_files="/usr/local/bin/ksh"
+TEST_METADATA.t_dtrace_contrib+= required_user="root"
+
+GENTEST?= ${.CURDIR:H:H}/tools/gentest.sh
+EXCLUDE= ${.CURDIR:H:H}/tools/exclude.sh
+${TESTWRAPPER}.sh: ${GENTEST} ${EXCLUDE} ${${TESTGROUP}}
+ sh ${GENTEST} -e ${EXCLUDE} ${TESTGROUP} ${${TESTGROUP}:S/ */ /} > ${.TARGET}
+
+CLEANFILES+= ${TESTWRAPPER}.sh
+.endif # !defined(_RECURSING_PROGS)
+
+.PATH: ${TESTSRC}
+
+PROGS= ${CFILES:T:S/.c$/.exe/g}
+.for prog in ${PROGS}
+SRCS.${prog}+= ${prog:S/.exe$/.c/}
+BINDIR.${prog}= ${TESTSDIR}
+MAN.${prog}=
+
+.if exists(${prog:S/^tst.//:S/.exe$/.d/})
+SRCS.${prog}+= ${prog:S/^tst.//:S/.exe$/.d/}
+.endif
+.endfor
+
+# Some tests depend on the internals of their corresponding test programs,
+# so make sure the optimizer doesn't interfere with them.
+CFLAGS+= -O0
+
+# Test programs shouldn't be stripped; else we generally can't use the PID
+# provider.
+DEBUG_FLAGS= -g
+STRIP=
+
+.include <bsd.test.mk>
diff --git a/cddl/usr.sbin/dtrace/tests/common/Makefile b/cddl/usr.sbin/dtrace/tests/common/Makefile
new file mode 100644
index 000000000000..02381c66e391
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/Makefile
@@ -0,0 +1,91 @@
+# $FreeBSD$
+
+# We exclude several subdirectories: nfs and sysevent do not compile on
+# FreeBSD, and docsExamples doesn't seem amenable to automated testing.
+
+TESTSDIR= ${TESTSBASE}/cddl/usr.sbin/dtrace/common
+TESTS_SUBDIRS+= aggs \
+ arithmetic \
+ arrays \
+ assocs \
+ begin \
+ bitfields \
+ buffering \
+ builtinvar \
+ cg \
+ clauses \
+ cpc \
+ decls \
+ drops \
+ dtraceUtil \
+ end \
+ enum \
+ error \
+ exit \
+ fbtprovider \
+ funcs \
+ grammar \
+ include \
+ inline \
+ io \
+ ip \
+ java_api \
+ json \
+ lexer \
+ llquantize \
+ mdb \
+ mib \
+ misc \
+ multiaggs \
+ offsetof \
+ operators \
+ pid \
+ plockstat \
+ pointers \
+ pragma \
+ predicates \
+ preprocessor \
+ print \
+ printa \
+ printf \
+ privs \
+ probes \
+ proc \
+ profile-n \
+ providers \
+ raise \
+ rates \
+ safety \
+ scalars \
+ sched \
+ scripting \
+ sdt \
+ sizeof \
+ speculation \
+ stability \
+ stack \
+ stackdepth \
+ stop \
+ strlen \
+ strtoll \
+ struct \
+ syscall \
+ tick-n \
+ trace \
+ tracemem \
+ translators \
+ typedef \
+ types \
+ uctf \
+ union \
+ usdt \
+ ustack \
+ vars \
+ version \
+
+.PATH: ${.CURDIR:H:H:H:H:H}/tests
+KYUAFILE= YES
+
+SUBDIR_PARALLEL=
+
+.include <bsd.test.mk>
diff --git a/cddl/usr.sbin/dtrace/tests/common/aggs/Makefile b/cddl/usr.sbin/dtrace/tests/common/aggs/Makefile
new file mode 100644
index 000000000000..d8a5ef0bf980
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/aggs/Makefile
@@ -0,0 +1,189 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_AGG_FUNC.bad.d \
+ err.D_AGG_MDIM.bad.d \
+ err.D_AGG_NULL.bad.d \
+ err.D_AGG_REDEF.redef.d \
+ err.D_AGG_SCALAR.avgtoofew.d \
+ err.D_AGG_SCALAR.maxnoarg.d \
+ err.D_AGG_SCALAR.mintoofew.d \
+ err.D_AGG_SCALAR.quantizetoofew.d \
+ err.D_AGG_SCALAR.stddevtoofew.d \
+ err.D_AGG_SCALAR.sumtoofew.d \
+ err.D_CLEAR_AGGARG.bad.d \
+ err.D_CLEAR_PROTO.bad.d \
+ err.D_FUNC_IDENT.bad.d \
+ err.D_FUNC_UNDEF.badaggfunc.d \
+ err.D_IDENT_UNDEF.badexpr.d \
+ err.D_IDENT_UNDEF.badkey3.d \
+ err.D_IDENT_UNDEF.noeffect.d \
+ err.D_KEY_TYPE.badkey1.d \
+ err.D_KEY_TYPE.badkey2.d \
+ err.D_KEY_TYPE.badkey4.d \
+ err.D_LQUANT_BASETYPE.lqbad1.d \
+ err.D_LQUANT_BASETYPE.lqshort.d \
+ err.D_LQUANT_BASEVAL.bad.d \
+ err.D_LQUANT_LIMTYPE.lqbad1.d \
+ err.D_LQUANT_LIMVAL.bad.d \
+ err.D_LQUANT_MATCHBASE.d \
+ err.D_LQUANT_MATCHBASE.order.d \
+ err.D_LQUANT_MATCHLIM.d \
+ err.D_LQUANT_MATCHLIM.order.d \
+ err.D_LQUANT_MATCHSTEP.d \
+ err.D_LQUANT_MISMATCH.lqbadarg.d \
+ err.D_LQUANT_STEPLARGE.lqtoofew.d \
+ err.D_LQUANT_STEPSMALL.bad.d \
+ err.D_LQUANT_STEPTYPE.lqbadinc.d \
+ err.D_LQUANT_STEPVAL.bad.d \
+ err.D_NORMALIZE_AGGARG.bad.d \
+ err.D_NORMALIZE_PROTO.bad.d \
+ err.D_NORMALIZE_SCALAR.bad.d \
+ err.D_PROTO_ARG.lquantizetoofew.d \
+ err.D_PROTO_LEN.avgnoarg.d \
+ err.D_PROTO_LEN.avgtoomany.d \
+ err.D_PROTO_LEN.counttoomany.d \
+ err.D_PROTO_LEN.lquantizenoarg.d \
+ err.D_PROTO_LEN.lquantizetoomany.d \
+ err.D_PROTO_LEN.maxnoarg.d \
+ err.D_PROTO_LEN.maxtoomany.d \
+ err.D_PROTO_LEN.minnoarg.d \
+ err.D_PROTO_LEN.mintoomany.d \
+ err.D_PROTO_LEN.quantizenoarg.d \
+ err.D_PROTO_LEN.quantizetoomany.d \
+ err.D_PROTO_LEN.stddevnoarg.d \
+ err.D_PROTO_LEN.stddevtoomany.d \
+ err.D_PROTO_LEN.sumnoarg.d \
+ err.D_PROTO_LEN.sumtoomany.d \
+ err.D_TRUNC_AGGARG.bad.d \
+ err.D_TRUNC_PROTO.badmany.d \
+ err.D_TRUNC_PROTO.badnone.d \
+ err.D_TRUNC_SCALAR.bad.d \
+ tst.aggencoding.d \
+ tst.aggencoding.d.out \
+ tst.agghist.d \
+ tst.agghist.d.out \
+ tst.aggpack.d \
+ tst.aggpack.d.out \
+ tst.aggpackbanner.ksh \
+ tst.aggpackbanner.ksh.out \
+ tst.aggpackzoom.d \
+ tst.aggpackzoom.d.out \
+ tst.aggzoom.d \
+ tst.aggzoom.d.out \
+ tst.allquant.d \
+ tst.allquant.d.out \
+ tst.avg.d \
+ tst.avg.d.out \
+ tst.avg_neg.d \
+ tst.avg_neg.d.out \
+ tst.clear.d \
+ tst.clear.d.out \
+ tst.clearavg.d \
+ tst.clearavg.d.out \
+ tst.clearavg2.d \
+ tst.clearavg2.d.out \
+ tst.cleardenormalize.d \
+ tst.cleardenormalize.d.out \
+ tst.clearlquantize.d \
+ tst.clearlquantize.d.out \
+ tst.clearnormalize.d \
+ tst.clearnormalize.d.out \
+ tst.clearstddev.d \
+ tst.clearstddev.d.out \
+ tst.count.d \
+ tst.count.d.out \
+ tst.count2.d \
+ tst.count2.d.out \
+ tst.count3.d \
+ tst.denormalize.d \
+ tst.denormalize.d.out \
+ tst.denormalizeonly.d \
+ tst.denormalizeonly.d.out \
+ tst.fmtnormalize.d \
+ tst.fmtnormalize.d.out \
+ tst.forms.d \
+ tst.forms.d.out \
+ tst.goodkey.d \
+ tst.keysort.d \
+ tst.keysort.d.out \
+ tst.lquantize.d \
+ tst.lquantize.d.out \
+ tst.lquantnormal.d \
+ tst.lquantnormal.d.out \
+ tst.lquantrange.d \
+ tst.lquantrange.d.out \
+ tst.lquantround.d \
+ tst.lquantround.d.out \
+ tst.lquantzero.d \
+ tst.lquantzero.d.out \
+ tst.max.d \
+ tst.max.d.out \
+ tst.max_neg.d \
+ tst.max_neg.d.out \
+ tst.min.d \
+ tst.min.d.out \
+ tst.min_neg.d \
+ tst.min_neg.d.out \
+ tst.multiaggs1.d \
+ tst.multiaggs2.d \
+ tst.multiaggs2.d.out \
+ tst.multiaggs3.d \
+ tst.multiaggs3.d.out \
+ tst.multinormalize.d \
+ tst.multinormalize.d.out \
+ tst.neglquant.d \
+ tst.neglquant.d.out \
+ tst.negorder.d \
+ tst.negorder.d.out \
+ tst.negquant.d \
+ tst.negquant.d.out \
+ tst.negtrunc.d \
+ tst.negtrunc.d.out \
+ tst.negtruncquant.d \
+ tst.negtruncquant.d.out \
+ tst.normalize.d \
+ tst.normalize.d.out \
+ tst.order.d \
+ tst.order.d.out \
+ tst.quantize.d \
+ tst.quantize.d.out \
+ tst.quantmany.d \
+ tst.quantmany.d.out \
+ tst.quantround.d \
+ tst.quantround.d.out \
+ tst.quantzero.d \
+ tst.quantzero.d.out \
+ tst.signature.d \
+ tst.signedkeys.d \
+ tst.signedkeys.d.out \
+ tst.signedkeyspos.d \
+ tst.signedkeyspos.d.out \
+ tst.sizedkeys.d \
+ tst.sizedkeys.d.out \
+ tst.stddev.d \
+ tst.stddev.d.out \
+ tst.subr.d \
+ tst.sum.d \
+ tst.sum.d.out \
+ tst.trunc.d \
+ tst.trunc.d.out \
+ tst.trunc0.d \
+ tst.trunc0.d.out \
+ tst.truncquant.d \
+ tst.truncquant.d.out \
+ tst.valsortkeypos.d \
+ tst.valsortkeypos.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/arithmetic/Makefile b/cddl/usr.sbin/dtrace/tests/common/arithmetic/Makefile
new file mode 100644
index 000000000000..7f1fa96cd872
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/arithmetic/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DIV_ZERO.divby0.d \
+ err.D_DIV_ZERO.divby0_1.d \
+ err.D_DIV_ZERO.divby0_2.d \
+ err.D_DIV_ZERO.modby0.d \
+ err.D_SYNTAX.addmin.d \
+ err.D_SYNTAX.divmin.d \
+ err.D_SYNTAX.muladd.d \
+ err.D_SYNTAX.muldiv.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.compcast.d \
+ tst.compcast.d.out \
+ tst.compnarrowassign.d \
+ tst.compnarrowassign.d.out \
+ tst.execcast.d \
+ tst.execcast.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/arrays/Makefile b/cddl/usr.sbin/dtrace/tests/common/arrays/Makefile
new file mode 100644
index 000000000000..608388f4ce45
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/arrays/Makefile
@@ -0,0 +1,29 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ARR_BADREF.bad.d \
+ err.D_DECL_ARRBIG.toobig.d \
+ err.D_DECL_ARRNULL.bad.d \
+ err.D_DECL_ARRSUB.bad.d \
+ err.D_DECL_PROTO_TYPE.badtuple.d \
+ err.D_IDENT_UNDEF.badureg.d \
+ tst.basic1.d \
+ tst.basic2.d \
+ tst.basic3.d \
+ tst.basic4.d \
+ tst.basic5.d \
+ tst.basic6.d \
+ tst.uregsarray.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/assocs/Makefile b/cddl/usr.sbin/dtrace/tests/common/assocs/Makefile
new file mode 100644
index 000000000000..5d20b611ca08
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/assocs/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_OP_INCOMPAT.dupgtype.d \
+ err.D_OP_INCOMPAT.dupttype.d \
+ err.D_OP_INCOMPAT.this.d \
+ err.D_PROTO_ARG.badsig.d \
+ err.D_PROTO_LEN.toofew.d \
+ err.D_PROTO_LEN.toomany.d \
+ err.D_SYNTAX.errassign.d \
+ err.tupoflow.d \
+ tst.cpyarray.d \
+ tst.diffprofile.d \
+ tst.initialize.d \
+ tst.invalidref.d \
+ tst.misc.d \
+ tst.orthogonality.d \
+ tst.this.d \
+ tst.valassign.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/begin/Makefile b/cddl/usr.sbin/dtrace/tests/common/begin/Makefile
new file mode 100644
index 000000000000..4437db9516e2
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/begin/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.begin.d \
+ err.D_PDESC_ZERO.tick.d \
+ tst.begin.d \
+ tst.begin.d.out \
+ tst.multibegin.d \
+ tst.multibegin.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/bitfields/Makefile b/cddl/usr.sbin/dtrace/tests/common/bitfields/Makefile
new file mode 100644
index 000000000000..838ad681ec45
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/bitfields/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ADDROF_BITFIELD.BitfieldAddress.d \
+ err.D_DECL_BFCONST.NegBitField.d \
+ err.D_DECL_BFCONST.ZeroBitField.d \
+ err.D_DECL_BFSIZE.ExceedBaseType.d \
+ err.D_DECL_BFSIZE.GreaterThan64.d \
+ err.D_DECL_BFTYPE.badtype.d \
+ err.D_OFFSETOF_BITFIELD.d \
+ err.D_SIZEOF_BITFIELD.SizeofBitfield.d \
+ tst.BitFieldPromotion.d \
+ tst.SizeofBitField.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/buffering/Makefile b/cddl/usr.sbin/dtrace/tests/common/buffering/Makefile
new file mode 100644
index 000000000000..7fe869bd2d4b
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/buffering/Makefile
@@ -0,0 +1,37 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.end.d \
+ err.resize1.d \
+ err.resize2.d \
+ err.resize3.d \
+ err.zerobuf.d \
+ tst.alignring.d \
+ tst.cputime.ksh \
+ tst.dynvarsize.d \
+ tst.fill1.d \
+ tst.fill1.d.out \
+ tst.resize1.d \
+ tst.resize2.d \
+ tst.resize3.d \
+ tst.ring1.d \
+ tst.ring2.d \
+ tst.ring2.d.out \
+ tst.ring3.d \
+ tst.ring3.d.out \
+ tst.smallring.d \
+ tst.switch1.d \
+ tst.switch1.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/builtinvar/Makefile b/cddl/usr.sbin/dtrace/tests/common/builtinvar/Makefile
new file mode 100644
index 000000000000..b955be545b3f
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/builtinvar/Makefile
@@ -0,0 +1,48 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_XLATE_NOCONV.cpuusage.d \
+ err.D_XLATE_NOCONV.nice.d \
+ err.D_XLATE_NOCONV.priority.d \
+ err.D_XLATE_NOCONV.prsize.d \
+ err.D_XLATE_NOCONV.rssize.d \
+ tst.arg0.d \
+ tst.arg0clause.d \
+ tst.arg1.d \
+ tst.arg1to8.d \
+ tst.arg1to8clause.d \
+ tst.caller.d \
+ tst.caller1.d \
+ tst.epid.d \
+ tst.epid1.d \
+ tst.errno.d \
+ tst.errno1.d \
+ tst.execname.d \
+ tst.hpriority.d \
+ tst.id.d \
+ tst.id1.d \
+ tst.ipl.d \
+ tst.ipl1.d \
+ tst.lwpsinfo.d \
+ tst.lwpsinfo1.d \
+ tst.pid.d \
+ tst.pid1.d \
+ tst.psinfo.d \
+ tst.psinfo1.d \
+ tst.tid.d \
+ tst.tid1.d \
+ tst.timestamp.d \
+ tst.vtimestamp.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/cg/Makefile b/cddl/usr.sbin/dtrace/tests/common/cg/Makefile
new file mode 100644
index 000000000000..5550a8e5e066
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/cg/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_NOREG.noreg.d \
+ err.baddif.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/clauses/Makefile b/cddl/usr.sbin/dtrace/tests/common/clauses/Makefile
new file mode 100644
index 000000000000..5d582f3e47ad
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/clauses/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_IDENT_UNDEF.aggfun.d \
+ err.D_IDENT_UNDEF.aggtup.d \
+ err.D_IDENT_UNDEF.arrtup.d \
+ err.D_IDENT_UNDEF.body.d \
+ err.D_IDENT_UNDEF.both.d \
+ err.D_IDENT_UNDEF.pred.d \
+ tst.nopred.d \
+ tst.pred.d \
+ tst.predfirst.d \
+ tst.predlast.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/cpc/Makefile b/cddl/usr.sbin/dtrace/tests/common/cpc/Makefile
new file mode 100644
index 000000000000..ad23c5a10713
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/cpc/Makefile
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.lowfrequency.d \
+ err.D_PDESC_ZERO.malformedoverflow.d \
+ err.D_PDESC_ZERO.nonexistentevent.d \
+ err.cpcvscpustatpart1.ksh \
+ err.cpcvscpustatpart2.ksh \
+ err.cputrackfailtostart.ksh \
+ err.cputrackterminates.ksh \
+ err.toomanyenablings.d \
+ tst.allcpus.ksh \
+ tst.genericevent.d \
+ tst.platformevent.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/decls/Makefile b/cddl/usr.sbin/dtrace/tests/common/decls/Makefile
new file mode 100644
index 000000000000..21544d901893
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/decls/Makefile
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DECL_LOCASSC.NonLocalAssoc.d \
+ err.D_DECL_LONGINT.LongStruct.d \
+ err.D_DECL_PARMCLASS.BadStorageClass.d \
+ err.D_DECL_PROTO_NAME.VoidName.d \
+ err.D_DECL_PROTO_TYPE.Dyn.d \
+ err.D_DECL_PROTO_VARARGS.VarLenArgs.d \
+ err.D_DECL_PROTO_VOID.NonSoleVoid.d \
+ err.D_DECL_SIGNINT.UnsignedStruct.d \
+ err.D_DECL_VOIDATTR.ShortVoidDecl.d \
+ tst.arrays.d \
+ tst.basics.d \
+ tst.funcs.d \
+ tst.pointers.d \
+ tst.varargsfuncs.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/docsExamples/Makefile b/cddl/usr.sbin/dtrace/tests/common/docsExamples/Makefile
new file mode 100644
index 000000000000..621286244716
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/docsExamples/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ badptr.d \
+ countdown.d \
+ counter.d \
+ errorpath.d \
+ hello.d \
+ kstat.d \
+ ksyms.d \
+ renormalize.d \
+ rtime.d \
+ rw.d \
+ rwinfo.d \
+ rwtime.d \
+ specopen.d \
+ truss.d \
+ trussrw.d \
+ userfunc.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/drops/Makefile b/cddl/usr.sbin/dtrace/tests/common/drops/Makefile
new file mode 100644
index 000000000000..248c20117f22
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/drops/Makefile
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ drp.DTRACEDROP_AGGREGATION.d \
+ drp.DTRACEDROP_DBLERROR.d \
+ drp.DTRACEDROP_DYNAMIC.d \
+ drp.DTRACEDROP_PRINCIPAL.d \
+ drp.DTRACEDROP_PRINCIPAL.end.d \
+ drp.DTRACEDROP_SPEC.d \
+ drp.DTRACEDROP_SPECUNAVAIL.d \
+ drp.DTRACEDROP_STKSTROVERFLOW.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/dtraceUtil/Makefile b/cddl/usr.sbin/dtrace/tests/common/dtraceUtil/Makefile
new file mode 100644
index 000000000000..60e65995ee32
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/dtraceUtil/Makefile
@@ -0,0 +1,118 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.InvalidDescription1.d \
+ man.APIVersion.d \
+ man.AddSearchPath.d \
+ man.CoalesceTrace.d \
+ man.ELFGeneration.d \
+ man.IncludedFilePath.d \
+ man.ShowCompilerCode.d \
+ man.VerboseStabilityReport.d \
+ tst.AddSearchPath.d.ksh \
+ tst.BufsizeGiga.d.ksh \
+ tst.BufsizeKilo.d.ksh \
+ tst.BufsizeMega.d.ksh \
+ tst.BufsizeTera.d.ksh \
+ tst.DataModel32.d.ksh \
+ tst.DataModel64.d.ksh \
+ tst.DefineNameWithCPP.d.ksh \
+ tst.DefineNameWithCPP.d.ksh.out \
+ tst.DestructWithFunction.d.ksh \
+ tst.DestructWithFunction.d.ksh.out \
+ tst.DestructWithID.d.ksh \
+ tst.DestructWithID.d.ksh.out \
+ tst.DestructWithModule.d.ksh \
+ tst.DestructWithModule.d.ksh.out \
+ tst.DestructWithName.d.ksh \
+ tst.DestructWithName.d.ksh.out \
+ tst.DestructWithProvider.d.ksh \
+ tst.DestructWithProvider.d.ksh.out \
+ tst.DestructWithoutW.d.ksh \
+ tst.ELFGenerationOut.d.ksh \
+ tst.ELFGenerationWithO.d.ksh \
+ tst.ExitStatus1.d.ksh \
+ tst.ExitStatus2.d.ksh \
+ tst.ExtraneousProbeIds.d.ksh \
+ tst.InvalidFuncName1.d.ksh \
+ tst.InvalidFuncName2.d.ksh \
+ tst.InvalidId1.d.ksh \
+ tst.InvalidId2.d.ksh \
+ tst.InvalidId3.d.ksh \
+ tst.InvalidModule1.d.ksh \
+ tst.InvalidModule2.d.ksh \
+ tst.InvalidModule3.d.ksh \
+ tst.InvalidModule4.d.ksh \
+ tst.InvalidProbeIdentifier.d.ksh \
+ tst.InvalidProvider1.d.ksh \
+ tst.InvalidProvider2.d.ksh \
+ tst.InvalidProvider3.d.ksh \
+ tst.InvalidProvider4.d.ksh \
+ tst.InvalidTraceFunc1.d.ksh \
+ tst.InvalidTraceFunc2.d.ksh \
+ tst.InvalidTraceFunc3.d.ksh \
+ tst.InvalidTraceFunc4.d.ksh \
+ tst.InvalidTraceFunc5.d.ksh \
+ tst.InvalidTraceFunc6.d.ksh \
+ tst.InvalidTraceFunc7.d.ksh \
+ tst.InvalidTraceFunc8.d.ksh \
+ tst.InvalidTraceFunc9.d.ksh \
+ tst.InvalidTraceID1.d.ksh \
+ tst.InvalidTraceID2.d.ksh \
+ tst.InvalidTraceID3.d.ksh \
+ tst.InvalidTraceID4.d.ksh \
+ tst.InvalidTraceID5.d.ksh \
+ tst.InvalidTraceID6.d.ksh \
+ tst.InvalidTraceID7.d.ksh \
+ tst.InvalidTraceModule1.d.ksh \
+ tst.InvalidTraceModule2.d.ksh \
+ tst.InvalidTraceModule3.d.ksh \
+ tst.InvalidTraceModule4.d.ksh \
+ tst.InvalidTraceModule5.d.ksh \
+ tst.InvalidTraceModule6.d.ksh \
+ tst.InvalidTraceModule7.d.ksh \
+ tst.InvalidTraceModule8.d.ksh \
+ tst.InvalidTraceName1.d.ksh \
+ tst.InvalidTraceName2.d.ksh \
+ tst.InvalidTraceName3.d.ksh \
+ tst.InvalidTraceName4.d.ksh \
+ tst.InvalidTraceName5.d.ksh \
+ tst.InvalidTraceName6.d.ksh \
+ tst.InvalidTraceName7.d.ksh \
+ tst.InvalidTraceName8.d.ksh \
+ tst.InvalidTraceName9.d.ksh \
+ tst.InvalidTraceProvider1.d.ksh \
+ tst.InvalidTraceProvider2.d.ksh \
+ tst.InvalidTraceProvider3.d.ksh \
+ tst.InvalidTraceProvider4.d.ksh \
+ tst.InvalidTraceProvider5.d.ksh \
+ tst.MultipleInvalidProbeId.d.ksh \
+ tst.PreprocessorStatement.d.ksh \
+ tst.QuietMode.d.ksh \
+ tst.QuietMode.d.ksh.out \
+ tst.TestCompile.d.ksh \
+ tst.TestCompile.d.ksh.out \
+ tst.UnDefineNameWithCPP.d.ksh \
+ tst.ZeroFunctionProbes.d.ksh \
+ tst.ZeroFunctionProbes.d.ksh.out \
+ tst.ZeroModuleProbes.d.ksh \
+ tst.ZeroModuleProbes.d.ksh.out \
+ tst.ZeroNameProbes.d.ksh \
+ tst.ZeroNameProbes.d.ksh.out \
+ tst.ZeroProbeIdentfier.d.ksh \
+ tst.ZeroProbesWithoutZ.d.ksh \
+ tst.ZeroProviderProbes.d.ksh \
+ tst.ZeroProviderProbes.d.ksh.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/end/Makefile b/cddl/usr.sbin/dtrace/tests/common/end/Makefile
new file mode 100644
index 000000000000..120a0dd5c5cc
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/end/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_IDENT_UNDEF.timespent.d \
+ tst.end.d \
+ tst.endwithoutbegin.d \
+ tst.multibeginend.d \
+ tst.multiend.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/enum/Makefile b/cddl/usr.sbin/dtrace/tests/common/enum/Makefile
new file mode 100644
index 000000000000..ee6ab1a476e4
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/enum/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DECL_IDRED.EnumSameName.d \
+ err.D_UNKNOWN.RepeatIdentifiers.d \
+ tst.EnumEquality.d \
+ tst.EnumSameValue.d \
+ tst.EnumValAssign.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/error/Makefile b/cddl/usr.sbin/dtrace/tests/common/error/Makefile
new file mode 100644
index 000000000000..999e28ce893c
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/error/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.DTRACEFLT_BADADDR.d \
+ tst.DTRACEFLT_DIVZERO.d \
+ tst.DTRACEFLT_UNKNOWN.d \
+ tst.error.d \
+ tst.errorend.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/exit/Makefile b/cddl/usr.sbin/dtrace/tests/common/exit/Makefile
new file mode 100644
index 000000000000..d5aa843a58ee
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/exit/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PROTO_LEN.noarg.d \
+ err.exitarg1.d \
+ tst.basic1.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile b/cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile
new file mode 100644
index 000000000000..a84c38d84846
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.notreturn.d \
+ tst.basic.d \
+ tst.functionentry.d \
+ tst.functionreturnvalue.d \
+ tst.ioctlargs.d \
+ tst.offset.d \
+ tst.offsetzero.d \
+ tst.return.d \
+ tst.return0.d \
+ tst.tailcall.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/funcs/Makefile b/cddl/usr.sbin/dtrace/tests/common/funcs/Makefile
new file mode 100644
index 000000000000..4a76912729c3
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/funcs/Makefile
@@ -0,0 +1,113 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_FUNC_UNDEF.progenyofbad1.d \
+ err.D_OP_VFPTR.badop.d \
+ err.D_PROTO_ARG.chillbadarg.d \
+ err.D_PROTO_ARG.copyoutbadarg.d \
+ err.D_PROTO_ARG.mobadarg.d \
+ err.D_PROTO_ARG.raisebadarg.d \
+ err.D_PROTO_ARG.tolower.d \
+ err.D_PROTO_ARG.toupper.d \
+ err.D_PROTO_LEN.allocanoarg.d \
+ err.D_PROTO_LEN.badbreakpoint.d \
+ err.D_PROTO_LEN.chilltoofew.d \
+ err.D_PROTO_LEN.chilltoomany.d \
+ err.D_PROTO_LEN.copyoutstrbadarg.d \
+ err.D_PROTO_LEN.copyoutstrtoofew.d \
+ err.D_PROTO_LEN.copyouttoofew.d \
+ err.D_PROTO_LEN.copyouttoomany.d \
+ err.D_PROTO_LEN.motoofew.d \
+ err.D_PROTO_LEN.motoomany.d \
+ err.D_PROTO_LEN.mtabadarg.d \
+ err.D_PROTO_LEN.mtatoofew.d \
+ err.D_PROTO_LEN.mtatoomany.d \
+ err.D_PROTO_LEN.panicbadarg.d \
+ err.D_PROTO_LEN.progenyofbad2.d \
+ err.D_PROTO_LEN.stopbadarg.d \
+ err.D_PROTO_LEN.tolower.d \
+ err.D_PROTO_LEN.tolowertoomany.d \
+ err.D_PROTO_LEN.toupper.d \
+ err.D_PROTO_LEN.touppertoomany.d \
+ err.D_STRINGOF_TYPE.badstringof.d \
+ err.D_VAR_UNDEF.badvar.d \
+ err.badalloca.d \
+ err.badalloca2.d \
+ err.badbcopy.d \
+ err.badbcopy1.d \
+ err.badbcopy2.d \
+ err.badbcopy3.d \
+ err.badbcopy4.d \
+ err.badbcopy5.d \
+ err.badbcopy6.d \
+ err.badchill.d \
+ err.chillbadarg.ksh \
+ err.copyout.d \
+ err.copyoutbadaddr.ksh \
+ err.copyoutstrbadaddr.ksh \
+ err.inet_ntoa6badaddr.d \
+ err.inet_ntoabadaddr.d \
+ err.inet_ntopbadaddr.d \
+ err.inet_ntopbadarg.d \
+ tst.badfreopen.ksh \
+ tst.basename.d \
+ tst.basename.d.out \
+ tst.bcopy.d \
+ tst.chill.ksh \
+ tst.cleanpath.d \
+ tst.cleanpath.d.out \
+ tst.copyin.d \
+ tst.copyinto.d \
+ tst.ddi_pathname.d \
+ tst.default.d \
+ tst.freopen.ksh \
+ tst.ftruncate.ksh \
+ tst.ftruncate.ksh.out \
+ tst.hton.d \
+ tst.index.d \
+ tst.index.d.out \
+ tst.inet_ntoa.d \
+ tst.inet_ntoa.d.out \
+ tst.inet_ntoa6.d \
+ tst.inet_ntoa6.d.out \
+ tst.inet_ntop.d \
+ tst.inet_ntop.d.out \
+ tst.lltostr.d \
+ tst.lltostr.d.out \
+ tst.lltostrbase.d \
+ tst.lltostrbase.d.out \
+ tst.mutex_owned.d \
+ tst.mutex_owner.d \
+ tst.mutex_type_adaptive.d \
+ tst.progenyof.d \
+ tst.rand.d \
+ tst.strchr.d \
+ tst.strchr.d.out \
+ tst.strjoin.d \
+ tst.strjoin.d.out \
+ tst.strstr.d \
+ tst.strstr.d.out \
+ tst.strtok.d \
+ tst.strtok.d.out \
+ tst.strtok_null.d \
+ tst.substr.d \
+ tst.substr.d.out \
+ tst.substrminate.d \
+ tst.substrminate.d.out \
+ tst.system.d \
+ tst.system.d.out \
+ tst.tolower.d \
+ tst.toupper.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/grammar/Makefile b/cddl/usr.sbin/dtrace/tests/common/grammar/Makefile
new file mode 100644
index 000000000000..e1854ae8021e
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/grammar/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ADDROF_LVAL.d \
+ err.D_EMPTY.empty.d \
+ tst.clauses.d \
+ tst.stmts.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/include/Makefile b/cddl/usr.sbin/dtrace/tests/common/include/Makefile
new file mode 100644
index 000000000000..b5002e9044f4
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/include/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.includefirst.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/inline/Makefile b/cddl/usr.sbin/dtrace/tests/common/inline/Makefile
new file mode 100644
index 000000000000..7f848fdf619d
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/inline/Makefile
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DECL_IDRED.redef1.d \
+ err.D_DECL_IDRED.redef2.d \
+ err.D_IDENT_UNDEF.recur.d \
+ err.D_OP_INCOMPAT.baddef1.d \
+ err.D_OP_INCOMPAT.baddef2.d \
+ err.D_OP_INCOMPAT.badxlate.d \
+ tst.InlineDataAssign.d \
+ tst.InlineExpression.d \
+ tst.InlineKinds.d \
+ tst.InlineKinds.d.out \
+ tst.InlineTypedef.d \
+ tst.InlineWritableAssign.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/io/Makefile b/cddl/usr.sbin/dtrace/tests/common/io/Makefile
new file mode 100644
index 000000000000..ad6235186870
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/io/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.fds.d \
+ tst.fds.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.fds.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/ip/Makefile b/cddl/usr.sbin/dtrace/tests/common/ip/Makefile
new file mode 100644
index 000000000000..369068a17904
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/ip/Makefile
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.ipv4localicmp.ksh \
+ tst.ipv4localicmp.ksh.out \
+ tst.ipv4localtcp.ksh \
+ tst.ipv4localtcp.ksh.out \
+ tst.ipv4localudp.ksh \
+ tst.ipv4localudp.ksh.out \
+ tst.ipv4remoteicmp.ksh \
+ tst.ipv4remoteicmp.ksh.out \
+ tst.ipv4remotetcp.ksh \
+ tst.ipv4remotetcp.ksh.out \
+ tst.ipv4remoteudp.ksh \
+ tst.ipv4remoteudp.ksh.out \
+ tst.ipv6localicmp.ksh \
+ tst.ipv6localicmp.ksh.out \
+ tst.ipv6remoteicmp.ksh \
+ tst.ipv6remoteicmp.ksh.out \
+ tst.localtcpstate.ksh \
+ tst.localtcpstate.ksh.out \
+ tst.remotetcpstate.ksh \
+ tst.remotetcpstate.ksh.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/java_api/Makefile b/cddl/usr.sbin/dtrace/tests/common/java_api/Makefile
new file mode 100644
index 000000000000..4ef225a2bfda
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/java_api/Makefile
@@ -0,0 +1,44 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.Abort.ksh \
+ tst.Abort.ksh.out \
+ tst.Bean.ksh \
+ tst.Bean.ksh.out \
+ tst.Close.ksh \
+ tst.Close.ksh.out \
+ tst.Drop.ksh \
+ tst.Drop.ksh.out \
+ tst.Enable.ksh \
+ tst.Enable.ksh.out \
+ tst.FunctionLookup.ksh \
+ tst.FunctionLookup.ksh.out \
+ tst.GetAggregate.ksh \
+ tst.MaxConsumers.ksh \
+ tst.MaxConsumers.ksh.out \
+ tst.MultiAggPrinta.ksh \
+ tst.MultiAggPrinta.ksh.out \
+ tst.ProbeData.ksh \
+ tst.ProbeData.ksh.out \
+ tst.ProbeDescription.ksh \
+ tst.ProbeDescription.ksh.out \
+ tst.StateMachine.ksh \
+ tst.StateMachine.ksh.out \
+ tst.StopLock.ksh \
+ tst.StopLock.ksh.out \
+ tst.printa.d \
+ tst.printa.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.FunctionLookup.c \
+ tst.ProbeData.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/json/Makefile b/cddl/usr.sbin/dtrace/tests/common/json/Makefile
new file mode 100644
index 000000000000..160fcae7e5a8
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/json/Makefile
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.general.d \
+ tst.general.d.out \
+ tst.strsize.d \
+ tst.strsize.d.out \
+ tst.usdt.d \
+ tst.usdt.d.out \
+ usdt.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.usdt.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/lexer/Makefile b/cddl/usr.sbin/dtrace/tests/common/lexer/Makefile
new file mode 100644
index 000000000000..39063e4dd6e1
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/lexer/Makefile
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_CHR_NL.char.d \
+ err.D_CHR_NULL.char.d \
+ err.D_INT_DIGIT.InvalidDigit.d \
+ err.D_INT_OFLOW.BigInt.d \
+ err.D_STR_NL.string.d \
+ err.D_SYNTAX.brace1.d \
+ err.D_SYNTAX.brace2.d \
+ err.D_SYNTAX.brack1.d \
+ err.D_SYNTAX.brack2.d \
+ err.D_SYNTAX.brack3.d \
+ err.D_SYNTAX.paren1.d \
+ err.D_SYNTAX.paren2.d \
+ err.D_SYNTAX.paren3.d \
+ tst.D_MACRO_OFLOW.ParIntOvflow.d.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile b/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile
new file mode 100644
index 000000000000..1f33e8ad408f
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile
@@ -0,0 +1,50 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_LLQUANT_FACTOREVEN.nodivide.d \
+ err.D_LLQUANT_FACTOREVEN.notfactor.d \
+ err.D_LLQUANT_FACTORMATCH.d \
+ err.D_LLQUANT_FACTORNSTEPS.d \
+ err.D_LLQUANT_FACTORSMALL.d \
+ err.D_LLQUANT_FACTORTYPE.d \
+ err.D_LLQUANT_FACTORVAL.d \
+ err.D_LLQUANT_HIGHMATCH.d \
+ err.D_LLQUANT_HIGHTYPE.d \
+ err.D_LLQUANT_HIGHVAL.d \
+ err.D_LLQUANT_LOWMATCH.d \
+ err.D_LLQUANT_LOWTYPE.d \
+ err.D_LLQUANT_LOWVAL.d \
+ err.D_LLQUANT_MAGRANGE.d \
+ err.D_LLQUANT_MAGTOOBIG.d \
+ err.D_LLQUANT_NSTEPMATCH.d \
+ err.D_LLQUANT_NSTEPTYPE.d \
+ err.D_LLQUANT_NSTEPVAL.d \
+ tst.bases.d \
+ tst.bases.d.out \
+ tst.basic.d \
+ tst.basic.d.out \
+ tst.negorder.d \
+ tst.negorder.d.out \
+ tst.negvalue.d \
+ tst.negvalue.d.out \
+ tst.normal.d \
+ tst.normal.d.out \
+ tst.range.d \
+ tst.range.d.out \
+ tst.steps.d \
+ tst.steps.d.out \
+ tst.trunc.d \
+ tst.trunc.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/mdb/Makefile b/cddl/usr.sbin/dtrace/tests/common/mdb/Makefile
new file mode 100644
index 000000000000..24a3f885389f
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/mdb/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.dtracedcmd.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/mib/Makefile b/cddl/usr.sbin/dtrace/tests/common/mib/Makefile
new file mode 100644
index 000000000000..ef3a05dc68d4
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/mib/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.icmp.ksh \
+ tst.tcp.ksh \
+ tst.udp.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/misc/Makefile b/cddl/usr.sbin/dtrace/tests/common/misc/Makefile
new file mode 100644
index 000000000000..31de20b450c2
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/misc/Makefile
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRAGMA_OPTSET.d \
+ tst.badopt.d \
+ tst.boolopt.d \
+ tst.boolopt.d.out \
+ tst.dofmax.ksh \
+ tst.dynopt.d \
+ tst.dynopt.d.out \
+ tst.enablerace.ksh \
+ tst.haslam.d \
+ tst.include.ksh \
+ tst.macroglob.ksh \
+ tst.macroglob.ksh.out \
+ tst.roch.d \
+ tst.schrock.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/multiaggs/Makefile b/cddl/usr.sbin/dtrace/tests/common/multiaggs/Makefile
new file mode 100644
index 000000000000..e21c90ae20fc
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/multiaggs/Makefile
@@ -0,0 +1,34 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRINTA_AGGKEY.d \
+ err.D_PRINTA_AGGPROTO.d \
+ tst.many.d \
+ tst.many.d.out \
+ tst.same.d \
+ tst.same.d.out \
+ tst.sort.d \
+ tst.sort.d.out \
+ tst.sortpos.d \
+ tst.sortpos.d.out \
+ tst.tuplecompat.d \
+ tst.tuplecompat.d.out \
+ tst.zero.d \
+ tst.zero.d.out \
+ tst.zero2.d \
+ tst.zero2.d.out \
+ tst.zero3.d \
+ tst.zero3.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/nfs/Makefile b/cddl/usr.sbin/dtrace/tests/common/nfs/Makefile
new file mode 100644
index 000000000000..446c35eea790
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/nfs/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.call.d \
+ tst.call3.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.call.c \
+ tst.call3.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/offsetof/Makefile b/cddl/usr.sbin/dtrace/tests/common/offsetof/Makefile
new file mode 100644
index 000000000000..375aecb2045e
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/offsetof/Makefile
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_OFFSETOF_BITFIELD.bitfield.d \
+ err.D_OFFSETOF_TYPE.badtype.d \
+ err.D_OFFSETOF_TYPE.notsou.d \
+ err.D_UNKNOWN.OffsetofNULL.d \
+ err.D_UNKNOWN.badmemb.d \
+ tst.OffsetofAlias.d \
+ tst.OffsetofArith.d \
+ tst.OffsetofUnion.d \
+ tst.struct.d \
+ tst.struct.d.out \
+ tst.union.d \
+ tst.union.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/operators/Makefile b/cddl/usr.sbin/dtrace/tests/common/operators/Makefile
new file mode 100644
index 000000000000..08bbfe6abee8
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/operators/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.ternary.d \
+ tst.ternary.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/pid/Makefile b/cddl/usr.sbin/dtrace/tests/common/pid/Makefile
new file mode 100644
index 000000000000..faa5ac8545e1
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/pid/Makefile
@@ -0,0 +1,69 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.badlib.d \
+ err.D_PDESC_ZERO.badproc1.d \
+ err.D_PROC_BADPID.badproc2.d \
+ err.D_PROC_CREATEFAIL.many.d \
+ err.D_PROC_FUNC.badfunc.d \
+ err.D_PROC_LIB.libdash.d \
+ err.D_PROC_NAME.alldash.d \
+ err.D_PROC_NAME.badname.d \
+ err.D_PROC_NAME.globdash.d \
+ err.D_PROC_OFF.toobig.d \
+ tst.addprobes.ksh \
+ tst.args1.d \
+ tst.coverage.d \
+ tst.emptystack.d \
+ tst.emptystack.d.out \
+ tst.float.d \
+ tst.fork.d \
+ tst.gcc.d \
+ tst.killonerror.ksh \
+ tst.main.ksh \
+ tst.manypids.ksh \
+ tst.newprobes.ksh \
+ tst.newprobes.ksh.out \
+ tst.probemod.ksh \
+ tst.provregex1.ksh \
+ tst.provregex2.ksh \
+ tst.provregex2.ksh.out \
+ tst.provregex3.ksh \
+ tst.provregex3.ksh.out \
+ tst.provregex4.ksh \
+ tst.provregex4.ksh.out \
+ tst.ret1.d \
+ tst.ret2.d \
+ tst.vfork.d \
+ tst.weak1.d \
+ tst.weak2.d \
+
+TESTEXES= \
+ err.D_PDESC_ZERO.badlib.exe \
+ err.D_PROC_CREATEFAIL.many.exe \
+ err.D_PROC_FUNC.badfunc.exe \
+ err.D_PROC_LIB.libdash.exe \
+ err.D_PROC_NAME.alldash.exe \
+ err.D_PROC_NAME.badname.exe \
+ err.D_PROC_NAME.globdash.exe \
+ err.D_PROC_OFF.toobig.exe \
+ tst.coverage.exe \
+ tst.emptystack.exe \
+
+CFILES= \
+ tst.args1.c \
+ tst.float.c \
+ tst.fork.c \
+ tst.gcc.c \
+ tst.ret1.c \
+ tst.ret2.c \
+ tst.vfork.c \
+ tst.weak1.c \
+ tst.weak2.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/plockstat/Makefile b/cddl/usr.sbin/dtrace/tests/common/plockstat/Makefile
new file mode 100644
index 000000000000..0f36f344a0dc
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/plockstat/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.available.d \
+ tst.libmap.d \
+
+TESTEXES= \
+ tst.available.exe \
+ tst.libmap.exe \
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/pointers/Makefile b/cddl/usr.sbin/dtrace/tests/common/pointers/Makefile
new file mode 100644
index 000000000000..2953c5473a1c
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/pointers/Makefile
@@ -0,0 +1,48 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.BadAlign.d \
+ err.D_ADDROF_VAR.ArrayVar.d \
+ err.D_ADDROF_VAR.DynamicVar.d \
+ err.D_ADDROF_VAR.agg.d \
+ err.D_DEREF_NONPTR.noptr.d \
+ err.D_DEREF_VOID.VoidPointerDeref.d \
+ err.D_OP_ARRFUN.ArrayAssignment.d \
+ err.D_OP_INCOMPAT.VoidPointerArith.d \
+ err.D_OP_LVAL.AddressChange.d \
+ err.D_OP_PTR.NonPointerAccess.d \
+ err.D_OP_PTR.badpointer.d \
+ err.D_OP_SOU.BadPointerAccess.d \
+ err.D_OP_SOU.badpointer.d \
+ err.InvalidAddress1.d \
+ err.InvalidAddress2.d \
+ err.InvalidAddress3.d \
+ err.InvalidAddress4.d \
+ err.InvalidAddress5.d \
+ tst.ArrayPointer1.d \
+ tst.ArrayPointer2.d \
+ tst.ArrayPointer3.d \
+ tst.GlobalVar.d \
+ tst.IntegerArithmetic1.d \
+ tst.PointerArithmetic1.d \
+ tst.PointerArithmetic2.d \
+ tst.PointerArithmetic3.d \
+ tst.PointerAssignment.d \
+ tst.ValidPointer1.d \
+ tst.ValidPointer2.d \
+ tst.VoidCast.d \
+ tst.basic1.d \
+ tst.basic2.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/pragma/Makefile b/cddl/usr.sbin/dtrace/tests/common/pragma/Makefile
new file mode 100644
index 000000000000..86010ac306aa
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/pragma/Makefile
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRAGERR.d \
+ err.D_PRAGMA_DEPEND.main.d \
+ err.D_PRAGMA_INVAL.d \
+ err.D_PRAGMA_MALFORM.d \
+ err.D_PRAGMA_UNUSED.UnusedPragma.d \
+ err.circlibdep.ksh \
+ err.invalidlibdep.ksh \
+ tst.libchain.ksh \
+ tst.libdep.ksh \
+ tst.libdepfullyconnected.ksh \
+ tst.libdepsepdir.ksh \
+ tst.temporal.ksh \
+ tst.temporal2.ksh \
+ tst.temporal3.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/predicates/Makefile b/cddl/usr.sbin/dtrace/tests/common/predicates/Makefile
new file mode 100644
index 000000000000..67cfabe09dc8
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/predicates/Makefile
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRED_SCALAR.NonScalarPred.d \
+ err.D_SYNTAX.invalid.d \
+ err.D_SYNTAX.operr.d \
+ tst.argsnotcached.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.complex.d \
+ tst.complex.d.out \
+ tst.predcache.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/preprocessor/Makefile b/cddl/usr.sbin/dtrace/tests/common/preprocessor/Makefile
new file mode 100644
index 000000000000..8108375ecd25
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/preprocessor/Makefile
@@ -0,0 +1,53 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_IDENT_UNDEF.afterprobe.d \
+ err.D_PRAGCTL_INVAL.tabdefine.d \
+ err.D_SYNTAX.withoutpound.d \
+ err.defincomp.d \
+ err.ifdefelsenotendif.d \
+ err.ifdefincomp.d \
+ err.ifdefnotendif.d \
+ err.incompelse.d \
+ err.mulelse.d \
+ tst.ifdef.d \
+ tst.ifdef.d.out \
+ tst.ifndef.d \
+ tst.ifndef.d.out \
+ tst.ifnotdef.d \
+ tst.ifnotdef.d.out \
+ tst.logicaland.d \
+ tst.logicaland.d.out \
+ tst.logicalandor.d \
+ tst.logicalandor.d.out \
+ tst.logicalor.d \
+ tst.logicalor.d.out \
+ tst.muland.d \
+ tst.muland.d.out \
+ tst.mulor.d \
+ tst.mulor.d.out \
+ tst.precondi.d \
+ tst.precondi.d.out \
+ tst.predicatedeclare.d \
+ tst.preexp.d \
+ tst.preexp.d.out \
+ tst.preexpelse.d \
+ tst.preexpelse.d.out \
+ tst.preexpif.d \
+ tst.preexpif.d.out \
+ tst.preexpifelse.d \
+ tst.preexpifelse.d.out \
+ tst.withinprobe.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/print/Makefile b/cddl/usr.sbin/dtrace/tests/common/print/Makefile
new file mode 100644
index 000000000000..4360794187c2
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/print/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRINT_AGG.bad.d \
+ err.D_PRINT_VOID.bad.d \
+ err.D_PROTO_LEN.bad.d \
+ tst.array.d \
+ tst.array.d.out \
+ tst.bitfield.d \
+ tst.bitfield.d.out \
+ tst.dyn.d \
+ tst.enum.d \
+ tst.enum.d.out \
+ tst.primitive.d \
+ tst.primitive.d.out \
+ tst.struct.d \
+ tst.struct.d.out \
+ tst.xlate.d \
+ tst.xlate.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/printa/Makefile b/cddl/usr.sbin/dtrace/tests/common/printa/Makefile
new file mode 100644
index 000000000000..c972db376db4
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/printa/Makefile
@@ -0,0 +1,40 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRINTA_AGGARG.badagg.d \
+ err.D_PRINTA_AGGARG.badfmt.d \
+ err.D_PRINTA_AGGARG.badval.d \
+ err.D_PRINTA_PROTO.bad.d \
+ err.D_PRINTF_ARG_TYPE.jstack.d \
+ err.D_PRINTF_ARG_TYPE.stack.d \
+ err.D_PRINTF_ARG_TYPE.ustack.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.def.d \
+ tst.def.d.out \
+ tst.dynwidth.d \
+ tst.dynwidth.d.out \
+ tst.fmt.d \
+ tst.fmt.d.out \
+ tst.largeusersym.ksh \
+ tst.many.d \
+ tst.manyval.d \
+ tst.manyval.d.out \
+ tst.stack.d \
+ tst.tuple.d \
+ tst.tuple.d.out \
+ tst.walltimestamp.ksh \
+ tst.walltimestamp.ksh.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/printf/Makefile b/cddl/usr.sbin/dtrace/tests/common/printf/Makefile
new file mode 100644
index 000000000000..d4658b1610d7
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/printf/Makefile
@@ -0,0 +1,68 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRINTF_AGG_CONV.aggfmt.d \
+ err.D_PRINTF_ARG_EXTRA.toomany.d \
+ err.D_PRINTF_ARG_EXTRA.widths.d \
+ err.D_PRINTF_ARG_FMT.badfmt.d \
+ err.D_PRINTF_ARG_PROTO.novalue.d \
+ err.D_PRINTF_ARG_TYPE.aggarg.d \
+ err.D_PRINTF_ARG_TYPE.recursive.d \
+ err.D_PRINTF_DYN_PROTO.noprec.d \
+ err.D_PRINTF_DYN_PROTO.nowidth.d \
+ err.D_PRINTF_DYN_TYPE.badprec.d \
+ err.D_PRINTF_DYN_TYPE.badwidth.d \
+ err.D_PROTO_LEN.toofew.d \
+ err.D_SYNTAX.badconv1.d \
+ err.D_SYNTAX.badconv2.d \
+ err.D_SYNTAX.badconv3.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.flags.d \
+ tst.flags.d.out \
+ tst.hello.d \
+ tst.hello.d.out \
+ tst.ints.d \
+ tst.ints.d.out \
+ tst.precs.d \
+ tst.precs.d.out \
+ tst.print-f.d \
+ tst.print-f.d.out \
+ tst.printT.ksh \
+ tst.printT.ksh.out \
+ tst.printY.ksh \
+ tst.printY.ksh.out \
+ tst.printcont.d \
+ tst.printcont.d.out \
+ tst.printeE.d \
+ tst.printeE.d.out \
+ tst.printgG.d \
+ tst.printgG.d.out \
+ tst.rawfmt.d \
+ tst.rawfmt.d.out \
+ tst.signs.d \
+ tst.signs.d.out \
+ tst.str.d \
+ tst.str.d.out \
+ tst.sym.d \
+ tst.sym.d.out \
+ tst.uints.d \
+ tst.uints.d.out \
+ tst.widths.d \
+ tst.widths.d.out \
+ tst.widths1.d \
+ tst.wp.d \
+ tst.wp.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/privs/Makefile b/cddl/usr.sbin/dtrace/tests/common/privs/Makefile
new file mode 100644
index 000000000000..119ebe5538de
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/privs/Makefile
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.fds.ksh \
+ tst.func_access.ksh \
+ tst.getf.ksh \
+ tst.op_access.ksh \
+ tst.procpriv.ksh \
+ tst.providers.ksh \
+ tst.unpriv_funcs.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/probes/Makefile b/cddl/usr.sbin/dtrace/tests/common/probes/Makefile
new file mode 100644
index 000000000000..463290b944ea
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/probes/Makefile
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.probeqtn.d \
+ err.D_PDESC_ZERO.probestar.d \
+ err.D_PDESC_ZERO.tickstar.d \
+ err.D_SYNTAX.assign.d \
+ err.D_SYNTAX.declare.d \
+ err.D_SYNTAX.declarein.d \
+ err.D_SYNTAX.lbraces.d \
+ err.D_SYNTAX.probespec.d \
+ err.D_SYNTAX.rbraces.d \
+ err.D_SYNTAX.recdec.d \
+ tst.basic1.d \
+ tst.check.d \
+ tst.declare.d \
+ tst.declareafter.d \
+ tst.emptyprobe.d \
+ tst.pragma.d \
+ tst.pragmaaftertab.d \
+ tst.pragmainside.d \
+ tst.pragmaoutside.d \
+ tst.probestar.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/proc/Makefile b/cddl/usr.sbin/dtrace/tests/common/proc/Makefile
new file mode 100644
index 000000000000..5ab672b6d985
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/proc/Makefile
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.create.ksh \
+ tst.discard.ksh \
+ tst.exec.ksh \
+ tst.execfail.ENOENT.ksh \
+ tst.execfail.ksh \
+ tst.exitcore.ksh \
+ tst.exitexit.ksh \
+ tst.exitkilled.ksh \
+ tst.signal.ksh \
+ tst.sigwait.d \
+ tst.startexit.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.sigwait.c \
+
+
+LDADD.tst.sigwait.exe+= -lrt
+DPADD.tst.sigwait.exe+= ${LIBRT}
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/profile-n/Makefile b/cddl/usr.sbin/dtrace/tests/common/profile-n/Makefile
new file mode 100644
index 000000000000..cb6ad9f9e66b
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/profile-n/Makefile
@@ -0,0 +1,53 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.profile.d \
+ err.D_PDESC_ZEROonens.d \
+ err.D_PDESC_ZEROonensec.d \
+ err.D_PDESC_ZEROoneus.d \
+ err.D_PDESC_ZEROoneusec.d \
+ tst.argtest.d \
+ tst.argtest.d.out \
+ tst.basic.d \
+ tst.basic.d.out \
+ tst.func.ksh \
+ tst.mod.ksh \
+ tst.profilehz.d \
+ tst.profilehz.d.out \
+ tst.profilems.d \
+ tst.profilems.d.out \
+ tst.profilemsec.d \
+ tst.profilemsec.d.out \
+ tst.profilenhz.d \
+ tst.profilenhz.d.out \
+ tst.profilens.d \
+ tst.profilens.d.out \
+ tst.profilensec.d \
+ tst.profilensec.d.out \
+ tst.profiles.d \
+ tst.profiles.d.out \
+ tst.profilesec.d \
+ tst.profilesec.d.out \
+ tst.profileus.d \
+ tst.profileus.d.out \
+ tst.profileusec.d \
+ tst.profileusec.d.out \
+ tst.sym.ksh \
+ tst.ufunc.ksh \
+ tst.ufuncsort.ksh \
+ tst.ufuncsort.ksh.out \
+ tst.umod.ksh \
+ tst.usym.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.ufuncsort.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/providers/Makefile b/cddl/usr.sbin/dtrace/tests/common/providers/Makefile
new file mode 100644
index 000000000000..763d60bfa7de
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/providers/Makefile
@@ -0,0 +1,44 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_INVAL.wrongdec4.d \
+ err.D_PDESC_ZERO.nonprofile.d \
+ err.D_PDESC_ZERO.wrongdec1.d \
+ err.D_PDESC_ZERO.wrongdec2.d \
+ err.D_PDESC_ZERO.wrongdec3.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.beginexit.d \
+ tst.beginprof.d \
+ tst.beginprof.d.out \
+ tst.probattrs.d \
+ tst.probattrs.d.out \
+ tst.probefunc.d \
+ tst.probefunc.d.out \
+ tst.probemod.d \
+ tst.probemod.d.out \
+ tst.probename.d \
+ tst.probename.d.out \
+ tst.probprov.d \
+ tst.probprov.d.out \
+ tst.profend.d \
+ tst.profend.d.out \
+ tst.profexit.d \
+ tst.profexit.d.out \
+ tst.trace.d \
+ tst.trace.d.out \
+ tst.twoprof.d \
+ tst.twoprof.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/raise/Makefile b/cddl/usr.sbin/dtrace/tests/common/raise/Makefile
new file mode 100644
index 000000000000..f84ac52392ea
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/raise/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.raise1.d \
+ tst.raise2.d \
+ tst.raise3.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.raise1.c \
+ tst.raise2.c \
+ tst.raise3.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/rates/Makefile b/cddl/usr.sbin/dtrace/tests/common/rates/Makefile
new file mode 100644
index 000000000000..a3f54f550484
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/rates/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.aggrate.d \
+ tst.aggrate.d.out \
+ tst.statusrate.d \
+ tst.switchrate.d \
+ tst.switchrate.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/safety/Makefile b/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
new file mode 100644
index 000000000000..0e88ea3c28f7
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
@@ -0,0 +1,54 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.basename.d \
+ tst.caller.d \
+ tst.cleanpath.d \
+ tst.copyin.d \
+ tst.copyin2.d \
+ tst.ddi_pathname.d \
+ tst.dirname.d \
+ tst.errno.d \
+ tst.execname.d \
+ tst.gid.d \
+ tst.hton.d \
+ tst.index.d \
+ tst.msgdsize.d \
+ tst.msgsize.d \
+ tst.null.d \
+ tst.pid.d \
+ tst.ppid.d \
+ tst.progenyof.d \
+ tst.random.d \
+ tst.rw.d \
+ tst.shortstr.d \
+ tst.stack.d \
+ tst.stackdepth.d \
+ tst.stddev.d \
+ tst.strchr.d \
+ tst.strjoin.d \
+ tst.strstr.d \
+ tst.strtok.d \
+ tst.substr.d \
+ tst.ucaller.d \
+ tst.uid.d \
+ tst.unalign.d \
+ tst.uregs.d \
+ tst.ustack.d \
+ tst.ustackdepth.d \
+ tst.vahole.d \
+ tst.violentdeath.ksh \
+ tst.zonename.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile b/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile
new file mode 100644
index 000000000000..8377f6b967fa
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile
@@ -0,0 +1,35 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ARR_LOCAL.thisarray.d \
+ err.D_DECL_CLASS.selfthis.d \
+ err.D_DECL_CLASS.thisself.d \
+ err.D_DECL_IDRED.errval.d \
+ err.D_OP_INCOMPAT.dec.err.d \
+ err.D_OP_INCOMPAT.dupgtype.d \
+ err.D_OP_INCOMPAT.dupltype.d \
+ err.D_OP_INCOMPAT.dupttype.d \
+ err.D_SYNTAX.declare.d \
+ tst.basicvar.d \
+ tst.basicvar.d.out \
+ tst.localvar.d \
+ tst.misc.d \
+ tst.self.d \
+ tst.selfarray.d \
+ tst.selfarray2.d \
+ tst.selfthis.d \
+ tst.this.d \
+ tst.thisself.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/sched/Makefile b/cddl/usr.sbin/dtrace/tests/common/sched/Makefile
new file mode 100644
index 000000000000..adf8c984be0a
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/sched/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.enqueue.d \
+ tst.oncpu.d \
+ tst.stackdepth.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/scripting/Makefile b/cddl/usr.sbin/dtrace/tests/common/scripting/Makefile
new file mode 100644
index 000000000000..0bb10cf3f3b1
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/scripting/Makefile
@@ -0,0 +1,49 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_MACRO_UNDEF.invalidargs.d \
+ err.D_OP_LVAL.rdonly.d \
+ err.D_OP_WRITE.usepidmacro.d \
+ err.D_SYNTAX.concat.d \
+ err.D_SYNTAX.desc.d \
+ err.D_SYNTAX.inval.d \
+ err.D_SYNTAX.pid.d \
+ tst.D_MACRO_UNUSED.overflow.ksh \
+ tst.arg0.d \
+ tst.arguments.ksh \
+ tst.assign.d \
+ tst.basic.d \
+ tst.egid.d \
+ tst.egid.ksh \
+ tst.euid.d \
+ tst.euid.ksh \
+ tst.gid.d \
+ tst.gid.ksh \
+ tst.pgid.d \
+ tst.pid.d \
+ tst.ppid.d \
+ tst.ppid.ksh \
+ tst.projid.d \
+ tst.projid.ksh \
+ tst.quite.d \
+ tst.sid.d \
+ tst.sid.ksh \
+ tst.stringmacro.ksh \
+ tst.taskid.d \
+ tst.taskid.ksh \
+ tst.trace.d \
+ tst.uid.d \
+ tst.uid.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/sdt/Makefile b/cddl/usr.sbin/dtrace/tests/common/sdt/Makefile
new file mode 100644
index 000000000000..598cc69c0fe7
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/sdt/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.sdtargs.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.sdtargs.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/sizeof/Makefile b/cddl/usr.sbin/dtrace/tests/common/sizeof/Makefile
new file mode 100644
index 000000000000..6b146b066713
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/sizeof/Makefile
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_IDENT_BADREF.SizeofAssoc.d \
+ err.D_IDENT_UNDEF.UnknownSymbol.d \
+ err.D_SIZEOF_TYPE.badstruct.d \
+ err.D_SIZEOF_TYPE.d \
+ err.D_SYNTAX.SizeofBadType.d \
+ tst.SizeofArray.d \
+ tst.SizeofDataTypes.d \
+ tst.SizeofExpression.d \
+ tst.SizeofNULL.d \
+ tst.SizeofStrConst.d \
+ tst.SizeofStrConst.d.out \
+ tst.SizeofString1.d \
+ tst.SizeofString1.d.out \
+ tst.SizeofString2.d \
+ tst.SizeofString2.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile b/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile
new file mode 100644
index 000000000000..f17ded9fe9a5
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile
@@ -0,0 +1,75 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ bug.1001148.SpecSizeVariations.d \
+ err.BufSizeVariations1.d \
+ err.BufSizeVariations2.d \
+ err.D_ACT_SPEC.SpeculateWithBreakPoint.d \
+ err.D_ACT_SPEC.SpeculateWithChill.d \
+ err.D_ACT_SPEC.SpeculateWithCopyOut.d \
+ err.D_ACT_SPEC.SpeculateWithCopyOutStr.d \
+ err.D_ACT_SPEC.SpeculateWithPanic.d \
+ err.D_ACT_SPEC.SpeculateWithRaise.d \
+ err.D_ACT_SPEC.SpeculateWithStop.d \
+ err.D_AGG_COMM.AggAftCommit.d \
+ err.D_AGG_SPEC.SpeculateWithAvg.d \
+ err.D_AGG_SPEC.SpeculateWithCount.d \
+ err.D_AGG_SPEC.SpeculateWithLquant.d \
+ err.D_AGG_SPEC.SpeculateWithMax.d \
+ err.D_AGG_SPEC.SpeculateWithMin.d \
+ err.D_AGG_SPEC.SpeculateWithQuant.d \
+ err.D_AGG_SPEC.SpeculateWithStddev.d \
+ err.D_AGG_SPEC.SpeculateWithSum.d \
+ err.D_COMM_COMM.CommitAftCommit.d \
+ err.D_COMM_COMM.DisjointCommit.d \
+ err.D_COMM_DREC.CommitAftDataRec.d \
+ err.D_DREC_COMM.DataRecAftCommit.d \
+ err.D_DREC_COMM.ExitAfterCommit.d \
+ err.D_EXIT_SPEC.ExitAftSpec.d \
+ err.D_PRAGMA_MALFORM.NspecExpr.d \
+ err.D_PRAGMA_OPTSET.HugeNspecValue.d \
+ err.D_PRAGMA_OPTSET.InvalidSpecSize.d \
+ err.D_PRAGMA_OPTSET.NegSpecSize.d \
+ err.D_PROTO_LEN.SpecNoId.d \
+ err.D_SPEC_COMM.SpecAftCommit.d \
+ err.D_SPEC_DREC.SpecAftDataRec.d \
+ err.D_SPEC_SPEC.SpecAftSpec.d \
+ err.NegativeBufSize.d \
+ err.NegativeNspec.d \
+ err.NegativeSpecSize.d \
+ err.SpecSizeVariations1.d \
+ err.SpecSizeVariations2.d \
+ tst.CommitAfterDiscard.d \
+ tst.CommitWithZero.d \
+ tst.DataRecAftDiscard.d \
+ tst.DiscardAftCommit.d \
+ tst.DiscardAftDataRec.d \
+ tst.DiscardAftDiscard.d \
+ tst.DiscardWithZero.d \
+ tst.ExitAftDiscard.d \
+ tst.NoSpecBuffer.d \
+ tst.SpecSizeVariations1.d \
+ tst.SpecSizeVariations2.d \
+ tst.SpecSizeVariations3.d \
+ tst.SpeculateWithRandom.d \
+ tst.SpeculationCommit.d \
+ tst.SpeculationDiscard.d \
+ tst.SpeculationID.d \
+ tst.SpeculationWithZero.d \
+ tst.TwoSpecBuffers.d \
+ tst.negcommit.d \
+ tst.negspec.d \
+ tst.zerosize.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/stability/Makefile b/cddl/usr.sbin/dtrace/tests/common/stability/Makefile
new file mode 100644
index 000000000000..8fb9afa610ff
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/stability/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ATTR_MIN.MinAttributes.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/stack/Makefile b/cddl/usr.sbin/dtrace/tests/common/stack/Makefile
new file mode 100644
index 000000000000..ca01f42298ce
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/stack/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_STACK_PROTO.bad.d \
+ err.D_STACK_SIZE.d \
+ err.D_USTACK_FRAMES.bad.d \
+ err.D_USTACK_PROTO.bad.d \
+ err.D_USTACK_STRSIZE.bad.d \
+ tst.default.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/stackdepth/Makefile b/cddl/usr.sbin/dtrace/tests/common/stackdepth/Makefile
new file mode 100644
index 000000000000..8e9496320b15
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/stackdepth/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.default.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/stop/Makefile b/cddl/usr.sbin/dtrace/tests/common/stop/Makefile
new file mode 100644
index 000000000000..a03d9aa1603d
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/stop/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.stop1.d \
+ tst.stop2.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.stop1.c \
+ tst.stop2.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/strlen/Makefile b/cddl/usr.sbin/dtrace/tests/common/strlen/Makefile
new file mode 100644
index 000000000000..0fec5412a34b
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/strlen/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.strlen1.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/strtoll/Makefile b/cddl/usr.sbin/dtrace/tests/common/strtoll/Makefile
new file mode 100644
index 000000000000..8af2d410b238
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/strtoll/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.BaseTooLarge.d \
+ err.BaseTooSmall.d \
+ tst.strtoll.d \
+ tst.strtoll.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/struct/Makefile b/cddl/usr.sbin/dtrace/tests/common/struct/Makefile
new file mode 100644
index 000000000000..fb039f2f1de2
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/struct/Makefile
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ADDROF_VAR.StructPointer.d \
+ err.D_DECL_COMBO.StructWithoutColon.d \
+ err.D_DECL_COMBO.StructWithoutColon1.d \
+ err.D_DECL_INCOMPLETE.circular.d \
+ err.D_DECL_INCOMPLETE.order.d \
+ err.D_DECL_INCOMPLETE.order2.d \
+ err.D_DECL_INCOMPLETE.recursive.d \
+ err.D_DECL_INCOMPLETE.simple.d \
+ err.D_DECL_VOIDOBJ.baddec.d \
+ err.D_PROTO_ARG.DupStructAssoc.d \
+ tst.StructAssoc.d \
+ tst.StructDataTypes.d \
+ tst.StructInside.d \
+ tst.clauselocal.d \
+ tst.clauselocal.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/syscall/Makefile b/cddl/usr.sbin/dtrace/tests/common/syscall/Makefile
new file mode 100644
index 000000000000..035fdf028284
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/syscall/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.args.d \
+ tst.openret.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.args.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/sysevent/Makefile b/cddl/usr.sbin/dtrace/tests/common/sysevent/Makefile
new file mode 100644
index 000000000000..496360e5c020
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/sysevent/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.post.d \
+ tst.post_chan.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.post.c \
+ tst.post_chan.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/tick-n/Makefile b/cddl/usr.sbin/dtrace/tests/common/tick-n/Makefile
new file mode 100644
index 000000000000..d843b9a6aa44
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/tick-n/Makefile
@@ -0,0 +1,38 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.tick.d \
+ err.D_PDESC_ZEROonens.d \
+ err.D_PDESC_ZEROonensec.d \
+ err.D_PDESC_ZEROoneus.d \
+ err.D_PDESC_ZEROoneusec.d \
+ tst.tickarg0.d \
+ tst.tickms.d \
+ tst.tickms.d.out \
+ tst.tickmsec.d \
+ tst.tickmsec.d.out \
+ tst.tickns.d \
+ tst.tickns.d.out \
+ tst.ticknsec.d \
+ tst.ticknsec.d.out \
+ tst.ticks.d \
+ tst.ticks.d.out \
+ tst.ticksec.d \
+ tst.ticksec.d.out \
+ tst.tickus.d \
+ tst.tickus.d.out \
+ tst.tickusec.d \
+ tst.tickusec.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/trace/Makefile b/cddl/usr.sbin/dtrace/tests/common/trace/Makefile
new file mode 100644
index 000000000000..e1500f2a350f
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/trace/Makefile
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PROTO_LEN.bad.d \
+ err.D_TRACE_AGG.bad.d \
+ err.D_TRACE_VOID.bad.d \
+ tst.dyn.d \
+ tst.misc.d \
+ tst.qstring.d \
+ tst.qstring.d.out \
+ tst.string.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/tracemem/Makefile b/cddl/usr.sbin/dtrace/tests/common/tracemem/Makefile
new file mode 100644
index 000000000000..5ba7b6f6f8e5
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/tracemem/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PROTO_ARG.badsize.d \
+ err.D_PROTO_LEN.toofew.d \
+ err.D_TRACEMEM_ADDR.badaddr.d \
+ err.D_TRACEMEM_ARGS.d \
+ err.D_TRACEMEM_DYNSIZE.d \
+ err.D_TRACEMEM_SIZE.negsize.d \
+ err.D_TRACEMEM_SIZE.zerosize.d \
+ tst.dynsize.d \
+ tst.dynsize.d.out \
+ tst.rootvp.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/translators/Makefile b/cddl/usr.sbin/dtrace/tests/common/translators/Makefile
new file mode 100644
index 000000000000..4d57edfc8f92
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/translators/Makefile
@@ -0,0 +1,51 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DECL_TYPERED.BadTransDecl.d \
+ err.D_OP_INCOMPLETE.NonExistentInput1.d \
+ err.D_SYNTAX.BadTransDecl1.d \
+ err.D_SYNTAX.BadTransDecl3.d \
+ err.D_SYNTAX.BadTransDecl4.d \
+ err.D_TYPE_MEMBER.NonExistentInput2.d \
+ err.D_XLATE_INCOMPAT.BadInputType1.d \
+ err.D_XLATE_MEMB.NonExistentOutput2.d \
+ err.D_XLATE_NONE.BadTransDecl6.d \
+ err.D_XLATE_REDECL.RepeatTransDecl.d \
+ err.D_XLATE_SOU.BadTransDecl8.d \
+ err.D_XLATE_SOU.BadTransInt.d \
+ err.D_XLATE_SOU.NonExistentOutput1.d \
+ tst.CircularTransDecl.d \
+ tst.EmptyTransDecl.d \
+ tst.ForwardTag.d \
+ tst.InputAliasTrans.d \
+ tst.InputIntTrans.d \
+ tst.OutputAliasTrans.d \
+ tst.PartialDereferencing.d \
+ tst.PartialOutputTransDefn.d \
+ tst.ProcModelTrans.d \
+ tst.RepeatDeclaration.d \
+ tst.SimultaneousTranslators.d \
+ tst.StructureAssignment.d \
+ tst.TestTransStability1.ksh \
+ tst.TestTransStability1.ksh.out \
+ tst.TestTransStability2.ksh \
+ tst.TestTransStability2.ksh.out \
+ tst.TransNonPointer.d \
+ tst.TransOutputPointer.d \
+ tst.TransPointer.d \
+ tst.TranslateSelf.d \
+ tst.UnionInputTrans.d \
+ tst.UnionOutputTrans.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/typedef/Makefile b/cddl/usr.sbin/dtrace/tests/common/typedef/Makefile
new file mode 100644
index 000000000000..477fd74e5d8d
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/typedef/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DECL_IDRED.DupTypeDef.d \
+ err.D_SYNTAX.BadExistingTypedef.d \
+ err.D_SYNTAX.TypedefInClause.d \
+ tst.ChainTypedef.d \
+ tst.TypedefDataAssign.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/types/Makefile b/cddl/usr.sbin/dtrace/tests/common/types/Makefile
new file mode 100644
index 000000000000..1a3d3265ff94
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/types/Makefile
@@ -0,0 +1,69 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_CAST_INVAL.badcast.d \
+ err.D_CG_DYN.ResultDynType.d \
+ err.D_CHR_OFLOW.charconst.d \
+ err.D_DECL_BADCLASS.bad.d \
+ err.D_DECL_CHARATTR.badtype3.d \
+ err.D_DECL_COMBO.badtype4.d \
+ err.D_DECL_COMBO.badtype5.d \
+ err.D_DECL_ENCONST.badeval.d \
+ err.D_DECL_ENOFLOW.enoflow.d \
+ err.D_DECL_ENOFLOW.enuflow.d \
+ err.D_DECL_SCOPE.scopeop.d \
+ err.D_DECL_USELESS.baddec.d \
+ err.D_OP_ACT.badcond.d \
+ err.D_OP_ARITH.badoperand.d \
+ err.D_OP_INCOMPAT.badassign.d \
+ err.D_OP_INT.badbitop.d \
+ err.D_OP_INT.badshift.d \
+ err.D_OP_SCALAR.badcond.d \
+ err.D_OP_SCALAR.badincop.d \
+ err.D_OP_SCALAR.badlogop.d \
+ err.D_PROTO_LEN.badcond1.d \
+ err.D_SYNTAX.badenum.d \
+ err.D_SYNTAX.badid.d \
+ err.D_SYNTAX.badstruct.d \
+ err.D_UNKNOWN.badtype1.d \
+ err.D_UNKNOWN.badtype2.d \
+ err.D_UNKNOWN.dupenum.d \
+ err.D_UNKNOWN.dupstruct.d \
+ err.D_XLATE_REDECL.ResultDynType.d \
+ tst.assignops.d \
+ tst.badshiftops.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.bitops.d \
+ tst.charconstants.d \
+ tst.complex.d \
+ tst.condexpr.d \
+ tst.const.d \
+ tst.constants.d \
+ tst.conv.d \
+ tst.enum.d \
+ tst.intincop.d \
+ tst.intops.d \
+ tst.inttypes.d \
+ tst.ptrincop.d \
+ tst.ptrops.d \
+ tst.relenum.d \
+ tst.relstring.d \
+ tst.shiftops.d \
+ tst.stringconstants.d \
+ tst.struct.d \
+ tst.typedef.d \
+ tst.unaryop.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/uctf/Makefile b/cddl/usr.sbin/dtrace/tests/common/uctf/Makefile
new file mode 100644
index 000000000000..493d55048173
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/uctf/Makefile
@@ -0,0 +1,41 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.invalidpid.d \
+ err.invalidpid2.d \
+ err.invalidpid3.d \
+ err.invalidtype.ksh \
+ err.invalidtype2.ksh \
+ err.user64mode.ksh \
+ tst.aouttype.ksh \
+ tst.chasestrings.ksh \
+ tst.chasestrings.ksh.out \
+ tst.libtype.ksh \
+ tst.linkmap.ksh \
+ tst.pidprint.ksh \
+ tst.pidprinttarg.ksh \
+ tst.printtype.ksh \
+ tst.printtype.ksh.out \
+ tst.printtypetarg.ksh \
+ tst.userlandkey.ksh \
+ tst.userlandkey.ksh.out \
+ tst.userstrings.ksh \
+ tst.userstrings.ksh.out \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.aouttype.c \
+ tst.chasestrings.c \
+ tst.libtype.c \
+ tst.printtype.c \
+
+
+WITH_CTF=YES
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/union/Makefile b/cddl/usr.sbin/dtrace/tests/common/union/Makefile
new file mode 100644
index 000000000000..69e0ca864cee
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/union/Makefile
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ADDROF_VAR.UnionPointer.d \
+ err.D_DECL_COMBO.UnionWithoutColon.d \
+ err.D_DECL_COMBO.UnionWithoutColon1.d \
+ err.D_DECL_INCOMPLETE.circular.d \
+ err.D_DECL_INCOMPLETE.order.d \
+ err.D_DECL_INCOMPLETE.recursive.d \
+ err.D_DECL_INCOMPLETE.simple.d \
+ err.D_PROTO_ARG.DupUnionAssoc.d \
+ tst.UnionAssoc.d \
+ tst.UnionDataTypes.d \
+ tst.UnionInside.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/usdt/Makefile b/cddl/usr.sbin/dtrace/tests/common/usdt/Makefile
new file mode 100644
index 000000000000..f6fa49b1794c
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/usdt/Makefile
@@ -0,0 +1,65 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ argmap.d \
+ args.d \
+ forker.d \
+ prov.d \
+ tst.andpid.ksh \
+ tst.argmap.d \
+ tst.args.d \
+ tst.badguess.ksh \
+ tst.corruptenv.ksh \
+ tst.dlclose1.ksh \
+ tst.dlclose1.ksh.out \
+ tst.dlclose2.ksh \
+ tst.dlclose2.ksh.out \
+ tst.dlclose3.ksh \
+ tst.eliminate.ksh \
+ tst.enabled.ksh \
+ tst.enabled.ksh.out \
+ tst.enabled2.ksh \
+ tst.enabled2.ksh.out \
+ tst.entryreturn.ksh \
+ tst.entryreturn.ksh.out \
+ tst.fork.ksh \
+ tst.fork.ksh.out \
+ tst.forker.ksh \
+ tst.guess32.ksh \
+ tst.guess64.ksh \
+ tst.header.ksh \
+ tst.include.ksh \
+ tst.linkpriv.ksh \
+ tst.linkunpriv.ksh \
+ tst.multiple.ksh \
+ tst.multiple.ksh.out \
+ tst.multiprov.ksh \
+ tst.multiprov.ksh.out \
+ tst.nodtrace.ksh \
+ tst.noprobes.ksh \
+ tst.noreap.ksh \
+ tst.noreapring.ksh \
+ tst.onlyenabled.ksh \
+ tst.reap.ksh \
+ tst.reeval.ksh \
+ tst.static.ksh \
+ tst.static.ksh.out \
+ tst.static2.ksh \
+ tst.static2.ksh.out \
+ tst.user.ksh \
+ tst.user.ksh.out \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.argmap.c \
+ tst.args.c \
+ tst.forker.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/ustack/Makefile b/cddl/usr.sbin/dtrace/tests/common/ustack/Makefile
new file mode 100644
index 000000000000..960c407b108e
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/ustack/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.bigstack.d \
+ tst.depth.ksh \
+ tst.spin.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.bigstack.c \
+ tst.spin.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/vars/Makefile b/cddl/usr.sbin/dtrace/tests/common/vars/Makefile
new file mode 100644
index 000000000000..5b4755750dd9
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/vars/Makefile
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.gid.d \
+ tst.nullassign.d \
+ tst.ppid.d \
+ tst.ucaller.ksh \
+ tst.ucaller.ksh.out \
+ tst.uid.d \
+ tst.walltimestamp.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/version/Makefile b/cddl/usr.sbin/dtrace/tests/common/version/Makefile
new file mode 100644
index 000000000000..0491ceaff2c8
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/version/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.1.0.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/tools/dtest.sh b/cddl/usr.sbin/dtrace/tests/tools/dtest.sh
new file mode 100755
index 000000000000..e60837b4ad08
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/tools/dtest.sh
@@ -0,0 +1,129 @@
+# $FreeBSD$
+
+usage()
+{
+ cat >&2 <<__EOF__
+A harness for test cases in the DTrace test suite.
+
+usage: $(basename $0) <testfile>
+__EOF__
+ exit 1
+}
+
+gettag()
+{
+ local tag
+
+ tag=$(basename $1)
+ tag=${tag#*.}
+ tag=${tag%%[a-z.]*}
+ echo $tag
+}
+
+runtest()
+{
+ local dflags exe exstatus pid retval status
+
+ exstatus=0
+ retval=0
+
+ case $TFILE in
+ drp.DTRACEDROP_*.d|err.*.d|tst.*.d)
+ case $TFILE in
+ drp.DTRACEDROP_*.d)
+ dflags="-x droptags"
+ tag=$(gettag "$TFILE")
+ ;;
+ err.D_*.d)
+ exstatus=1
+ dflags="-x errtags"
+ tag=$(gettag "$TFILE")
+ ;;
+ err.*.d)
+ exstatus=1
+ ;;
+ esac
+
+ exe=${TFILE%.*}.exe
+ if [ -f "$exe" -a -x "$exe" ]; then
+ ./$exe &
+ pid=$!
+ dflags="$dflags ${pid}"
+ fi
+
+ dtrace -C -s "${TFILE}" $dflags >$STDOUT 2>$STDERR
+ status=$?
+
+ if [ $status -ne $exstatus ]; then
+ ERRMSG="dtrace exited with status ${status}, expected ${exstatus}"
+ retval=1
+ elif [ -n "${tag}" ] && ! grep -Fq " [${tag}] " ${STDERR}; then
+ ERRMSG="dtrace's error output did not contain expected tag ${tag}"
+ retval=1
+ fi
+
+ if [ -n "$pid" ]; then
+ kill -0 $pid >/dev/null 2>&1 && kill -9 $pid >/dev/null 2>&1
+ wait
+ fi
+ ;;
+ err.*.ksh|tst.*.ksh)
+ expr "$TFILE" : 'err.*' >/dev/null && exstatus=1
+
+ ksh "$TFILE" /usr/sbin/dtrace >$STDOUT 2>$STDERR
+ status=$?
+
+ if [ $status -ne $exstatus ]; then
+ ERRMSG="script exited with status ${status}, expected ${exstatus}"
+ retval=1
+ fi
+ ;;
+ *)
+ ERRMSG="unexpected test file name $TFILE"
+ retval=1
+ ;;
+ esac
+
+ return $retval
+}
+
+[ $# -eq 1 ] || usage
+
+readonly STDERR=$(mktemp)
+readonly STDOUT=$(mktemp)
+readonly TFILE=$(basename $1)
+readonly EXOUT=${TFILE}.out
+
+kldstat -q -m dtrace_test || kldload dtrace_test
+cd $(dirname $1)
+runtest
+RESULT=$?
+
+if [ $RESULT -eq 0 -a -f $EXOUT -a -r $EXOUT ] && \
+ ! cmp $STDOUT $EXOUT >/dev/null 2>&1; then
+ ERRMSG="test output mismatch"
+ RESULT=1
+fi
+
+if [ $RESULT -ne 0 ]; then
+ echo "test $TFILE failed: $ERRMSG" >&2
+ if [ $(stat -f '%z' $STDOUT) -gt 0 ]; then
+ cat >&2 <<__EOF__
+test stdout:
+--
+$(cat $STDOUT)
+--
+__EOF__
+ fi
+ if [ $(stat -f '%z' $STDERR) -gt 0 ]; then
+ cat >&2 <<__EOF__
+test stderr:
+--
+$(cat $STDERR)
+--
+__EOF__
+ fi
+fi
+
+rm -f $STDERR $STDOUT
+exit $RESULT
diff --git a/cddl/usr.sbin/dtrace/tests/tools/exclude.sh b/cddl/usr.sbin/dtrace/tests/tools/exclude.sh
new file mode 100755
index 000000000000..33c9efca0f45
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/tools/exclude.sh
@@ -0,0 +1,193 @@
+# $FreeBSD$
+
+# This file lists DTrace tests which are known to fail or hang/crash the
+# system. They were pulled from the legacy DTrace test infrastructure in
+# tools/tests/dtrace and may be out of date.
+#
+# Tests are listed here generally because one or more of the following is true:
+#
+# 1) The test is broken (usually because it assumes it's running on Solaris and
+# the test encodes some sort of Solarisism).
+# 2) The functionality being tested is buggy (often but not always the result
+# of a FreeBSD-specific bug).
+# 3) The test relies on DTrace functionality that's not yet available in FreeBSD
+# (e.g. tests for a specific SDT provider that we don't have).
+#
+# An end goal is to remove this file, concentrating first on instances of
+# 1) and 2).
+#
+# The SKIP variable contains tests that should not be executed at all. The
+# EXFAIL variable contains tests that are expected to fail when run. Please
+# avoid adding tests to SKIP unless it really is necessary; with EXFAIL, tests
+# that begin passing as the result of a change are visible in the test summary.
+
+exclude()
+{
+ eval $1=\"\$$1\\n$2\"
+}
+
+exclude EXFAIL common/aggs/tst.subr.d
+exclude EXFAIL common/dtraceUtil/tst.DataModel32.d.ksh
+exclude EXFAIL common/dtraceUtil/tst.ELFGenerationOut.d.ksh
+exclude EXFAIL common/dtraceUtil/tst.ELFGenerationWithO.d.ksh
+exclude EXFAIL common/funcs/tst.copyin.d
+exclude EXFAIL common/funcs/tst.copyinto.d
+exclude EXFAIL common/funcs/tst.ddi_pathname.d
+exclude EXFAIL common/io/tst.fds.d
+exclude EXFAIL common/ip/tst.ipv4localudp.ksh
+exclude EXFAIL common/mdb/tst.dtracedcmd.ksh
+exclude EXFAIL common/misc/tst.dofmax.ksh
+exclude EXFAIL common/misc/tst.include.ksh
+exclude EXFAIL common/safety/tst.copyin2.d
+exclude EXFAIL common/safety/tst.msgdsize.d
+exclude EXFAIL common/safety/tst.msgsize.d
+exclude EXFAIL common/safety/tst.zonename.d
+exclude EXFAIL common/scalars/tst.misc.d
+exclude EXFAIL common/scalars/tst.selfarray2.d
+exclude EXFAIL common/sched/tst.enqueue.d
+exclude EXFAIL common/speculation/tst.SpecSizeVariations3.d
+exclude EXFAIL common/tracemem/err.D_TRACEMEM_ADDR.badaddr.d
+exclude EXFAIL common/translators/tst.TestTransStability2.ksh
+exclude EXFAIL common/types/tst.struct.d
+exclude EXFAIL common/types/tst.typedef.d
+
+# We don't have a cpc provider.
+exclude SKIP common/cpc/err.D_PDESC_ZERO.lowfrequency.d
+exclude SKIP common/cpc/err.D_PDESC_ZERO.malformedoverflow.d
+exclude SKIP common/cpc/err.D_PDESC_ZERO.nonexistentevent.d
+exclude SKIP common/cpc/err.cpcvscpustatpart1.ksh
+exclude SKIP common/cpc/err.cpcvscpustatpart2.ksh
+exclude SKIP common/cpc/err.cputrackfailtostart.ksh
+exclude SKIP common/cpc/err.cputrackterminates.ksh
+exclude SKIP common/cpc/err.toomanyenablings.d
+exclude SKIP common/cpc/tst.allcpus.ksh
+exclude SKIP common/cpc/tst.genericevent.d
+exclude SKIP common/cpc/tst.platformevent.ksh
+
+# We don't have a mib provider.
+exclude EXFAIL common/mib/tst.icmp.ksh
+exclude EXFAIL common/mib/tst.tcp.ksh
+exclude EXFAIL common/mib/tst.udp.ksh
+
+# At the moment dtrace(1) always needs to run as root.
+exclude SKIP common/privs/tst.fds.ksh
+exclude SKIP common/privs/tst.func_access.ksh
+exclude SKIP common/privs/tst.getf.ksh
+exclude SKIP common/privs/tst.op_access.ksh
+exclude SKIP common/privs/tst.procpriv.ksh
+exclude SKIP common/privs/tst.providers.ksh
+exclude SKIP common/privs/tst.unpriv_funcs.ksh
+
+# These tests hang for reasons unknown.
+exclude SKIP common/buffering/tst.ring3.d
+exclude SKIP common/funcs/tst.chill.ksh
+exclude SKIP common/funcs/tst.index.d
+
+# No Java support at the moment.
+exclude EXFAIL common/java_api/tst.Abort.ksh
+exclude EXFAIL common/java_api/tst.Bean.ksh
+exclude EXFAIL common/java_api/tst.Close.ksh
+exclude EXFAIL common/java_api/tst.Drop.ksh
+exclude EXFAIL common/java_api/tst.Enable.ksh
+exclude EXFAIL common/java_api/tst.FunctionLookup.ksh
+exclude EXFAIL common/java_api/tst.GetAggregate.ksh
+exclude EXFAIL common/java_api/tst.MaxConsumers.ksh
+exclude EXFAIL common/java_api/tst.MultiAggPrinta.ksh
+exclude EXFAIL common/java_api/tst.ProbeData.ksh
+exclude EXFAIL common/java_api/tst.ProbeDescription.ksh
+exclude EXFAIL common/java_api/tst.StateMachine.ksh
+exclude EXFAIL common/java_api/tst.StopLock.ksh
+
+# Expects specific formatting from banner(6).
+exclude EXFAIL common/aggs/tst.aggpackbanner.ksh
+
+# Test assumes we're running on a Solaris kernel.
+exclude EXFAIL common/misc/tst.roch.d
+exclude EXFAIL common/predicates/tst.argsnotcached.d
+exclude EXFAIL common/safety/tst.vahole.d
+
+# Tests that depend on the plockstat provider.
+exclude EXFAIL common/plockstat/tst.available.d
+exclude EXFAIL common/plockstat/tst.libmap.d
+exclude EXFAIL common/usdt/tst.andpid.ksh
+
+# Depends on java.
+exclude SKIP common/drops/drp.DTRACEDROP_STKSTROVERFLOW.d
+
+# Interrupt priority isn't relevant on FreeBSD.
+exclude SKIP common/builtinvar/tst.ipl.d
+exclude SKIP common/builtinvar/tst.ipl1.d
+
+# These tests rely on being able to find a host via broadcast pings.
+exclude EXFAIL common/ip/tst.ipv4remotetcp.ksh
+exclude EXFAIL common/ip/tst.ipv4remoteudp.ksh
+exclude EXFAIL common/ip/tst.ipv6remoteicmp.ksh
+exclude EXFAIL common/ip/tst.ipv4remoteicmp.ksh
+
+# FreeBSD never places tcpcbs in the TIME_WAIT state, so the probe never fires.
+exclude EXFAIL common/ip/tst.localtcpstate.ksh
+exclude EXFAIL common/ip/tst.remotetcpstate.ksh
+
+# Depends on the number of probes in /bin/sh and the current DOF limit.
+exclude EXFAIL common/pid/err.D_PROC_CREATEFAIL.many.d
+
+# Tries to enable pid$target:libc::entry, though there's no "libc" module.
+# Currently unsure as to whether this might be a libproc bug.
+exclude EXFAIL common/pid/tst.probemod.ksh
+
+# Assumes date(1) has a pid$target::main:return probe.
+exclude EXFAIL common/pid/tst.newprobes.ksh
+
+# libproc+librtld_db don't handle dlopen(2) yet.
+exclude EXFAIL common/pid/tst.provregex2.ksh
+exclude EXFAIL common/pid/tst.provregex4.ksh
+
+# libproc doesn't properly handle probe sites that correspond to multiple
+# symbols.
+exclude EXFAIL common/pid/tst.weak1.d
+exclude EXFAIL common/pid/tst.weak2.d
+
+# This test checks for a leading tab on a line before #define. That is illegal
+# on Solaris, but the clang pre-processor on FreeBSD is happy with code like
+# that.
+exclude EXFAIL common/preprocessor/err.D_PRAGCTL_INVAL.tabdefine.d
+
+# This test uses proc:::signal-handle, which we don't appear to have.
+exclude EXFAIL common/proc/tst.signal.ksh
+
+# This test uses proc:::lwp-start, which we don't appear to have.
+exclude EXFAIL common/proc/tst.startexit.ksh
+
+# This test causes a panic at the moment because fbt instruments the lock class'
+# lc_owned method.
+exclude SKIP common/safety/tst.rw.d
+
+# Depends on some implementation details of the runtime linker.
+exclude EXFAIL common/vars/tst.ucaller.ksh
+
+# These rely on process attributes that FreeBSD doesn't carry.
+exclude EXFAIL common/scripting/tst.projid.ksh
+exclude EXFAIL common/scripting/tst.taskid.ksh
+
+# This test expects its test program to be installed without CTF data, but
+# the rest of the programs for this feature need CTF data. Not yet sure how
+# to build that.
+exclude EXFAIL common/uctf/tst.libtype.ksh
+
+# libproc doesn't have linkmap support yet.
+exclude EXFAIL common/uctf/tst.linkmap.ksh
+
+# Uses Sun-specific compiler options.
+exclude EXFAIL common/usdt/tst.badguess.ksh
+exclude EXFAIL common/usdt/tst.guess32.ksh
+exclude EXFAIL common/usdt/tst.guess64.ksh
+
+# Generated headers include <sys/sdt.h>, so _DTRACE_VERSION is always defined.
+exclude EXFAIL common/usdt/tst.nodtrace.ksh
+
+# The second dtrace -G invocation returns an error with "no probes found," which
+# makes sense to me. Not yet sure what the expected behaviour is here.
+exclude EXFAIL common/usdt/tst.static2.ksh
+
+# Uses the Solaris-specific ppriv(1).
+exclude EXFAIL common/usdt/tst.user.ksh
diff --git a/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh b/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh
new file mode 100755
index 000000000000..bf0e181684d1
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh
@@ -0,0 +1,85 @@
+# $FreeBSD$
+
+usage()
+{
+ cat <<__EOF__ >&2
+usage: $(basename $0)
+
+This script regenerates the DTrace test suite makefiles. It should be run
+whenever \$srcdir/cddl/contrib/opensolaris/cmd/dtrace/test/tst is modified.
+__EOF__
+ exit 1
+}
+
+# Format a file list for use in a make(1) variable assignment: take the
+# basename of each input file and append " \" to it.
+fmtflist()
+{
+ awk 'function bn(f) {
+ sub(".*/", "", f)
+ return f
+ }
+ {print " ", bn($1), " \\"}'
+}
+
+genmakefile()
+{
+ local basedir=$1
+
+ local tdir=${CONTRIB_TESTDIR}/${basedir}
+ local tfiles=$(find $tdir -type f -a \
+ \( -name \*.d -o -name \*.ksh -o -name \*.out \) | sort | fmtflist)
+ local tcfiles=$(find $tdir -type f -a -name \*.c | sort | fmtflist)
+ local texes=$(find $tdir -type f -a -name \*.exe | sort | fmtflist)
+
+ # One-off variable definitions.
+ local special
+ if [ "$basedir" = proc ]; then
+ special="
+LDADD.tst.sigwait.exe+= -lrt
+DPADD.tst.sigwait.exe+= \${LIBRT}
+"
+ elif [ "$basedir" = uctf ]; then
+ special="
+WITH_CTF=YES
+"
+ fi
+
+ local makefile=$(mktemp)
+ cat <<__EOF__ > $makefile
+# \$FreeBSD$
+
+#
+# This Makefile was generated by \$srcdir${ORIGINDIR#${TOPDIR}}/genmakefiles.sh.
+#
+
+TESTFILES= \\
+$tfiles
+
+TESTEXES= \\
+$texes
+
+CFILES= \\
+$tcfiles
+
+$special
+.include "../../Makefile.inc1"
+__EOF__
+
+ mv -f $makefile ${ORIGINDIR}/../common/${basedir}/Makefile
+}
+
+set -e
+
+if [ $# -ne 0 ]; then
+ usage
+fi
+
+readonly ORIGINDIR=$(realpath $(dirname $0))
+readonly TOPDIR=$(realpath ${ORIGINDIR}/../../../../..)
+readonly CONTRIB_TESTDIR=${TOPDIR}/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common
+
+# Generate a Makefile for each test group under common/.
+for dir in $(find ${CONTRIB_TESTDIR} -mindepth 1 -maxdepth 1 -type d); do
+ genmakefile $(basename $dir)
+done
diff --git a/cddl/usr.sbin/dtrace/tests/tools/gentest.sh b/cddl/usr.sbin/dtrace/tests/tools/gentest.sh
new file mode 100755
index 000000000000..9c34b79f547d
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/tools/gentest.sh
@@ -0,0 +1,110 @@
+# $FreeBSD$
+
+usage()
+{
+ cat <<__EOF__ >&2
+Generate ATF test cases from a set of DTrace tests.
+
+usage: sh $(basename $0) [-e <excludes>] <category> [<testfiles>]
+
+ excludes: A shell script which defines test cases that are to be skipped,
+ or aren't expected to pass.
+ category: The test category, in the form of <arch>/<feature>. For example,
+ "common/aggs" is the test category for D aggregations.
+ testfiles: The test files for the tests in the specified category.
+__EOF__
+ exit 1
+}
+
+gentestcase()
+{
+ local mod tcase tfile
+
+ tfile=$1
+ tcase=$2
+ mod=$3
+
+ cat <<__EOF__
+atf_test_case $tcase
+${tcase}_head()
+{
+ atf_set 'descr' 'DTrace test ${CATEGORY}/${tfile}'
+}
+${tcase}_body()
+{
+ $mod
+ atf_check -s exit:0 -o empty -e empty \\
+ "\$(atf_get_srcdir)/../../dtest" "\$(atf_get_srcdir)/${tfile}"
+}
+__EOF__
+}
+
+gentestcases()
+{
+ local mod tcase tfile tfiles
+
+ eval tfiles=\$$1
+ mod=$2
+
+ for tfile in ${tfiles}; do
+ case $tfile in
+ drp.*.d|err.*.d|tst.*.d|*.ksh)
+ # Test names need to be mangled for ATF.
+ tcase=$(echo "$tfile" | tr '.-' '_')
+ gentestcase "$tfile" "$tcase" "$mod"
+ TCASES="$TCASES $tcase"
+ ;;
+ esac
+ done
+}
+
+set -e
+
+#
+# Parse arguments.
+#
+case $1 in
+-e)
+ shift; EXCLUDES=$1; shift
+ ;;
+esac
+
+CATEGORY=$1
+shift
+if ! expr "$CATEGORY" : '[^/]*/[^/]*' >/dev/null 2>&1; then
+ usage
+fi
+FEATURE=$(basename ${CATEGORY})
+ARCH=$(dirname ${CATEGORY})
+
+#
+# Remove skipped tests and expected failures from the main test list.
+#
+. $EXCLUDES
+EXFAILS=$(echo -e "$EXFAIL" | grep "^${CATEGORY}/" | xargs basename -a)
+SKIPS=$(echo -e "$SKIP" | grep "^${CATEGORY}/" | xargs basename -a)
+
+FILELIST=$(mktemp)
+trap 'rm -f $FILELIST' EXIT
+
+echo "$@" | tr ' ' '\n' | xargs basename -a | sort > ${FILELIST}
+TFILES=$(printf '%s\n%s' "$EXFAILS" "$SKIPS" | sort | comm -13 /dev/stdin $FILELIST)
+
+#
+# Generate test cases.
+#
+gentestcases SKIPS "atf_skip \"test may hang or cause system instability\""
+gentestcases EXFAILS "atf_expect_fail \"test is known to fail\""
+gentestcases TFILES
+
+#
+# Generate the test init function.
+#
+cat <<__EOF__
+atf_init_test_cases()
+{
+$(for tcase in ${TCASES}; do echo " atf_add_test_case $tcase"; done)
+}
+__EOF__
+
+rm -f $FILELIST
diff --git a/cddl/usr.sbin/lockstat/Makefile b/cddl/usr.sbin/lockstat/Makefile
index 0668758c2f97..a4eb898e33de 100644
--- a/cddl/usr.sbin/lockstat/Makefile
+++ b/cddl/usr.sbin/lockstat/Makefile
@@ -21,10 +21,6 @@ CFLAGS+= -DNEED_ERRLOC -g
#YFLAGS+= -d
-DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \
- ${LIBCTF} ${LIBELF} ${LIBZ} ${LIBRT} ${LIBUTIL} \
- ${LIBRTLD_DB}
-LDADD= -lpthread -ldtrace -ly -ll -lproc -lctf -lelf -lz -lrt -lutil \
- -lrtld_db
+LIBADD= elf dtrace rt
.include <bsd.prog.mk>
diff --git a/cddl/usr.sbin/lockstat/Makefile.depend b/cddl/usr.sbin/lockstat/Makefile.depend
index 3dec902e6c68..77eeee84f64a 100644
--- a/cddl/usr.sbin/lockstat/Makefile.depend
+++ b/cddl/usr.sbin/lockstat/Makefile.depend
@@ -19,9 +19,7 @@ DIRDEPS = \
lib/librtld_db \
lib/libthr \
lib/libutil \
- lib/liby \
lib/libz \
- usr.bin/lex/lib \
.include <dirdeps.mk>
diff --git a/cddl/usr.sbin/plockstat/Makefile b/cddl/usr.sbin/plockstat/Makefile
index 059295898110..fc10b5679890 100644
--- a/cddl/usr.sbin/plockstat/Makefile
+++ b/cddl/usr.sbin/plockstat/Makefile
@@ -18,9 +18,6 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
-I${.CURDIR}/../../../cddl/lib/libdtrace \
-I${.CURDIR}/../../../sys
-DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} ${LIBCTF}\
- ${LIBELF} ${LIBZ} ${LIBRT} ${LIBRTLD_DB} ${LIBUTIL}
-LDADD= -lpthread -ldtrace -ly -ll -lproc -lctf -lelf -lz -lrt \
- -lrtld_db -lutil
+LIBADD= dtrace proc
.include <bsd.prog.mk>