examine this more later -- it mattered

This commit is contained in:
albert 2002-10-13 20:32:09 +00:00
parent 6bc460988b
commit 2bd046593c
2 changed files with 6 additions and 4 deletions

View File

@ -1306,6 +1306,7 @@ static void show_meminfo(void)
* (as of pre-2.4 era) can report idle time going backwards, perhaps due * (as of pre-2.4 era) can report idle time going backwards, perhaps due
* to non-atomic reads and updates. There is no locking for these values. * to non-atomic reads and updates. There is no locking for these values.
*/ */
#if 0
#ifndef NAN #ifndef NAN
#define NAN (-0.0) #define NAN (-0.0)
#endif #endif
@ -1342,6 +1343,7 @@ static void four_cpu_numbers(double *uret, double *nret, double *sret, double *i
old_i=new_i; old_i=new_i;
} }
#undef JT #undef JT
#endif
/***********************************************************************/ /***********************************************************************/
@ -1356,7 +1358,7 @@ static void do_stats(proc_t** p, float elapsed_time, int pass)
proc_t *this; proc_t *this;
int arrindex, total_time, cpumap, i, n = 0; int arrindex, total_time, cpumap, i, n = 0;
int sleeping = 0, stopped = 0, zombie = 0, running = 0; int sleeping = 0, stopped = 0, zombie = 0, running = 0;
double system_ticks, user_ticks, nice_ticks, idle_ticks; double system_ticks, user_ticks, nice_ticks, idle_ticks, junk;
static int prev_count = 0; static int prev_count = 0;
int systime, usrtime; int systime, usrtime;
@ -1443,7 +1445,7 @@ static void do_stats(proc_t** p, float elapsed_time, int pass)
n, sleeping, running, zombie, stopped); n, sleeping, running, zombie, stopped);
PUTP(top_clrtoeol); PUTP(top_clrtoeol);
putchar('\n'); putchar('\n');
four_cpu_numbers(&user_ticks,&nice_ticks,&system_ticks,&idle_ticks); five_cpu_numbers(&user_ticks,&nice_ticks,&system_ticks,&idle_ticks,&junk);
printf("CPU states:" printf("CPU states:"
" %# 5.1f%% user, %# 5.1f%% system," " %# 5.1f%% user, %# 5.1f%% system,"
" %# 5.1f%% nice, %# 5.1f%% idle", " %# 5.1f%% nice, %# 5.1f%% idle",
@ -1772,7 +1774,7 @@ static proc_t** readproctab2(int flags, proc_t** tab, ...) {
/* share some process time, since we skipped opendir("/proc") */ /* share some process time, since we skipped opendir("/proc") */
usleep (50*1000); usleep (50*1000);
} }
else if (Do(TTY) || Do(STAT)) else if (Do(TTY) /*|| Do(STAT) */)
PT = openproc(flags, va_arg(ap, void*)); /* assume ptr sizes same */ PT = openproc(flags, va_arg(ap, void*)); /* assume ptr sizes same */
else else
PT = openproc(flags); PT = openproc(flags);

View File

@ -234,7 +234,7 @@ static char** file2strvec(const char* directory, const char* what) {
/* read whole file into a memory buffer, allocating as we go */ /* read whole file into a memory buffer, allocating as we go */
while ((n = read(fd, buf, sizeof buf - 1)) > 0) { while ((n = read(fd, buf, sizeof buf - 1)) > 0) {
if (n < sizeof buf - 1) if (n < (int)(sizeof buf - 1))
end_of_file = 1; end_of_file = 1;
if (n == 0 && rbuf == 0) if (n == 0 && rbuf == 0)
return NULL; /* process died between our open and read */ return NULL; /* process died between our open and read */