[pve-devel] [PATCH pve-common 1/4] read_proc_stat : initialize newer fields to 0

Alexandre Derumier aderumier at odiso.com
Mon Jan 10 05:52:57 CET 2022


new fields has been added recently, but values are not initialized
https://git.proxmox.com/?p=pve-common.git;a=commit;h=5a82eb712e4c879a271686f07c589fadc0b09185

as total of all fields is compute later, this can give undef values
---
 src/PVE/ProcFSTools.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
index a75274a..c816131 100644
--- a/src/PVE/ProcFSTools.pm
+++ b/src/PVE/ProcFSTools.pm
@@ -162,7 +162,7 @@ sub read_pressure {
 my $last_proc_stat;
 
 sub read_proc_stat {
-    my $res = { user => 0, nice => 0, system => 0, idle => 0 , sum => 0};
+    my $res = { user => 0, nice => 0, system => 0, idle => 0 , iowait => 0, irq => 0, softirq => 0, steal => 0, guest => 0, guest_nice => 0, sum => 0};
 
     my $cpucount = 0;
 
-- 
2.30.2




More information about the pve-devel mailing list