From ad032fccda1eefdb6355b59b79560ed68ca81e68 Mon Sep 17 00:00:00 2001 From: rstone Date: Thu, 26 Apr 2012 01:07:03 +0000 Subject: 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 --- cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c') 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 } }; -- cgit v1.1