summaryrefslogtreecommitdiffstats
path: root/lib/libprocstat
diff options
context:
space:
mode:
authortrociny <trociny@FreeBSD.org>2013-05-01 15:02:58 +0000
committertrociny <trociny@FreeBSD.org>2013-05-01 15:02:58 +0000
commit8b709cd257fd06afd54fa6c29cea98814e28c1f5 (patch)
treef11333531413c5355563d5caceace8c5d3236fd3 /lib/libprocstat
parent49b0478cb530a5afcadbfee861032ec8956962e1 (diff)
downloadFreeBSD-src-8b709cd257fd06afd54fa6c29cea98814e28c1f5.zip
FreeBSD-src-8b709cd257fd06afd54fa6c29cea98814e28c1f5.tar.gz
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
Diffstat (limited to 'lib/libprocstat')
-rw-r--r--lib/libprocstat/libprocstat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c
index 535cdfc..dd16c80 100644
--- a/lib/libprocstat/libprocstat.c
+++ b/lib/libprocstat/libprocstat.c
@@ -2114,8 +2114,10 @@ procstat_getpathname(struct procstat *procstat, struct kinfo_proc *kp,
{
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));
OpenPOWER on IntegriCloud