aboutsummaryrefslogtreecommitdiff
path: root/cddl
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2018-01-12 19:59:46 +0000
committerMark Johnston <markj@FreeBSD.org>2018-01-12 19:59:46 +0000
commit224e0c2f61307308a0bd951960e2eb50b4c1bbf4 (patch)
tree0453866d383f8fe603e55d71b9337034ffb89273 /cddl
parent44c1484a53ed1a5f3ee51bd9476d25ce3178aea6 (diff)
downloadsrc-224e0c2f61307308a0bd951960e2eb50b4c1bbf4.tar.gz
src-224e0c2f61307308a0bd951960e2eb50b4c1bbf4.zip
Add "jid" and "jailname" variables to DTrace.
These return the jail ID and jail name for the traced process, respectively, and are analogous to "zonename" on Solaris/illumos. "zonename" is now aliased to "jailname". Also add some stress tests for the new variables. Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com> Reviewed by: dteske (previous version) MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D13877
Notes
Notes: svn path=/head/; revision=327888
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d44
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d44
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c8
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/safety/Makefile2
4 files changed, 96 insertions, 2 deletions
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d
new file mode 100644
index 000000000000..5256a1007559
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d
@@ -0,0 +1,44 @@
+/*
+ * 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 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 2018 Domagoj Stolfa <domagoj.stolfa@cl.cam.ac.uk>.
+ *
+ * This software was developed by BAE Systems, the University of Cambridge
+ * Computer Laboratory, and Memorial University under DARPA/AFRL contract
+ * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing
+ * (TC) research program.
+ *
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * collect jailname at every fbt probe and at every firing of a
+ * high-frequency profile probe
+ */
+
+fbt:::
+{
+ @a[jailname] = count();
+}
+
+profile-4999hz
+{
+ @a[jailname] = count();
+}
+
+tick-1sec
+/n++ == 10/
+{
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d
new file mode 100644
index 000000000000..034de9328854
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d
@@ -0,0 +1,44 @@
+/*
+ * 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 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 2018 Domagoj Stolfa <domagoj.stolfa@cl.cam.ac.uk>.
+ *
+ * This software was developed by BAE Systems, the University of Cambridge
+ * Computer Laboratory, and Memorial University under DARPA/AFRL contract
+ * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing
+ * (TC) research program.
+ *
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * collect jid at every fbt probe and at every firing of a
+ * high-frequency profile probe
+ */
+
+fbt:::
+{
+ @a[jid] = count();
+}
+
+profile-4999hz
+{
+ @a[jid] = count();
+}
+
+tick-1sec
+/n++ == 10/
+{
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
index a7027f5e1ba1..3bf6196ad034 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
@@ -313,6 +313,12 @@ static const dt_ident_t _dtrace_globals[] = {
DT_VERS_1_5, &dt_idops_func, "string(int, void *)" },
{ "ipl", DT_IDENT_SCALAR, 0, DIF_VAR_IPL, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "uint_t" },
+#ifdef __FreeBSD__
+{ "jailname", DT_IDENT_SCALAR, 0, DIF_VAR_JAILNAME,
+ DT_ATTR_STABCMN, DT_VERS_1_13, &dt_idops_type, "string" },
+{ "jid", DT_IDENT_SCALAR, 0, DIF_VAR_JID, DT_ATTR_STABCMN, DT_VERS_1_13,
+ &dt_idops_type, "int" },
+#endif
{ "json", DT_IDENT_FUNC, 0, DIF_SUBR_JSON, DT_ATTR_STABCMN, DT_VERS_1_11,
&dt_idops_func, "string(const char *, const char *)" },
{ "jstack", DT_IDENT_ACTFUNC, 0, DT_ACT_JSTACK, DT_ATTR_STABCMN, DT_VERS_1_0,
@@ -528,10 +534,8 @@ 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" },
-#ifdef illumos
{ "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME,
DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
-#endif
#ifndef illumos
{ "cpu", DT_IDENT_SCALAR, 0, DIF_VAR_CPU,
diff --git a/cddl/usr.sbin/dtrace/tests/common/safety/Makefile b/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
index 5056260d0621..51b302fd3ad7 100644
--- a/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
+++ b/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
@@ -19,6 +19,8 @@ ${PACKAGE}FILES= \
tst.gid.d \
tst.hton.d \
tst.index.d \
+ tst.jailname.d \
+ tst.jid.d \
tst.msgdsize.d \
tst.msgsize.d \
tst.null.d \