summaryrefslogtreecommitdiffstats
path: root/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
diff options
context:
space:
mode:
authorrstone <rstone@FreeBSD.org>2012-04-26 01:07:03 +0000
committerrstone <rstone@FreeBSD.org>2012-04-26 01:07:03 +0000
commitad032fccda1eefdb6355b59b79560ed68ca81e68 (patch)
treecc38832de860647583832a494b9f77f94b0603aa /cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
parentf9995de53f8897f196450d96daee2c822dfad0eb (diff)
downloadFreeBSD-src-ad032fccda1eefdb6355b59b79560ed68ca81e68.zip
FreeBSD-src-ad032fccda1eefdb6355b59b79560ed68ca81e68.tar.gz
Implement the D "cpu" variable, which returns curcpu. I have chosen not
to follow the example of OpenSolaris and its descendants, which implemented cpu as an inline that took a value out of curthread. At certain points in the FreeBSD scheduler curthread->td_oncpu will no longer be valid (in particukar, just before the thread gets descheduled) so instead I have implemented this as its own built-in variable. Sponsored by: Sandvine Inc. MFC after: 1 week
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c')
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
index 962da1a..e77952d 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
@@ -497,6 +497,12 @@ static const dt_ident_t _dtrace_globals[] = {
{ "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME,
DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
#endif
+
+#if !defined(sun)
+{ "cpu", DT_IDENT_SCALAR, 0, DIF_VAR_CPU,
+ DT_ATTR_STABCMN, DT_VERS_1_6_3, &dt_idops_type, "int" },
+#endif
+
{ NULL, 0, 0, 0, { 0, 0, 0 }, 0, NULL, NULL }
};
OpenPOWER on IntegriCloud