From 72906618b6353ef7b47582d74b98aff61b0d577e Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Tue, 2 May 2023 12:38:32 +0200 Subject: NetBSD, cmdline(): add debug message on EINVAL (re. to #2250) --- psutil/_psbsd.py | 10 ++++++---- 1 file 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 -- cgit v1.2.1