|
Lines 1-5
Link Here
|
| 1 |
--- bsd/kernel.cc.orig Mon Jul 17 11:52:31 2000 |
1 |
--- bsd/kernel.cc.orig Tue Oct 9 10:40:51 2001 |
| 2 |
+++ bsd/kernel.cc Tue Aug 21 12:23:41 2001 |
2 |
+++ bsd/kernel.cc Mon Oct 27 20:03:03 2003 |
| 3 |
@@ -46,6 +46,7 @@ |
3 |
@@ -46,6 +46,7 @@ |
| 4 |
#endif |
4 |
#endif |
| 5 |
|
5 |
|
|
Lines 30-36
Link Here
|
| 30 |
int totalinuse, totalsize; |
30 |
int totalinuse, totalsize; |
| 31 |
int rnswap, nswap = swapctl(SWAP_NSWAP, 0, 0); |
31 |
int rnswap, nswap = swapctl(SWAP_NSWAP, 0, 0); |
| 32 |
struct swapent *swapiter; |
32 |
struct swapent *swapiter; |
| 33 |
@@ -828,25 +834,25 @@ |
33 |
@@ -557,13 +563,21 @@ |
|
|
34 |
* Make sure that the userland devstat version matches the kernel |
| 35 |
* devstat version. |
| 36 |
*/ |
| 37 |
+#if __FreeBSD_version >= 500000 |
| 38 |
+ if (devstat_checkversion(kd) < 0) { |
| 39 |
+#else |
| 40 |
if (checkversion() < 0) { |
| 41 |
+#endif |
| 42 |
nodisk++; |
| 43 |
return; |
| 44 |
} |
| 45 |
|
| 46 |
/* find out how many devices we have */ |
| 47 |
+#if __FreeBSD_version >= 500000 |
| 48 |
+ if ((num_devices = devstat_getnumdevs(kd)) < 0) { |
| 49 |
+#else |
| 50 |
if ((num_devices = getnumdevs()) < 0) { |
| 51 |
+#endif |
| 52 |
nodisk++; |
| 53 |
return; |
| 54 |
} |
| 55 |
@@ -578,7 +592,11 @@ |
| 56 |
* changed here, since it almost certainly has. We only look for |
| 57 |
* errors. |
| 58 |
*/ |
| 59 |
+#if __FreeBSD_version >= 500000 |
| 60 |
+ if (devstat_getdevs(kd,&cur) == -1) { |
| 61 |
+#else |
| 62 |
if (getdevs(&cur) == -1) { |
| 63 |
+#endif |
| 64 |
nodisk++; |
| 65 |
return; |
| 66 |
} |
| 67 |
@@ -590,7 +608,11 @@ |
| 68 |
|
| 69 |
/* only interested in disks */ |
| 70 |
matches = NULL; |
| 71 |
+#if __FreeBSD_version >= 500000 |
| 72 |
+ if (devstat_buildmatch("da", &matches, &num_matches) != 0) { |
| 73 |
+#else |
| 74 |
if (buildmatch("da", &matches, &num_matches) != 0) { |
| 75 |
+#endif |
| 76 |
nodisk++; |
| 77 |
return; |
| 78 |
} |
| 79 |
@@ -605,7 +627,11 @@ |
| 80 |
* device list has changed, so we don't look for return values of 0 |
| 81 |
* or 1. If we get back -1, though, there is an error. |
| 82 |
*/ |
| 83 |
+#if __FreeBSD_version >= 500000 |
| 84 |
+ if (devstat_selectdevs(&dev_select, &num_selected, |
| 85 |
+#else |
| 86 |
if (selectdevs(&dev_select, &num_selected, |
| 87 |
+#endif |
| 88 |
&num_selections, &select_generation, |
| 89 |
generation, cur.dinfo->devices, num_devices, |
| 90 |
matches, num_matches, |
| 91 |
@@ -632,7 +658,11 @@ |
| 92 |
* the selection process again, in case a device that we |
| 93 |
* were previously displaying has gone away. |
| 94 |
*/ |
| 95 |
+#if __FreeBSD_version >= 500000 |
| 96 |
+ switch (devstat_getdevs(kd,&cur)) { |
| 97 |
+#else |
| 98 |
switch (getdevs(&cur)) { |
| 99 |
+#endif |
| 100 |
case -1: |
| 101 |
return (0); |
| 102 |
case 1: { |
| 103 |
@@ -640,7 +670,11 @@ |
| 104 |
|
| 105 |
num_devices = cur.dinfo->numdevs; |
| 106 |
generation = cur.dinfo->generation; |
| 107 |
+#if __FreeBSD_version >= 500000 |
| 108 |
+ retval = devstat_selectdevs(&dev_select, &num_selected, |
| 109 |
+#else |
| 110 |
retval = selectdevs(&dev_select, &num_selected, |
| 111 |
+#endif |
| 112 |
&num_selections, &select_generation, |
| 113 |
generation, cur.dinfo->devices, |
| 114 |
num_devices, matches, num_matches, |
| 115 |
@@ -664,14 +698,22 @@ |
| 116 |
* Calculate elapsed time up front, since it's the same for all |
| 117 |
* devices. |
| 118 |
*/ |
| 119 |
+#if __FreeBSD_version >= 500000 |
| 120 |
+ busy_seconds = cur.snap_time - last.snap_time; |
| 121 |
+#else |
| 122 |
busy_seconds = compute_etime(cur.busy_time, last.busy_time); |
| 123 |
+#endif |
| 124 |
|
| 125 |
/* this is the first time thru so just copy cur to last */ |
| 126 |
if (last.dinfo->numdevs == 0) { |
| 127 |
tmp_dinfo = last.dinfo; |
| 128 |
last.dinfo = cur.dinfo; |
| 129 |
cur.dinfo = tmp_dinfo; |
| 130 |
+#if __FreeBSD_version >= 500000 |
| 131 |
+ last.snap_time = cur.snap_time; |
| 132 |
+#else |
| 133 |
last.busy_time = cur.busy_time; |
| 134 |
+#endif |
| 135 |
return (0); |
| 136 |
} |
| 137 |
|
| 138 |
@@ -685,7 +727,11 @@ |
| 139 |
|
| 140 |
di = dev_select[dn].position; |
| 141 |
|
| 142 |
+#if __FreeBSD_version >= 500000 |
| 143 |
+ if (devstat_compute_statistics(&cur.dinfo->devices[di], |
| 144 |
+#else |
| 145 |
if (compute_stats(&cur.dinfo->devices[di], |
| 146 |
+#endif |
| 147 |
&last.dinfo->devices[di], busy_seconds, |
| 148 |
&total_bytes, &total_transfers, |
| 149 |
NULL, NULL, |
| 150 |
@@ -700,7 +746,11 @@ |
| 151 |
last.dinfo = cur.dinfo; |
| 152 |
cur.dinfo = tmp_dinfo; |
| 153 |
|
| 154 |
+#if __FreeBSD_version >= 500000 |
| 155 |
+ last.snap_time = cur.snap_time; |
| 156 |
+#else |
| 157 |
last.busy_time = cur.busy_time; |
| 158 |
+#endif |
| 159 |
|
| 160 |
} else { |
| 161 |
/* no disks found ? */ |
| 162 |
@@ -828,25 +878,25 @@ |
| 34 |
OpenKDIfNeeded(); |
163 |
OpenKDIfNeeded(); |
| 35 |
nintr = (nlst[EINTRCNT_SYM_INDEX].n_value - |
164 |
nintr = (nlst[EINTRCNT_SYM_INDEX].n_value - |
| 36 |
nlst[INTRCNT_SYM_INDEX].n_value) / sizeof(int); |
165 |
nlst[INTRCNT_SYM_INDEX].n_value) / sizeof(int); |
|
Lines 63-69
Link Here
|
| 63 |
/* FreeBSD has an array of interrupt counts, indexed by device number. |
192 |
/* FreeBSD has an array of interrupt counts, indexed by device number. |
| 64 |
These are also indirected by IRQ num with intr_countp: */ |
193 |
These are also indirected by IRQ num with intr_countp: */ |
| 65 |
safe_kvm_read (nlst[INTRCOUNTP_SYM_INDEX].n_value, |
194 |
safe_kvm_read (nlst[INTRCOUNTP_SYM_INDEX].n_value, |
| 66 |
@@ -875,8 +881,8 @@ |
195 |
@@ -875,8 +925,8 @@ |
| 67 |
intrCount[i] = kvm_intrptrs[i]; |
196 |
intrCount[i] = kvm_intrptrs[i]; |
| 68 |
#endif /* _BSDI_VERSION */ |
197 |
#endif /* _BSDI_VERSION */ |
| 69 |
|
198 |
|