4a32abc628
based on work by Alexander Wirt <alexander.wirt@credativ.de> ok ajacoutot@
86 lines
2.8 KiB
Plaintext
86 lines
2.8 KiB
Plaintext
$OpenBSD: patch-sysdeps_freebsd_procmem_c,v 1.5 2007/01/18 19:31:34 jasper Exp $
|
|
--- sysdeps/freebsd/procmem.c.orig Wed Jan 17 09:01:28 2007
|
|
+++ sysdeps/freebsd/procmem.c Wed Jan 17 09:05:01 2007
|
|
@@ -34,7 +34,7 @@
|
|
#include <sys/resource.h>
|
|
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105020000)
|
|
#include <uvm/uvm_extern.h>
|
|
-#else
|
|
+#elif !defined(__OpenBSD__)
|
|
#include <vm/vm_object.h>
|
|
#include <vm/vm_map.h>
|
|
#endif
|
|
@@ -50,12 +50,13 @@
|
|
#include <sys/sysctl.h>
|
|
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105020000)
|
|
#include <uvm/uvm.h>
|
|
-#else
|
|
+#elif !defined(__OpenBSD__)
|
|
#include <vm/vm.h>
|
|
#endif
|
|
|
|
#if defined(__NetBSD__) && \
|
|
- (__NetBSD_Version__ >= 104000000) && (__NetBSD_Version__ < 105020000)
|
|
+ (__NetBSD_Version__ >= 104000000) && (__NetBSD_Version__ < 105020000) || \
|
|
+ defined(OpenBSD)
|
|
/* Fixme ... */
|
|
#undef _KERNEL
|
|
#define _UVM_UVM_AMAP_I_H_ 1
|
|
@@ -71,10 +72,8 @@ static const unsigned long _glibtop_sysd
|
|
(1L << GLIBTOP_PROC_MEM_RSS_RLIM);
|
|
|
|
static const unsigned long _glibtop_sysdeps_proc_mem_share =
|
|
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
|
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(OpenBSD) || defined(__FreeBSD__)
|
|
(1L << GLIBTOP_PROC_MEM_SHARE);
|
|
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
|
-(1L << GLIBTOP_PROC_MEM_SHARE);
|
|
#else
|
|
0;
|
|
#endif
|
|
@@ -121,7 +120,7 @@ glibtop_get_proc_mem_p (glibtop *server,
|
|
struct kinfo_proc *pinfo;
|
|
struct vm_map_entry entry, *first;
|
|
struct vmspace *vms, vmspace;
|
|
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
|
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(OpenBSD)
|
|
struct vnode vnode;
|
|
#else
|
|
struct vm_object object;
|
|
@@ -223,7 +222,7 @@ glibtop_get_proc_mem_p (glibtop *server,
|
|
continue;
|
|
#endif
|
|
#else
|
|
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
|
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(OpenBSD)
|
|
if (UVM_ET_ISSUBMAP (&entry))
|
|
continue;
|
|
#else
|
|
@@ -232,7 +231,7 @@ glibtop_get_proc_mem_p (glibtop *server,
|
|
#endif
|
|
#endif
|
|
|
|
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
|
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(OpenBSD)
|
|
if (!entry.object.uvm_obj)
|
|
continue;
|
|
|
|
@@ -259,7 +258,7 @@ glibtop_get_proc_mem_p (glibtop *server,
|
|
#endif
|
|
/* If the object is of type vnode, add its size */
|
|
|
|
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
|
|
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(OpenBSD)
|
|
#if defined(UVM_VNODE_VALID)
|
|
if (!vnode.v_uvm.u_flags & UVM_VNODE_VALID)
|
|
continue;
|
|
@@ -275,7 +274,7 @@ glibtop_get_proc_mem_p (glibtop *server,
|
|
#else
|
|
|
|
/* Reference count must be at least two. */
|
|
- if (vnode.v_uvm.u_obj.uo_refs <= 1)
|
|
+ if (vnode.v_usecount <= 1)
|
|
continue;
|
|
|
|
buf->share += pagetok (vnode.v_uvm.u_obj.uo_npages) << LOG1024;
|