summaryrefslogtreecommitdiff
path: root/psutil/_psaix.py
diff options
context:
space:
mode:
authorChris Lalancette <clalancette@gmail.com>2022-09-06 12:23:08 -0400
committerGitHub <noreply@github.com>2022-09-06 18:23:08 +0200
commit70eecaf44d61f2cabcd22ffb407b904242a122c9 (patch)
tree29d605b10d7cde532d5aade3b9939bc16c94988b /psutil/_psaix.py
parent9f9a82d02c901f62512236b44edb050f84cbe5b6 (diff)
downloadpsutil-70eecaf44d61f2cabcd22ffb407b904242a122c9.tar.gz
Add in support for network interface flags. (#2037)
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Diffstat (limited to 'psutil/_psaix.py')
-rw-r--r--psutil/_psaix.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/psutil/_psaix.py b/psutil/_psaix.py
index 9cc7d56e..2391478c 100644
--- a/psutil/_psaix.py
+++ b/psutil/_psaix.py
@@ -237,7 +237,8 @@ def net_if_stats():
names = set([x[0] for x in net_if_addrs()])
ret = {}
for name in names:
- isup, mtu = cext.net_if_stats(name)
+ mtu = cext_posix.net_if_mtu(name)
+ flags = cext_posix.net_if_flags(name)
# try to get speed and duplex
# TODO: rewrite this in C (entstat forks, so use truss -f to follow.
@@ -257,8 +258,10 @@ def net_if_stats():
speed = int(re_result.group(1))
duplex = re_result.group(2)
+ output_flags = ','.join(flags)
+ isup = 'running' in flags
duplex = duplex_map.get(duplex, NIC_DUPLEX_UNKNOWN)
- ret[name] = _common.snicstats(isup, duplex, speed, mtu)
+ ret[name] = _common.snicstats(isup, duplex, speed, mtu, output_flags)
return ret