summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-02-15 06:26:03 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2016-02-15 06:26:03 +0100
commit984f060eefb328310060e0ec480c5c887b0f9704 (patch)
treef2a30a5860926c619e84d6e97dbfd73e1bd4af48
parent3f57ee88a64233855e492b25bae7f554ee595c46 (diff)
downloadpsutil-984f060eefb328310060e0ec480c5c887b0f9704.tar.gz
fix #774 / net_io_counters / freebsd: provide dropout metrics if available
-rw-r--r--HISTORY.rst2
-rw-r--r--psutil/_psutil_bsd.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index 3c4dfa7a..5ba233b8 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -10,6 +10,8 @@ Bug tracker at https://github.com/giampaolo/psutil/issues
**Bug fixes**
+- #774: [FreeBSD] net_io_counters() dropout is no longer set to 0 if the kernel
+ provides it.
- #776: [Linux] Process.cpu_affinity() may erroneously raise NoSuchProcess.
(patch by wxwright)
diff --git a/psutil/_psutil_bsd.c b/psutil/_psutil_bsd.c
index fa596d34..db05dc8e 100644
--- a/psutil/_psutil_bsd.c
+++ b/psutil/_psutil_bsd.c
@@ -812,7 +812,12 @@ psutil_net_io_counters(PyObject *self, PyObject *args) {
if2m->ifm_data.ifi_ierrors,
if2m->ifm_data.ifi_oerrors,
if2m->ifm_data.ifi_iqdrops,
- 0); // dropout not supported
+#ifdef _IFI_OQDROPS
+ if2m->ifm_data.ifi_oqdrops
+#else
+ 0
+#endif
+ );
if (!py_ifc_info)
goto error;
if (PyDict_SetItemString(py_retdict, ifc_name, py_ifc_info))