summaryrefslogtreecommitdiff
path: root/devel/libgtop/patches/patch-ar
blob: c8b6af82da4c19dc414dd34ed0889400d895ab0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
$NetBSD: patch-ar,v 1.3 2001/09/25 01:31:18 wiz Exp $

--- sysdeps/freebsd/procmem.c.orig	Thu May 27 20:56:49 1999
+++ sysdeps/freebsd/procmem.c
@@ -31,8 +31,12 @@
 #include <sys/param.h>
 #include <sys/proc.h>
 #include <sys/resource.h>
+#if defined(__NetBSD__) && (__NetBSD_Version__ < 105020000)
 #include <vm/vm_object.h>
 #include <vm/vm_map.h>
+#else
+#include <uvm/uvm_extern.h>
+#endif
 
 #include <sys/vnode.h>
 #include <ufs/ufs/quota.h>
@@ -43,9 +47,14 @@
 #include <sys/user.h>
 #endif
 #include <sys/sysctl.h>
+#if defined(__NetBSD__) && (__NetBSD_Version__ < 105020000)
 #include <vm/vm.h>
+#else
+#include <uvm/uvm.h>
+#endif
 
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if defined(__NetBSD__) && \
+	(__NetBSD_Version__ >= 104000000) && (__NetBSD_Version__ < 105020000)
 /* Fixme ... */
 #undef _KERNEL
 #define _UVM_UVM_AMAP_I_H_ 1
@@ -113,7 +122,6 @@
 	struct vmspace *vms, vmspace;
 #if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
 	struct vnode vnode;
-	struct inode inode;
 #else
 	struct vm_object object;
 #endif
@@ -233,17 +241,27 @@
 		/* If the object is of type vnode, add its size */
 
 #if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if defined(UVM_VNODE_VALID)
 		if (!vnode.v_uvm.u_flags & UVM_VNODE_VALID)
 			continue;
+#endif
 
 		if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) ||
 		    !vnode.v_data) continue;
 
+#if (__NetBSD_Version__ >= 105250000)
+		/* Reference count must be at least two. */
+		if (vnode.v_usecount <= 1)
+			continue;
+
+		buf->share += pagetok (vnode.v_uobj.uo_npages) << LOG1024;
+#else
 		/* Reference count must be at least two. */
 		if (vnode.v_uvm.u_obj.uo_refs <= 1)
 			continue;
 
 		buf->share += pagetok (vnode.v_uvm.u_obj.uo_npages) << LOG1024;
+#endif /* __NetBSD_Version__ >= 105250000 */
 #endif
 
 #ifdef __FreeBSD__