Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 May 2013 15:02:59 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r250147 - head/lib/libprocstat
Message-ID:  <201305011502.r41F2xJI085759@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));



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