svn commit: r236160 - in stable/9:
cddl/contrib/opensolaris/lib/libdtrace/common
sys/cddl/contrib/opensolaris/uts/common/dtrace
sys/cddl/contrib/opensolaris/uts/common/sys
Ryan Stone
rstone at FreeBSD.org
Sun May 27 18:55:23 UTC 2012
Author: rstone
Date: Sun May 27 18:55:23 2012
New Revision: 236160
URL: http://svn.freebsd.org/changeset/base/236160
Log:
MFC r234691
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
particular, just before the thread gets descheduled) so instead I have
implemented this as its own built-in variable.
Sponsored by: Sandvine Inc.
Modified:
stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/cddl/contrib/opensolaris/ (props changed)
Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
==============================================================================
--- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Sun May 27 16:27:04 2012 (r236159)
+++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Sun May 27 18:55:23 2012 (r236160)
@@ -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 }
};
Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sun May 27 16:27:04 2012 (r236159)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sun May 27 18:55:23 2012 (r236160)
@@ -3143,6 +3143,11 @@ dtrace_dif_variable(dtrace_mstate_t *mst
return (curthread->td_errno);
#endif
}
+#if !defined(sun)
+ case DIF_VAR_CPU: {
+ return curcpu;
+ }
+#endif
default:
DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
return (0);
Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Sun May 27 16:27:04 2012 (r236159)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Sun May 27 18:55:23 2012 (r236160)
@@ -251,6 +251,10 @@ typedef enum dtrace_probespec {
#define DIF_VAR_ERRNO 0x0120 /* thread errno */
#define DIF_VAR_EXECARGS 0x0121 /* process arguments */
+#if !defined(sun)
+#define DIF_VAR_CPU 0x0200
+#endif
+
#define DIF_SUBR_RAND 0
#define DIF_SUBR_MUTEX_OWNED 1
#define DIF_SUBR_MUTEX_OWNER 2
More information about the svn-src-stable-9
mailing list