Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Oct 2012 11:33:32 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r241639 - stable/9/lib/libprocstat
Message-ID:  <201210171133.q9HBXWAR061043@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Wed Oct 17 11:33:32 2012
New Revision: 241639
URL: http://svn.freebsd.org/changeset/base/241639

Log:
  MFC r241304: procstat_getprocs: honor kvm_getprocs interface - cnt is signed

Modified:
  stable/9/lib/libprocstat/libprocstat.c
Directory Properties:
  stable/9/lib/libprocstat/   (props changed)

Modified: stable/9/lib/libprocstat/libprocstat.c
==============================================================================
--- stable/9/lib/libprocstat/libprocstat.c	Wed Oct 17 11:30:25 2012	(r241638)
+++ stable/9/lib/libprocstat/libprocstat.c	Wed Oct 17 11:33:32 2012	(r241639)
@@ -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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210171133.q9HBXWAR061043>