summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2023-05-02 12:38:32 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2023-05-02 12:38:32 +0200
commit72906618b6353ef7b47582d74b98aff61b0d577e (patch)
tree81ea6d3811c1fa24ba2e6538298c2918d051ee86
parent4d5b9e89b5f258b71d8caab0d720e8762a31eb92 (diff)
downloadpsutil-72906618b6353ef7b47582d74b98aff61b0d577e.tar.gz
NetBSD, cmdline(): add debug message on EINVAL (re. to #2250)
-rw-r--r--psutil/_psbsd.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py
index 99808bd2..37433c2d 100644
--- a/psutil/_psbsd.py
+++ b/psutil/_psbsd.py
@@ -24,6 +24,7 @@ from ._common import NoSuchProcess
from ._common import ZombieProcess
from ._common import conn_tmap
from ._common import conn_to_ntuple
+from ._common import debug
from ._common import memoize
from ._common import memoize_when_activated
from ._common import usage_percent
@@ -662,10 +663,10 @@ class Process(object):
if OPENBSD and self.pid == 0:
return [] # ...else it crashes
elif NETBSD:
- # XXX - most of the times the underlying sysctl() call on Net
- # and Open BSD returns a truncated string.
- # Also /proc/pid/cmdline behaves the same so it looks
- # like this is a kernel bug.
+ # XXX - most of the times the underlying sysctl() call on
+ # NetBSD and OpenBSD returns a truncated string. Also
+ # /proc/pid/cmdline behaves the same so it looks like this
+ # is a kernel bug.
try:
return cext.proc_cmdline(self.pid)
except OSError as err:
@@ -677,6 +678,7 @@ class Process(object):
else:
# XXX: this happens with unicode tests. It means the C
# routine is unable to decode invalid unicode chars.
+ debug("ignoring %r and returning an empty list" % err)
return []
else:
raise