diff options
author | netblue30 <netblue30@protonmail.com> | 2022-06-02 17:03:36 -0400 |
---|---|---|
committer | netblue30 <netblue30@protonmail.com> | 2022-06-02 17:03:36 -0400 |
commit | 741aaa4f59f3604f6c139fedcf06c0a2f910a60c (patch) | |
tree | a899d718e3ef65b7553eadc858eeb5b1a482fe97 /src/lib/pid.c | |
parent | speed up firemon (diff) | |
download | firejail-741aaa4f59f3604f6c139fedcf06c0a2f910a60c.tar.gz firejail-741aaa4f59f3604f6c139fedcf06c0a2f910a60c.tar.zst firejail-741aaa4f59f3604f6c139fedcf06c0a2f910a60c.zip |
firemon rework
Diffstat (limited to 'src/lib/pid.c')
-rw-r--r-- | src/lib/pid.c | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/lib/pid.c b/src/lib/pid.c index 2cc72bce0..8b2a9b0f5 100644 --- a/src/lib/pid.c +++ b/src/lib/pid.c | |||
@@ -273,34 +273,6 @@ void pid_print_list(unsigned index, int nowrap) { | |||
273 | print_elem(index, nowrap); | 273 | print_elem(index, nowrap); |
274 | } | 274 | } |
275 | 275 | ||
276 | // recursivity!!! | ||
277 | void pid_store_cpu(unsigned index, unsigned parent, unsigned *utime, unsigned *stime) { | ||
278 | if (pids[index].level == 1) { | ||
279 | *utime = 0; | ||
280 | *stime = 0; | ||
281 | } | ||
282 | |||
283 | // Remove unused parameter warning | ||
284 | (void)parent; | ||
285 | |||
286 | unsigned utmp = 0; | ||
287 | unsigned stmp = 0; | ||
288 | pid_get_cpu_time(index, &utmp, &stmp); | ||
289 | *utime += utmp; | ||
290 | *stime += stmp; | ||
291 | |||
292 | unsigned i; | ||
293 | for (i = index + 1; i < (unsigned)max_pids; i++) { | ||
294 | if (pids[i].parent == (pid_t)index) | ||
295 | pid_store_cpu(i, index, utime, stime); | ||
296 | } | ||
297 | |||
298 | if (pids[index].level == 1) { | ||
299 | pids[index].utime = *utime; | ||
300 | pids[index].stime = *stime; | ||
301 | } | ||
302 | } | ||
303 | |||
304 | // mon_pid: pid of sandbox to be monitored, 0 if all sandboxes are included | 276 | // mon_pid: pid of sandbox to be monitored, 0 if all sandboxes are included |
305 | void pid_read(pid_t mon_pid) { | 277 | void pid_read(pid_t mon_pid) { |
306 | unsigned old_max_pids = max_pids; | 278 | unsigned old_max_pids = max_pids; |