14
0
forked from pool/python-psutil
Files
python-psutil/mem-used-bsc1181475.patch
Markéta Machová d5fad8f15a - Update to 7.1.2
* 2657_: stop publishing prebuilt Linux and Windows wheels for 32-bit Python.
    32-bit CPython is still supported, but psutil must now be built from source.
  * 2565_: produce wheels for free-thread cPython 3.13 and 3.14 (patch by
    Lysandros Nikolaou)
  * 2650_, [macOS]: `Process.cmdline()`_ and `Process.environ()`_ may incorrectly
    raise `NoSuchProcess`_ instead of `ZombieProcess`_.
  * 2658_, [macOS]: double ``free()`` in `Process.environ()`_ when it fails
    internally. This posed a risk of segfault.
  * 2662_, [macOS]: massive C code cleanup to guard against possible segfaults
    which were (not so) sporadically spotted on CI.
  * 2657_: stop publishing prebuilt Linux and Windows wheels for 32-bit Python.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=186
2025-11-03 12:25:33 +00:00

35 lines
1.2 KiB
Diff

---
psutil/_pslinux.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Index: psutil-5.9.5/psutil/_pslinux.py
===================================================================
--- psutil-5.9.5.orig/psutil/_pslinux.py
+++ psutil-5.9.5/psutil/_pslinux.py
@@ -474,12 +474,6 @@ def virtual_memory():
except KeyError:
slab = 0
- used = total - free - cached - buffers
- if used < 0:
- # May be symptomatic of running within a LCX container where such
- # values will be dramatically distorted over those of the host.
- used = total - free
-
# - starting from 4.4.0 we match free's "available" column.
# Before 4.4.0 we calculated it as (free + buffers + cached)
# which matched htop.
@@ -510,6 +504,12 @@ def virtual_memory():
# 24fd2605c51fccc375ab0287cec33aa767f06718/proc/sysinfo.c#L764
avail = free
+ used = total - avail
+ if used < 0:
+ # May be symptomatic of running within a LCX container where such
+ # values will be dramatically distorted over those of the host.
+ used = total - free
+
percent = usage_percent((total - avail), total, round_=1)
# Warn about missing metrics which are set to 0.