Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 May 2013 18:26:29 +0000 (UTC)
From:      Mikolaj Golub <trociny@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: r251003 - stable/9/lib/libprocstat
Message-ID:  <201305261826.r4QIQTMg024837@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trociny
Date: Sun May 26 18:26:29 2013
New Revision: 251003
URL: http://svnweb.freebsd.org/changeset/base/251003

Log:
  MFC r250147:
  
  procstat_getpathname: for kvm method, instead of returning the error
  that the method is not supported, return an empty string.
  
  This looks more handy for callers like procstat(1), which will not
  abort after the failed call and still output some useful information.

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	Sun May 26 17:00:15 2013	(r251002)
+++ stable/9/lib/libprocstat/libprocstat.c	Sun May 26 18:26:29 2013	(r251003)
@@ -2120,8 +2120,10 @@ procstat_getpathname(struct procstat *pr
 {
 	switch(procstat->type) {
 	case PROCSTAT_KVM:
-		warnx("kvm method is not supported");
-		return (-1);
+		/* XXX: Return empty string. */
+		if (maxlen > 0)
+			pathname[0] = '\0';
+		return (0);
 	case PROCSTAT_SYSCTL:
 		return (procstat_getpathname_sysctl(kp->ki_pid, pathname,
 		    maxlen));



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