aboutsummaryrefslogtreecommitdiff
path: root/lib/libmemstat/memstat.h
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2005-08-01 19:07:39 +0000
committerRobert Watson <rwatson@FreeBSD.org>2005-08-01 19:07:39 +0000
commit33c20d188c95e286882b488f032c4d08bd52aca0 (patch)
tree114f0eee6842ca4f71539f0be9d6d57137832be8 /lib/libmemstat/memstat.h
parent786d03d56aeb816e5477f7f914643bd0e25303a0 (diff)
downloadsrc-33c20d188c95e286882b488f032c4d08bd52aca0.tar.gz
src-33c20d188c95e286882b488f032c4d08bd52aca0.zip
Add memstat_kvm_uma(), an implementation of a libmemstat(3) query routine
that knows how to extract UMA(9) allocator statistics from a core dump or live memory image using kvm(3). The caller is expected to provide the necessary kvm_t handle, which is then used by libmemstat(3). With these changes, it is trivially straight forward to re-introduce vmstat -z support on core dumps, which was lost when UMA was introduced. In the short term, this requires including vm/ include files that are not intended for extra-kernel use, requiring in turn some ugliness.
Notes
Notes: svn path=/head/; revision=148627
Diffstat (limited to 'lib/libmemstat/memstat.h')
-rw-r--r--lib/libmemstat/memstat.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libmemstat/memstat.h b/lib/libmemstat/memstat.h
index f46640876caf..561f6eedbdde 100644
--- a/lib/libmemstat/memstat.h
+++ b/lib/libmemstat/memstat.h
@@ -72,6 +72,9 @@
#define MEMSTAT_ERROR_PERMISSION 3 /* Permission denied. */
#define MEMSTAT_ERROR_TOOMANYCPUS 4 /* Too many CPUs. */
#define MEMSTAT_ERROR_DATAERROR 5 /* Error in stat data. */
+#define MEMSTAT_ERROR_KVM 6 /* See kvm_geterr() for err. */
+#define MEMSTAT_ERROR_KVM_NOSYMBOL 7 /* Symbol not available. */
+#define MEMSTAT_ERROR_KVM_SHORTREAD 8 /* Short kvm_read return. */
/*
* Forward declare struct memory_type, which holds per-type properties and
@@ -113,6 +116,12 @@ int memstat_sysctl_malloc(struct memory_type_list *list, int flags);
int memstat_sysctl_uma(struct memory_type_list *list, int flags);
/*
+ * Functions to retrieve data from a kernel core (or /dev/kmem).
+ */
+int memstat_kvm_all(struct memory_type_list *list, void *kvm_handle);
+int memstat_kvm_uma(struct memory_type_list *list, void *kvm_handle);
+
+/*
* Accessor methods for struct memory_type.
*/
const char *memstat_get_name(const struct memory_type *mtp);