linprocfs.c (116173) | linprocfs.c (117723) |
---|---|
1/* 2 * Copyright (c) 2000 Dag-Erling Co�dan Sm�rgrav 3 * Copyright (c) 1999 Pierre Beyssac 4 * Copyright (c) 1993 Jan-Simon Pendry 5 * Copyright (c) 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by --- 26 unchanged lines hidden (view full) --- 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 40 */ 41 42#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2000 Dag-Erling Co�dan Sm�rgrav 3 * Copyright (c) 1999 Pierre Beyssac 4 * Copyright (c) 1993 Jan-Simon Pendry 5 * Copyright (c) 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by --- 26 unchanged lines hidden (view full) --- 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 40 */ 41 42#include <sys/cdefs.h> |
43__FBSDID("$FreeBSD: head/sys/compat/linprocfs/linprocfs.c 116173 2003-06-10 21:29:12Z obrien $"); | 43__FBSDID("$FreeBSD: head/sys/compat/linprocfs/linprocfs.c 117723 2003-07-18 10:26:09Z phk $"); |
44 45#include <sys/param.h> 46#include <sys/queue.h> 47#include <sys/blist.h> 48#include <sys/conf.h> 49#include <sys/exec.h> 50#include <sys/jail.h> 51#include <sys/kernel.h> --- 64 unchanged lines hidden (view full) --- 116 unsigned long memused; /* used memory in bytes */ 117 unsigned long memfree; /* free memory in bytes */ 118 unsigned long memshared; /* shared memory ??? */ 119 unsigned long buffers, cached; /* buffer / cache memory ??? */ 120 unsigned long long swaptotal; /* total swap space in bytes */ 121 unsigned long long swapused; /* used swap space in bytes */ 122 unsigned long long swapfree; /* free swap space in bytes */ 123 vm_object_t object; | 44 45#include <sys/param.h> 46#include <sys/queue.h> 47#include <sys/blist.h> 48#include <sys/conf.h> 49#include <sys/exec.h> 50#include <sys/jail.h> 51#include <sys/kernel.h> --- 64 unchanged lines hidden (view full) --- 116 unsigned long memused; /* used memory in bytes */ 117 unsigned long memfree; /* free memory in bytes */ 118 unsigned long memshared; /* shared memory ??? */ 119 unsigned long buffers, cached; /* buffer / cache memory ??? */ 120 unsigned long long swaptotal; /* total swap space in bytes */ 121 unsigned long long swapused; /* used swap space in bytes */ 122 unsigned long long swapfree; /* free swap space in bytes */ 123 vm_object_t object; |
124 int i, j; |
|
124 125 memtotal = physmem * PAGE_SIZE; 126 /* 127 * The correct thing here would be: 128 * 129 memfree = cnt.v_free_count * PAGE_SIZE; 130 memused = memtotal - memfree; 131 * 132 * but it might mislead linux binaries into thinking there 133 * is very little memory left, so we cheat and tell them that 134 * all memory that isn't wired down is free. 135 */ 136 memused = cnt.v_wire_count * PAGE_SIZE; 137 memfree = memtotal - memused; | 125 126 memtotal = physmem * PAGE_SIZE; 127 /* 128 * The correct thing here would be: 129 * 130 memfree = cnt.v_free_count * PAGE_SIZE; 131 memused = memtotal - memfree; 132 * 133 * but it might mislead linux binaries into thinking there 134 * is very little memory left, so we cheat and tell them that 135 * all memory that isn't wired down is free. 136 */ 137 memused = cnt.v_wire_count * PAGE_SIZE; 138 memfree = memtotal - memused; |
138 if (swapblist == NULL) { 139 swaptotal = 0; 140 swapfree = 0; 141 } else { 142 swaptotal = (u_quad_t)swapblist->bl_blocks * 1024; /* XXX why 1024? */ 143 swapfree = (u_quad_t)swapblist->bl_root->u.bmu_avail * PAGE_SIZE; 144 } 145 swapused = swaptotal - swapfree; | 139 swap_pager_status(&i, &j); 140 swaptotal = i * PAGE_SIZE; 141 swapused = j * PAGE_SIZE; 142 swapfree = swaptotal - swapused; |
146 memshared = 0; 147 TAILQ_FOREACH(object, &vm_object_list, object_list) 148 if (object->shadow_count > 1) 149 memshared += object->resident_page_count; 150 memshared *= PAGE_SIZE; 151 /* 152 * We'd love to be able to write: 153 * --- 737 unchanged lines hidden --- | 143 memshared = 0; 144 TAILQ_FOREACH(object, &vm_object_list, object_list) 145 if (object->shadow_count > 1) 146 memshared += object->resident_page_count; 147 memshared *= PAGE_SIZE; 148 /* 149 * We'd love to be able to write: 150 * --- 737 unchanged lines hidden --- |