You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple C test program that just calls getpriority() on that PID also fails with EINVAL.
Perhaps getpriority() always fails for realtime processes, on Solaris 10. Is kind of plausible - since priorities doesn't really make sense for realtime. The man page doesn't include details on that topic, though.
This breaks psutil.process_iter() unless one uses a non-default attribute set that doesn't include 'nice'. Example how to make it fail with a minimal attribute set:
>>> for p in psutil.process_iter(): print(p.as_dict(attrs=['nice']))
{'nice': 0}
{'nice': -20}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/venv/lib/python3.5/site-packages/psutil/__init__.py", line 574, in as_dict
ret = meth()
File "/path/to/venv/lib/python3.5/site-packages/psutil/__init__.py", line 755, in nice
return self._proc.nice_get()
File "/path/to/venv/lib/python3.5/site-packages/psutil/_pssunos.py", line 346, in wrapper
return fun(self, *args, **kwargs)
File "/path/to/venv/lib/python3.5/site-packages/psutil/_pssunos.py", line 451, in nice_get
return cext_posix.getpriority(self.pid)
OSError: [Errno 22] Invalid argument
The psutil Solaris-specific code contains a note regarding getpriority() vs. psinfo that mentions issue #1082.
How to reproduce - chose xntp on Solaris 10:
The system's ps is able to return the nice value:
A simple C test program that just calls
getpriority()
on that PID also fails with EINVAL.Perhaps
getpriority()
always fails for realtime processes, on Solaris 10. Is kind of plausible - since priorities doesn't really make sense for realtime. The man page doesn't include details on that topic, though.This breaks
psutil.process_iter()
unless one uses a non-default attribute set that doesn't include'nice'
. Example how to make it fail with a minimal attribute set:The psutil Solaris-specific code contains a note regarding
getpriority()
vs.psinfo
that mentions issue #1082.There are several ways how to fix this:
getpriority()
first and fall back to psinfops
getpriority()
failsSee also:
ps
prints the nice value: https://github.com/illumos/illumos-gate/blob/f7877f5d39900cfd8b20dd673e5ccc1ef7cc7447/usr/src/cmd/ps/ps.c#L1812-L1816The text was updated successfully, but these errors were encountered: