pkgsrc/sysutils/libgtop/patches/patch-ar
2004-04-02 12:10:12 +00:00

69 lines
1.8 KiB
Text

$NetBSD: patch-ar,v 1.1.1.1 2004/04/02 12:10:18 jmmv 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__