diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-09-21 21:00:10 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-09-21 21:00:10 +0200 |
commit | ba0c0ab967b0f524807cedf06554b94b7aba3d70 (patch) | |
tree | ffe858bd1f94b1cfc931506490456da4efd35b4d | |
parent | 1d5073aac29a3f50c19b864d22688cf20447f1e9 (diff) | |
download | psutil-ba0c0ab967b0f524807cedf06554b94b7aba3d70.tar.gz |
update doc for #1830 (net_if_stats() isup check if NIC is running)
-rw-r--r-- | HISTORY.rst | 4 | ||||
-rw-r--r-- | docs/index.rst | 4 | ||||
-rw-r--r-- | psutil/__init__.py | 2 | ||||
-rw-r--r-- | psutil/_psbsd.py | 2 | ||||
-rw-r--r-- | psutil/_pslinux.py | 2 | ||||
-rw-r--r-- | psutil/_psosx.py | 2 | ||||
-rw-r--r-- | psutil/_psutil_posix.c | 6 |
7 files changed, 13 insertions, 9 deletions
diff --git a/HISTORY.rst b/HISTORY.rst index 36c38c95..3f495174 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,7 +7,9 @@ XXXX-XX-XX **Enhancements** -- 893_: implement Process.environ() on BSD family. (patch by Armin Gruner) +- 893_: implement `Process.environ()` on BSD family. (patch by Armin Gruner) +- 1830_: [UNIX] `net_if_stats()`'s `isup` also checks whether the NIC is + running (meaning Wi-Fi or ethernet cable is connected). 5.7.2 ===== diff --git a/docs/index.rst b/docs/index.rst index c6bbe592..fa55b025 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -687,7 +687,8 @@ Network system as a dictionary whose keys are the NIC names and value is a named tuple with the following fields: - - **isup**: a bool indicating whether the NIC is up and running. + - **isup**: a bool indicating whether the NIC is up and running (meaning + ethernet cable or Wi-Fi is connected). - **duplex**: the duplex communication type; it can be either :const:`NIC_DUPLEX_FULL`, :const:`NIC_DUPLEX_HALF` or :const:`NIC_DUPLEX_UNKNOWN`. @@ -706,6 +707,7 @@ Network .. versionadded:: 3.0.0 + .. versionchanged:: 5.7.3 `isup` on UNIX also checks whether the NIC is running. Sensors ------- diff --git a/psutil/__init__.py b/psutil/__init__.py index 65d0297f..9d43f991 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -226,7 +226,7 @@ AF_LINK = _psplatform.AF_LINK __all__.extend(_psplatform.__extra__all__) __author__ = "Giampaolo Rodola'" -__version__ = "5.7.2" +__version__ = "5.7.3" version_info = tuple([int(num) for num in __version__.split('.')]) _timer = getattr(time, 'monotonic', time.time) diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py index 0568e3a8..9565406b 100644 --- a/psutil/_psbsd.py +++ b/psutil/_psbsd.py @@ -353,7 +353,7 @@ def net_if_stats(): for name in names: try: mtu = cext_posix.net_if_mtu(name) - isup = cext_posix.net_if_flags(name) + isup = cext_posix.net_if_is_running(name) duplex, speed = cext_posix.net_if_duplex_speed(name) except OSError as err: # https://github.com/giampaolo/psutil/issues/1279 diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index 3e3caace..52f7dd97 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -1031,7 +1031,7 @@ def net_if_stats(): for name in names: try: mtu = cext_posix.net_if_mtu(name) - isup = cext_posix.net_if_flags(name) + isup = cext_posix.net_if_is_running(name) duplex, speed = cext.net_if_duplex_speed(name) except OSError as err: # https://github.com/giampaolo/psutil/issues/1279 diff --git a/psutil/_psosx.py b/psutil/_psosx.py index 2feff932..6a189931 100644 --- a/psutil/_psosx.py +++ b/psutil/_psosx.py @@ -262,7 +262,7 @@ def net_if_stats(): for name in names: try: mtu = cext_posix.net_if_mtu(name) - isup = cext_posix.net_if_flags(name) + isup = cext_posix.net_if_is_running(name) duplex, speed = cext_posix.net_if_duplex_speed(name) except OSError as err: # https://github.com/giampaolo/psutil/issues/1279 diff --git a/psutil/_psutil_posix.c b/psutil/_psutil_posix.c index 8fe7f6b7..1182765d 100644 --- a/psutil/_psutil_posix.c +++ b/psutil/_psutil_posix.c @@ -385,7 +385,7 @@ error: * http://www.i-scream.org/libstatgrab/ */ static PyObject * -psutil_net_if_flags(PyObject *self, PyObject *args) { +psutil_net_if_is_running(PyObject *self, PyObject *args) { char *nic_name; int sock = -1; int ret; @@ -621,8 +621,8 @@ static PyMethodDef mod_methods[] = { "Retrieve NICs information"}, {"net_if_mtu", psutil_net_if_mtu, METH_VARARGS, "Retrieve NIC MTU"}, - {"net_if_flags", psutil_net_if_flags, METH_VARARGS, - "Retrieve NIC flags"}, + {"net_if_is_running", psutil_net_if_is_running, METH_VARARGS, + "Return True if the NIC is running."}, #if defined(PSUTIL_BSD) || defined(PSUTIL_OSX) {"net_if_duplex_speed", psutil_net_if_duplex_speed, METH_VARARGS, "Return NIC stats."}, |