diff options
author | Andriy Gapon <avg@FreeBSD.org> | 2012-10-06 20:17:28 +0000 |
---|---|---|
committer | Andriy Gapon <avg@FreeBSD.org> | 2012-10-06 20:17:28 +0000 |
commit | 391bdfb835a79618b504d5405336068bea116f60 (patch) | |
tree | 1a9c653ef31beab88a9249d811bbb36582518526 /lib/libprocstat/libprocstat.c | |
parent | ca895af355cc98dfba4bacf82bda6174b96b8509 (diff) | |
download | src-391bdfb835a79618b504d5405336068bea116f60.tar.gz src-391bdfb835a79618b504d5405336068bea116f60.zip |
procstat_getprocs: honor kvm_getprocs interface - cnt is signed
MFC after: 10 days
Notes
Notes:
svn path=/head/; revision=241304
Diffstat (limited to 'lib/libprocstat/libprocstat.c')
-rw-r--r-- | lib/libprocstat/libprocstat.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c index 56562e129b15..11a817e090d2 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) { |