diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-11-01 09:16:49 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-11-01 09:16:49 +0000 |
commit | 9929fc484855149072edb217da1b801f00c0fe15 (patch) | |
tree | a97deb26bca43e394a603840039846cd9d89cae9 /procps/top.c | |
parent | 7a695ef456cfdfcd5d460681a8016ad9a1cf0833 (diff) | |
download | busybox-w32-9929fc484855149072edb217da1b801f00c0fe15.tar.gz busybox-w32-9929fc484855149072edb217da1b801f00c0fe15.tar.bz2 busybox-w32-9929fc484855149072edb217da1b801f00c0fe15.zip |
PID should be stored in pid_t, not int or long.
find_pid_by_name() was returning 0 or -1 in last array element,
but -1 was never checked. We can use just 0 intead.
git-svn-id: svn://busybox.net/trunk/busybox@16485 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'procps/top.c')
-rw-r--r-- | procps/top.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/procps/top.c b/procps/top.c index d58fdda97..3ff61dfa7 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -78,7 +78,7 @@ static int mult_lvl_cmp(void* a, void* b) { | |||
78 | the next. Mostly used for sorting. */ | 78 | the next. Mostly used for sorting. */ |
79 | struct save_hist { | 79 | struct save_hist { |
80 | int ticks; | 80 | int ticks; |
81 | int pid; | 81 | pid_t pid; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | /* | 84 | /* |
@@ -119,7 +119,8 @@ static void get_jiffy_counts(void) | |||
119 | static void do_stats(void) | 119 | static void do_stats(void) |
120 | { | 120 | { |
121 | procps_status_t *cur; | 121 | procps_status_t *cur; |
122 | int pid, total_time, i, last_i, n; | 122 | pid_t pid; |
123 | int total_time, i, last_i, n; | ||
123 | struct save_hist *new_hist; | 124 | struct save_hist *new_hist; |
124 | 125 | ||
125 | get_jiffy_counts(); | 126 | get_jiffy_counts(); |
@@ -328,9 +329,9 @@ static void display_status(int count, int scr_width) | |||
328 | else | 329 | else |
329 | sprintf(rss_str_buf, "%7ld", s->rss); | 330 | sprintf(rss_str_buf, "%7ld", s->rss); |
330 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE(pcpu = div((s->pcpu*pcpu_scale) >> pcpu_shift, 10);) | 331 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE(pcpu = div((s->pcpu*pcpu_scale) >> pcpu_shift, 10);) |
331 | col -= printf("\n%5d %-8s %s %s%6d%3u.%c" \ | 332 | col -= printf("\n%5u %-8s %s %s%6u%3u.%c" \ |
332 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE("%3u.%c") " ", | 333 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE("%3u.%c") " ", |
333 | s->pid, s->user, s->state, rss_str_buf, s->ppid, | 334 | (unsigned)s->pid, s->user, s->state, rss_str_buf, (unsigned)s->ppid, |
334 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE(pcpu.quot, '0'+pcpu.rem,) | 335 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE(pcpu.quot, '0'+pcpu.rem,) |
335 | pmem.quot, '0'+pmem.rem); | 336 | pmem.quot, '0'+pmem.rem); |
336 | if (col > 0) | 337 | if (col > 0) |