[hackers] [slstatus][PATCH] cpu_perc: Check for division by zero
Hi,
slstatus crashes (not always but often) after (suspend and) resume on
OpenBSD amd64.
The problem is in the OpenBSD section of components/cpu.c when `a` is
identical to `b` which leads to a division by zero. E.g., in one case I
had
a: CP_USER 28357, CP_NICE 0, CP_SYS 10376, CP_INTR 1681, CP_IDLE 1112152
b: CP_USER 28357, CP_NICE 0, CP_SYS 10376, CP_INTR 1681, CP_IDLE 1112152
So this patch checks this condition and returns.
Feel free to modify this patch (e.g., a variable could be introduced to
avoid the redundant sum (in the check and in the division) if you prefer
this).
Best regards,
Ingo
Received on Wed Feb 13 2019 - 22:37:08 CET
This archive was generated by hypermail 2.3.0
: Wed Feb 13 2019 - 22:48:23 CET