summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-03-29 21:20:53 +0000
committerMiles Bader <miles@gnu.org>1995-03-29 21:20:53 +0000
commit5b3603495a3b4f6721f66a3115391412e750847c (patch)
treedc37ef43d870d8aad01bc9c7ffbeec25608a5a0c
parent2f91e71b83a8e7e4100374ad717c531c491d73ea (diff)
Don't get barf on processes with zero threads.
-rw-r--r--libps/procstat.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libps/procstat.c b/libps/procstat.c
index 4cb77473..7b5c2fd5 100644
--- a/libps/procstat.c
+++ b/libps/procstat.c
@@ -186,10 +186,12 @@ proc_stat_set_flags(proc_stat_t ps, int flags)
tbi->system_time.microseconds += bi->system_time.microseconds;
}
- tsi->base_priority /= pi->nthreads;
- tsi->cur_priority /= pi->nthreads;
-
- tbi->sleep_time /= pi->nthreads;
+ if (pi->nthreads > 0)
+ {
+ tsi->base_priority /= pi->nthreads;
+ tsi->cur_priority /= pi->nthreads;
+ tbi->sleep_time /= pi->nthreads;
+ }
tbi->user_time.seconds += tbi->user_time.microseconds / 1000000;
tbi->user_time.microseconds %= 1000000;