luci-base: tweak busybox top regex to accept 'm' in large VSZ
authorHannu Nyman <hannu.nyman@iki.fi>
Sat, 19 Sep 2020 05:46:16 +0000 (08:46 +0300)
committerHannu Nyman <hannu.nyman@iki.fi>
Sat, 19 Sep 2020 05:58:05 +0000 (08:58 +0300)
Tweak the lua regex string for process list, so that processes
with extremely large memory sizes (over 100 MB) are matched.
For those large processes busybox top shows a MB value like '234m'
instead of a normal kB value like 234000.

Fixes #4425

Reference to https://github.com/openwrt/luci/issues/4425#issuecomment-694073479

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
(cherry picked from commit 4f2ecd88fd02c1279041f45ccd758184b153c875)

modules/luci-base/luasrc/sys.lua

index 60762ace88d8f09ff05c599c8b6ae3cb95eb5d36..06f70973cceee9ab57c30257cc31ea50638e4f14 100644 (file)
@@ -387,7 +387,7 @@ function process.list()
 
        for line in ps do
                local pid, ppid, user, stat, vsz, mem, cpu, cmd = line:match(
-                       "^ *(%d+) +(%d+) +(%S.-%S) +([RSDZTW][<NW ][<N ]) +(%d+) +(%d+%%) +(%d+%%) +(.+)"
+                       "^ *(%d+) +(%d+) +(%S.-%S) +([RSDZTW][<NW ][<N ]) +(%d+m?) +(%d+%%) +(%d+%%) +(.+)"
                )
 
                local idx = tonumber(pid)