svn commit: r241304 - head/lib/libprocstat
Andriy Gapon
avg at FreeBSD.org
Sat Oct 6 20:17:29 UTC 2012
Author: avg
Date: Sat Oct 6 20:17:28 2012
New Revision: 241304
URL: http://svn.freebsd.org/changeset/base/241304
Log:
procstat_getprocs: honor kvm_getprocs interface - cnt is signed
MFC after: 10 days
Modified:
head/lib/libprocstat/libprocstat.c
Modified: head/lib/libprocstat/libprocstat.c
==============================================================================
--- head/lib/libprocstat/libprocstat.c Sat Oct 6 20:16:04 2012 (r241303)
+++ head/lib/libprocstat/libprocstat.c Sat Oct 6 20:17:28 2012 (r241304)
@@ -184,15 +184,18 @@ procstat_getprocs(struct procstat *procs
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) {
More information about the svn-src-all
mailing list