svn commit: r251003 - stable/9/lib/libprocstat

Mikolaj Golub trociny at FreeBSD.org
Sun May 26 18:26:30 UTC 2013


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));


More information about the svn-src-all mailing list