aboutsummaryrefslogtreecommitdiff
path: root/procps/top.c
diff options
context:
space:
mode:
Diffstat (limited to 'procps/top.c')
-rw-r--r--procps/top.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/procps/top.c b/procps/top.c
index ddf794d7d..73cd285f0 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -105,6 +105,7 @@
105//config: Enable 's' in top (gives lots of memory info). 105//config: Enable 's' in top (gives lots of memory info).
106 106
107#include "libbb.h" 107#include "libbb.h"
108#include "common_bufsiz.h"
108 109
109 110
110typedef struct top_status_t { 111typedef struct top_status_t {
@@ -183,7 +184,7 @@ struct globals {
183 char line_buf[80]; 184 char line_buf[80];
184}; //FIX_ALIASING; - large code growth 185}; //FIX_ALIASING; - large code growth
185enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) }; 186enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) };
186#define G (*(struct globals*)&bb_common_bufsiz1) 187#define G (*(struct globals*)bb_common_bufsiz1)
187#define top (G.top ) 188#define top (G.top )
188#define ntop (G.ntop ) 189#define ntop (G.ntop )
189#define sort_field (G.sort_field ) 190#define sort_field (G.sort_field )
@@ -201,6 +202,7 @@ enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) };
201#define total_pcpu (G.total_pcpu ) 202#define total_pcpu (G.total_pcpu )
202#define line_buf (G.line_buf ) 203#define line_buf (G.line_buf )
203#define INIT_G() do { \ 204#define INIT_G() do { \
205 setup_common_bufsiz(); \
204 BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ 206 BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
205 BUILD_BUG_ON(LINE_BUF_SIZE <= 80); \ 207 BUILD_BUG_ON(LINE_BUF_SIZE <= 80); \
206} while (0) 208} while (0)
@@ -263,9 +265,9 @@ static int mult_lvl_cmp(void* a, void* b)
263static NOINLINE int read_cpu_jiffy(FILE *fp, jiffy_counts_t *p_jif) 265static NOINLINE int read_cpu_jiffy(FILE *fp, jiffy_counts_t *p_jif)
264{ 266{
265#if !ENABLE_FEATURE_TOP_SMP_CPU 267#if !ENABLE_FEATURE_TOP_SMP_CPU
266 static const char fmt[] = "cpu %llu %llu %llu %llu %llu %llu %llu %llu"; 268 static const char fmt[] ALIGN1 = "cpu %llu %llu %llu %llu %llu %llu %llu %llu";
267#else 269#else
268 static const char fmt[] = "cp%*s %llu %llu %llu %llu %llu %llu %llu %llu"; 270 static const char fmt[] ALIGN1 = "cp%*s %llu %llu %llu %llu %llu %llu %llu %llu";
269#endif 271#endif
270 int ret; 272 int ret;
271 273
@@ -517,7 +519,7 @@ enum {
517 519
518static void parse_meminfo(unsigned long meminfo[MI_MAX]) 520static void parse_meminfo(unsigned long meminfo[MI_MAX])
519{ 521{
520 static const char fields[] = 522 static const char fields[] ALIGN1 =
521 "MemTotal\0" 523 "MemTotal\0"
522 "MemFree\0" 524 "MemFree\0"
523 "MemShared\0" 525 "MemShared\0"