From owner-freebsd-emulation@FreeBSD.ORG Fri Jan 28 20:41:53 2011 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id DF6381065670; Fri, 28 Jan 2011 20:41:53 +0000 (UTC) Date: Fri, 28 Jan 2011 20:41:53 +0000 From: Alexander Best To: freebsd-emulation@freebsd.org Message-ID: <20110128204153.GA68740@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="6TrnltStXW4iwmi0" Content-Disposition: inline Subject: [patch] a few linprocfs changes X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jan 2011 20:41:54 -0000 --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--