svn commit: r194449 - vendor-sys/opensolaris/dist/uts/common/dtrace vendor/opensolaris/dist/cmd/dtrace/test/tst/common/funcs vendor/opensolaris/dist/cmd/sgs/include vendor/opensolaris/dist/lib/libd...

John Baldwin jhb at FreeBSD.org
Thu Jun 18 17:11:26 UTC 2009


Author: jhb
Date: Thu Jun 18 17:11:24 2009
New Revision: 194449
URL: http://svn.freebsd.org/changeset/base/194449

Log:
  Import newer versions of these files from a 20080410 checkout of
  OpenSolaris.  Our local diffs to these files in HEAD already contain all
  these changes (and in fact seem to be based on these versions of the files).
  It seems the vendor branch just has older versions somehow.

Modified:
  vendor-sys/opensolaris/dist/uts/common/dtrace/dtrace.c

Changes in other areas also in this revision:
Modified:
  vendor/opensolaris/dist/cmd/dtrace/test/tst/common/funcs/tst.substr.d
  vendor/opensolaris/dist/cmd/dtrace/test/tst/common/funcs/tst.substr.d.out
  vendor/opensolaris/dist/cmd/sgs/include/debug.h
  vendor/opensolaris/dist/cmd/sgs/include/sgs.h
  vendor/opensolaris/dist/lib/libdtrace/common/dt_cc.c
  vendor/opensolaris/dist/lib/libdtrace/common/dt_impl.h
  vendor/opensolaris/dist/lib/libdtrace/common/dt_link.c
  vendor/opensolaris/dist/lib/libdtrace/common/dt_open.c
  vendor/opensolaris/dist/lib/libdtrace/common/dt_pid.c
  vendor/opensolaris/dist/lib/libdtrace/common/dt_pragma.c

Modified: vendor-sys/opensolaris/dist/uts/common/dtrace/dtrace.c
==============================================================================
--- vendor-sys/opensolaris/dist/uts/common/dtrace/dtrace.c	Thu Jun 18 17:10:43 2009	(r194448)
+++ vendor-sys/opensolaris/dist/uts/common/dtrace/dtrace.c	Thu Jun 18 17:11:24 2009	(r194449)
@@ -3607,15 +3607,15 @@ dtrace_dif_subr(uint_t subr, uint_t rd, 
 			break;
 		}
 
-		if (nargs <= 2)
-			remaining = (int64_t)size;
-
 		if (!DTRACE_INSCRATCH(mstate, size)) {
 			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
 			regs[rd] = NULL;
 			break;
 		}
 
+		if (nargs <= 2)
+			remaining = (int64_t)size;
+
 		if (index < 0) {
 			index += len;
 
@@ -3625,19 +3625,21 @@ dtrace_dif_subr(uint_t subr, uint_t rd, 
 			}
 		}
 
-		if (index >= len || index < 0)
-			index = len;
-
-		for (d[0] = '\0'; remaining > 0; remaining--) {
-			if ((d[i++] = dtrace_load8(s++ + index)) == '\0')
-				break;
+		if (index >= len || index < 0) {
+			remaining = 0;
+		} else if (remaining < 0) {
+			remaining += len - index;
+		} else if (index + remaining > size) {
+			remaining = size - index;
+		}
 
-			if (i == size) {
-				d[i - 1] = '\0';
+		for (i = 0; i < remaining; i++) {
+			if ((d[i] = dtrace_load8(s + index + i)) == '\0')
 				break;
-			}
 		}
 
+		d[i] = '\0';
+
 		mstate->dtms_scratch_ptr += size;
 		regs[rd] = (uintptr_t)d;
 		break;
@@ -3706,9 +3708,9 @@ dtrace_dif_subr(uint_t subr, uint_t rd, 
 		 * explained to them, and who can't even concisely describe
 		 * the conditions under which one would be forced to resort to
 		 * this technique.  Needless to say, those conditions are
-		 * found here -- and probably only here.  Is this is the only
-		 * use of this infamous trick in shipping, production code?
-		 * If it isn't, it probably should be...
+		 * found here -- and probably only here.  Is this the only use
+		 * of this infamous trick in shipping, production code?  If it
+		 * isn't, it probably should be...
 		 */
 		if (minor != -1) {
 			uintptr_t maddr = dtrace_loadptr(daddr +
@@ -10776,33 +10778,6 @@ dtrace_enabling_matchall(void)
 	mutex_exit(&cpu_lock);
 }
 
-static int
-dtrace_enabling_matchstate(dtrace_state_t *state, int *nmatched)
-{
-	dtrace_enabling_t *enab;
-	int matched, total = 0, err;
-
-	ASSERT(MUTEX_HELD(&cpu_lock));
-	ASSERT(MUTEX_HELD(&dtrace_lock));
-
-	for (enab = dtrace_retained; enab != NULL; enab = enab->dten_next) {
-		ASSERT(enab->dten_vstate->dtvs_state != NULL);
-
-		if (enab->dten_vstate->dtvs_state != state)
-			continue;
-
-		if ((err = dtrace_enabling_match(enab, &matched)) != 0)
-			return (err);
-
-		total += matched;
-	}
-
-	if (nmatched != NULL)
-		*nmatched = total;
-
-	return (0);
-}
-
 /*
  * If an enabling is to be enabled without having matched probes (that is, if
  * dtrace_state_go() is to be called on the underlying dtrace_state_t), the
@@ -14790,13 +14765,9 @@ dtrace_ioctl(dev_t dev, int cmd, intptr_
 		 * cue to reevaluate our enablings.
 		 */
 		if (arg == NULL) {
-			mutex_enter(&cpu_lock);
-			mutex_enter(&dtrace_lock);
-			err = dtrace_enabling_matchstate(state, rv);
-			mutex_exit(&dtrace_lock);
-			mutex_exit(&cpu_lock);
+			dtrace_enabling_matchall();
 
-			return (err);
+			return (0);
 		}
 
 		if ((dof = dtrace_dof_copyin(arg, &rval)) == NULL)


More information about the svn-src-all mailing list