PERFORCE change 96134 for review

John Birrell jb at FreeBSD.org
Wed Apr 26 04:33:10 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=96134

Change 96134 by jb at jb_freebsd2 on 2006/04/26 04:33:03

	SysV -> BSD ioctl changes.
	
	There are still a few hacks here. Need to get the max CPU ID via
	a sysctl.

Affected files ...

.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_consume.c#5 edit

Differences ...

==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_consume.c#5 (text) ====

@@ -1747,13 +1747,20 @@
 	dt_begin_t begin;
 	processorid_t cpu = dtp->dt_beganon;
 	dtrace_bufdesc_t nbuf;
+#if !defined(sun)
+	dtrace_bufdesc_t *pbuf;
+#endif
 	int rval, i;
 	static int max_ncpus;
 	dtrace_optval_t size;
 
 	dtp->dt_beganon = -1;
 
+#if defined(sun)
 	if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
+#else
+	if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &buf) == -1) {
+#endif
 		/*
 		 * We really don't expect this to fail, but it is at least
 		 * technically possible for this to fail with ENOENT.  In this
@@ -1807,9 +1814,11 @@
 		return (dt_set_errno(dtp, EDT_NOMEM));
 
 printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
+	if (max_ncpus == 0)
 #ifdef DOODAD
-	if (max_ncpus == 0)
 		max_ncpus = dt_sysconf(dtp, _SC_CPUID_MAX) + 1;
+else
+		max_ncpus = 1;
 #endif
 
 	for (i = 0; i < max_ncpus; i++) {
@@ -1818,7 +1827,12 @@
 		if (i == cpu)
 			continue;
 
+#if defined(sun)
 		if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &nbuf) == -1) {
+#else
+		pbuf = &nbuf;
+		if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &pbuf) == -1) {
+#endif
 			/*
 			 * If we failed with ENOENT, it may be because the
 			 * CPU was unconfigured -- this is okay.  Any other
@@ -1887,10 +1901,12 @@
 	if (!dtp->dt_active)
 		return (dt_set_errno(dtp, EINVAL));
 
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
+printf("%s:%s(%d): dt_sysconf _SC_CPUID_MAX\n",__FUNCTION__,__FILE__,__LINE__);
+	if (max_ncpus == 0)
 #ifdef DOODAD
-	if (max_ncpus == 0)
 		max_ncpus = dt_sysconf(dtp, _SC_CPUID_MAX) + 1;
+#else
+		max_ncpus = 1;
 #endif
 
 	if (pf == NULL)
@@ -1928,7 +1944,11 @@
 		if (dtp->dt_stopped && (i == dtp->dt_endedon))
 			continue;
 
+#if defined(sun)
 		if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
+#else
+		if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &buf) == -1) {
+#endif
 			/*
 			 * If we failed with ENOENT, it may be because the
 			 * CPU was unconfigured -- this is okay.  Any other
@@ -1949,7 +1969,11 @@
 
 	buf->dtbd_cpu = dtp->dt_endedon;
 
+#if defined(sun)
 	if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
+#else
+	if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
+#endif
 		/*
 		 * This _really_ shouldn't fail, but it is strictly speaking
 		 * possible for this to return ENOENT if the CPU that called


More information about the p4-projects mailing list