Index: contrib/top/display.h =================================================================== --- contrib/top/display.h +++ contrib/top/display.h @@ -15,29 +15,29 @@ char *cpustates_tag(void); void display_header(int t); int display_init(struct statics *statics); -void i_arc(int *stats); -void i_carc(int *stats); +void i_arc(uint64_t *stats); +void i_carc(uint64_t *stats); void i_cpustates(int *states); void i_loadave(int mpid, double *avenrun); -void i_memory(int *stats); +void i_memory(uint64_t *stats); void i_message(void); void i_process(int line, char *thisline); void i_procstates(int total, int *brkdn); -void i_swap(int *stats); +void i_swap(uint64_t *stats); void i_timeofday(time_t *tod); void i_uptime(struct timeval *bt, time_t *tod); void new_message(); int readline(char *buffer, int size, int numeric); char *trim_header(char *text); -void u_arc(int *stats); -void u_carc(int *stats); +void u_arc(uint64_t *stats); +void u_carc(uint64_t *stats); void u_cpustates(int *states); void u_endscreen(int hi); void u_header(char *text); void u_loadave(int mpid, double *avenrun); -void u_memory(int *stats); +void u_memory(uint64_t *stats); void u_message(void); void u_process(int line, char *newline); void u_procstates(int total, int *brkdn); -void u_swap(int *stats); +void u_swap(uint64_t *stats); void z_cpustates(void); Index: contrib/top/display.c =================================================================== --- contrib/top/display.c +++ contrib/top/display.c @@ -623,7 +623,7 @@ void i_memory(stats) -int *stats; +uint64_t *stats; { fputs("\nMem: ", stdout); @@ -637,7 +637,7 @@ void u_memory(stats) -int *stats; +uint64_t *stats; { static char new[MAX_COLS]; @@ -658,7 +658,7 @@ void i_arc(stats) -int *stats; +uint64_t *stats; { if (arc_names == NULL) @@ -675,7 +675,7 @@ void u_arc(stats) -int *stats; +uint64_t *stats; { static char new[MAX_COLS]; @@ -700,7 +700,7 @@ void i_carc(stats) -int *stats; +uint64_t *stats; { if (carc_names == NULL) @@ -717,7 +717,7 @@ void u_carc(stats) -int *stats; +uint64_t *stats; { static char new[MAX_COLS]; @@ -742,7 +742,7 @@ void i_swap(stats) -int *stats; +uint64_t *stats; { fputs("\nSwap: ", stdout); @@ -756,7 +756,7 @@ void u_swap(stats) -int *stats; +uint64_t *stats; { static char new[MAX_COLS]; @@ -1211,12 +1211,12 @@ static void summary_format(str, numbers, names) char *str; -int *numbers; +uint64_t *numbers; register char **names; { register char *p; - register int num; + register uint64_t num; register char *thisname; register int useM = No; char rbuf[6]; @@ -1235,9 +1235,9 @@ if (thisname[0] == 'K') { /* yes: format it as a memory value */ - p = strecpy(p, format_k(num)); + p = strecpy(p, format_k2(num)); - /* skip over the K, since it was included by format_k */ + /* skip over the K, since it was included by format_k2 */ p = strecpy(p, thisname+1); } /* is this number a ratio? */ Index: contrib/top/machine.h =================================================================== --- contrib/top/machine.h +++ contrib/top/machine.h @@ -10,6 +10,7 @@ #ifndef MACHINE_H #define MACHINE_H +#include #include "top.h" /* @@ -47,10 +48,10 @@ int P_ACTIVE; /* number of procs considered "active" */ int *procstates; int *cpustates; - int *memory; - int *arc; - int *carc; - int *swap; + uint64_t *memory; + uint64_t *arc; + uint64_t *carc; + uint64_t *swap; struct timeval boottime; int ncpus; }; Index: contrib/top/top.c =================================================================== --- contrib/top/top.c +++ contrib/top/top.c @@ -124,10 +124,10 @@ void (*d_loadave)(int mpid, double *avenrun) = i_loadave; void (*d_procstates)(int total, int *brkdn) = i_procstates; void (*d_cpustates)(int *states) = i_cpustates; -void (*d_memory)(int *stats) = i_memory; -void (*d_arc)(int *stats) = i_arc; -void (*d_carc)(int *stats) = i_carc; -void (*d_swap)(int *stats) = i_swap; +void (*d_memory)(uint64_t *stats) = i_memory; +void (*d_arc)(uint64_t *stats) = i_arc; +void (*d_carc)(uint64_t *stats) = i_carc; +void (*d_swap)(uint64_t *stats) = i_swap; void (*d_message)(void) = i_message; void (*d_header)(char *text) = i_header; void (*d_process)(int line, char *thisline) = i_process; Index: usr.bin/top/machine.c =================================================================== --- usr.bin/top/machine.c +++ usr.bin/top/machine.c @@ -176,25 +176,25 @@ /* these are for detailing the memory statistics */ -int memory_stats[7]; +uint64_t memory_stats[7]; char *memorynames[] = { "K Active, ", "K Inact, ", "K Laundry, ", "K Wired, ", "K Buf, ", "K Free", NULL }; -int arc_stats[7]; +uint64_t arc_stats[7]; char *arcnames[] = { "K Total, ", "K MFU, ", "K MRU, ", "K Anon, ", "K Header, ", "K Other", NULL }; -int carc_stats[4]; +uint64_t carc_stats[4]; char *carcnames[] = { "K Compressed, ", "K Uncompressed, ", ":1 Ratio, ", NULL }; -int swap_stats[7]; +uint64_t swap_stats[7]; char *swapnames[] = { "K Total, ", "K Used, ", "K Free, ", "% Inuse, ", "K In, ", "K Out", NULL @@ -531,21 +531,24 @@ static long bufspace = 0; static uint64_t nspgsin, nspgsout; + int v_active_count, v_inactive_count, v_laundry_count; + int v_wire_count, v_free_count; + GETSYSCTL("vfs.bufspace", bufspace); - GETSYSCTL("vm.stats.vm.v_active_count", memory_stats[0]); - GETSYSCTL("vm.stats.vm.v_inactive_count", memory_stats[1]); - GETSYSCTL("vm.stats.vm.v_laundry_count", memory_stats[2]); - GETSYSCTL("vm.stats.vm.v_wire_count", memory_stats[3]); - GETSYSCTL("vm.stats.vm.v_free_count", memory_stats[5]); + GETSYSCTL("vm.stats.vm.v_active_count", v_active_count); + GETSYSCTL("vm.stats.vm.v_inactive_count", v_inactive_count); + GETSYSCTL("vm.stats.vm.v_laundry_count", v_laundry_count); + GETSYSCTL("vm.stats.vm.v_wire_count", v_wire_count); + GETSYSCTL("vm.stats.vm.v_free_count", v_free_count); GETSYSCTL("vm.stats.vm.v_swappgsin", nspgsin); GETSYSCTL("vm.stats.vm.v_swappgsout", nspgsout); /* convert memory stats to Kbytes */ - memory_stats[0] = pagetok(memory_stats[0]); - memory_stats[1] = pagetok(memory_stats[1]); - memory_stats[2] = pagetok(memory_stats[2]); - memory_stats[3] = pagetok(memory_stats[3]); + memory_stats[0] = pagetok(v_active_count); + memory_stats[1] = pagetok(v_inactive_count); + memory_stats[2] = pagetok(v_laundry_count); + memory_stats[3] = pagetok(v_wire_count); memory_stats[4] = bufspace / 1024; - memory_stats[5] = pagetok(memory_stats[5]); + memory_stats[5] = pagetok(v_free_count); memory_stats[6] = -1; /* first interval */