summaryrefslogtreecommitdiff
path: root/psutil/_psbsd.py
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-10-25 18:02:46 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2016-10-25 18:02:46 +0200
commit4b134aa8e203e5e7c8f8cfb8edc2751cf888516f (patch)
tree87a75ac20a2ef808e2a2a834414da5f9d2c2777d /psutil/_psbsd.py
parentf2e9e7a4d0e09953b3bbed10f9b5674761df9b90 (diff)
parent55dcd0204feed052276d310f23c633c20a392acf (diff)
downloadpsutil-4b134aa8e203e5e7c8f8cfb8edc2751cf888516f.tar.gz
merge from master
Diffstat (limited to 'psutil/_psbsd.py')
-rw-r--r--psutil/_psbsd.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py
index 4d35d141..5f8742df 100644
--- a/psutil/_psbsd.py
+++ b/psutil/_psbsd.py
@@ -193,8 +193,7 @@ def virtual_memory():
def swap_memory():
"""System swap memory as (total, used, free, sin, sout) namedtuple."""
- pagesize = 1 if OPENBSD else PAGESIZE
- total, used, free, sin, sout = [x * pagesize for x in cext.swap_mem()]
+ total, used, free, sin, sout = cext.swap_mem()
percent = usage_percent(used, total, _round=1)
return _common.sswap(total, used, free, percent, sin, sout)
@@ -342,7 +341,9 @@ def net_if_stats():
names = net_io_counters().keys()
ret = {}
for name in names:
- isup, duplex, speed, mtu = cext_posix.net_if_stats(name)
+ mtu = cext_posix.net_if_mtu(name)
+ isup = cext_posix.net_if_flags(name)
+ duplex, speed = cext_posix.net_if_duplex_speed(name)
if hasattr(_common, 'NicDuplex'):
duplex = _common.NicDuplex(duplex)
ret[name] = _common.snicstats(isup, duplex, speed, mtu)
@@ -440,6 +441,11 @@ def wrap_exceptions(fun):
try:
return fun(self, *args, **kwargs)
except OSError as err:
+ if self.pid == 0:
+ if 0 in pids():
+ raise AccessDenied(self.pid, self._name)
+ else:
+ raise
if err.errno == errno.ESRCH:
if not pid_exists(self.pid):
raise NoSuchProcess(self.pid, self._name)