Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F112026703
D13877.id37883.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D13877.id37883.diff
View Options
Index: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d
===================================================================
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d
+++ head/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);
+}
Index: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d
===================================================================
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d
+++ head/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);
+}
Index: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
===================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
@@ -313,6 +313,12 @@
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 @@
{ "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,
Index: head/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
===================================================================
--- head/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
+++ head/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
@@ -19,6 +19,8 @@
tst.gid.d \
tst.hton.d \
tst.index.d \
+ tst.jailname.d \
+ tst.jid.d \
tst.msgdsize.d \
tst.msgsize.d \
tst.null.d \
Index: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
===================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
@@ -3654,6 +3654,24 @@
return (dtrace_dif_varstr(
(uintptr_t)curthread->t_procp->p_zone->zone_name,
state, mstate));
+#elif defined(__FreeBSD__)
+ /*
+ * On FreeBSD, we introduce compatibility to zonename by falling through
+ * into jailname.
+ */
+ case DIF_VAR_JAILNAME:
+ if (!dtrace_priv_kernel(state))
+ return (0);
+
+ return (dtrace_dif_varstr(
+ (uintptr_t)curthread->t_procp->p_ucred->cr_prison->pr_name,
+ state, mstate));
+
+ case DIF_VAR_JID:
+ if (!dtrace_priv_kernel(state))
+ return (0);
+
+ return ((uint64_t)curthread->t_procp->p_ucred->cr_prison->pr_id);
#else
return (0);
#endif
Index: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
===================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
@@ -254,6 +254,8 @@
#define DIF_VAR_GID 0x011f /* process group ID */
#define DIF_VAR_ERRNO 0x0120 /* thread errno */
#define DIF_VAR_EXECARGS 0x0121 /* process arguments */
+#define DIF_VAR_JID 0x0122 /* process jail id */
+#define DIF_VAR_JAILNAME 0x0123 /* process jail name */
#ifndef illumos
#define DIF_VAR_CPU 0x0200
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 12, 6:33 PM (9 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17124222
Default Alt Text
D13877.id37883.diff (5 KB)
Attached To
Mode
D13877: DTrace: Add jailname/jid builtins
Attached
Detach File
Event Timeline
Log In to Comment