Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 May 2012 18:57:21 +0000 (UTC)
From:      Ryan Stone <rstone@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r236161 - in stable/8: cddl/contrib/opensolaris/lib/libdtrace/common sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/contrib/opensolaris/uts/common/sys
Message-ID:  <201205271857.q4RIvLFx066258@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rstone
Date: Sun May 27 18:57:20 2012
New Revision: 236161
URL: http://svn.freebsd.org/changeset/base/236161

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
   particukar, just before the thread gets descheduled) so instead I have
   implemented this as its own built-in variable.
  
   Sponsored by: Sandvine Inc.

Modified:
  stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
Directory Properties:
  stable/8/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)

Modified: stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
==============================================================================
--- stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c	Sun May 27 18:55:23 2012	(r236160)
+++ stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c	Sun May 27 18:57:20 2012	(r236161)
@@ -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/8/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==============================================================================
--- stable/8/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Sun May 27 18:55:23 2012	(r236160)
+++ stable/8/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Sun May 27 18:57:20 2012	(r236161)
@@ -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/8/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
==============================================================================
--- stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h	Sun May 27 18:55:23 2012	(r236160)
+++ stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h	Sun May 27 18:57:20 2012	(r236161)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205271857.q4RIvLFx066258>