svn commit: r250147 - head/lib/libprocstat

Mikolaj Golub trociny at FreeBSD.org
Wed May 1 15:02:59 UTC 2013


Author: trociny
Date: Wed May  1 15:02:58 2013
New Revision: 250147
URL: http://svnweb.freebsd.org/changeset/base/250147

Log:
  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.
  
  MFC after:	3 weeks

Modified:
  head/lib/libprocstat/libprocstat.c

Modified: head/lib/libprocstat/libprocstat.c
==============================================================================
--- head/lib/libprocstat/libprocstat.c	Wed May  1 15:01:05 2013	(r250146)
+++ head/lib/libprocstat/libprocstat.c	Wed May  1 15:02:58 2013	(r250147)
@@ -2114,8 +2114,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-head mailing list