Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2011 20:41:53 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        freebsd-emulation@freebsd.org
Subject:   [patch] a few linprocfs changes
Message-ID:  <20110128204153.GA68740@freebsd.org>

next in thread | raw e-mail | index | archive | help

--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

the following patch includes the following changes:

@@ -176,9 +176,10 @@:
- fix a style(9) issue

@@ -272,7 +273,7 @@
- use CPU_FOREACH() macro rather than iterating over each cpu manually

@@ -282,7 +283,6 @@
- remove comment. we don't gather the vendor, class, model, etc. data per cpu
  in sys/{i386,amd64}/{i386,amd64}/identcpu.c. so there's no way of accessing
  per cpu data in linprocfs.c, which relies on the data that gets gathered at
  boot time by identcpu.c.

@@ -299,9 +299,10 @@
- rather calculate the elements of flags[] at compile time, instead of relying
  on the hardcoded value.

cheers.
alex

-- 
a13x

--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="linprocfs.diff"

Index: linprocfs.c
===================================================================
--- linprocfs.c	(revision 218029)
+++ linprocfs.c	(working copy)
@@ -176,9 +176,10 @@
 	swapfree = swaptotal - swapused;
 	memshared = 0;
 	mtx_lock(&vm_object_list_mtx);
-	TAILQ_FOREACH(object, &vm_object_list, object_list)
+	TAILQ_FOREACH(object, &vm_object_list, object_list) {
 		if (object->shadow_count > 1)
 			memshared += object->resident_page_count;
+	}
 	mtx_unlock(&vm_object_list_mtx);
 	memshared *= PAGE_SIZE;
 	/*
@@ -272,7 +273,7 @@
 	size = sizeof(model);
 	if (kernel_sysctl(td, hw_model, 2, &model, &size, 0, 0, 0, 0) != 0)
 		strcpy(model, "unknown");
-	for (i = 0; i < mp_ncpus; ++i) {
+	CPU_FOREACH(i) {
 		sbuf_printf(sb,
 		    "processor\t: %d\n"
 		    "vendor_id\t: %.20s\n"
@@ -282,7 +283,6 @@
 		    "stepping\t: %u\n\n",
 		    i, cpu_vendor, CPUID_TO_FAMILY(cpu_id),
 		    CPUID_TO_MODEL(cpu_id), model, cpu_id & CPUID_STEPPING);
-		/* XXX per-cpu vendor / class / model / id? */
 	}
 
 	sbuf_cat(sb, "flags\t\t:");
@@ -299,9 +299,10 @@
 	}
 #endif
 
-	for (i = 0; i < 32; i++)
+	for (i = 0; i < sizeof(flags)/sizeof(flags[0]); i++) {
 		if (cpu_feature & (1 << i))
 			sbuf_printf(sb, " %s", flags[i]);
+	}
 	sbuf_cat(sb, "\n");
 	if (class >= 5) {
 		fqmhz = (tsc_freq + 4999) / 1000000;

--6TrnltStXW4iwmi0--



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