summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2012-10-17 11:33:32 +0000
committerAndriy Gapon <avg@FreeBSD.org>2012-10-17 11:33:32 +0000
commit77c9abffb38f57acf91606ddf8552116328a9d87 (patch)
tree081abf01054c4f0d846ff1c8903ebbef8aec5522
parent9e55c0e4a37cb0c3ea0222411696310b253ccf80 (diff)
Notes
-rw-r--r--lib/libprocstat/libprocstat.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c
index 56562e129b157..11a817e090d2c 100644
--- a/lib/libprocstat/libprocstat.c
+++ b/lib/libprocstat/libprocstat.c
@@ -184,15 +184,18 @@ procstat_getprocs(struct procstat *procstat, int what, int arg,
struct kinfo_proc *p0, *p;
size_t len;
int name[4];
+ int cnt;
int error;
assert(procstat);
assert(count);
p = NULL;
if (procstat->type == PROCSTAT_KVM) {
- p0 = kvm_getprocs(procstat->kd, what, arg, count);
- if (p0 == NULL || count == 0)
+ *count = 0;
+ p0 = kvm_getprocs(procstat->kd, what, arg, &cnt);
+ if (p0 == NULL || cnt <= 0)
return (NULL);
+ *count = cnt;
len = *count * sizeof(*p);
p = malloc(len);
if (p == NULL) {