summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
Diffstat (limited to 'procps')
-rw-r--r--procps/free.c3
-rw-r--r--procps/fuser.c3
-rw-r--r--procps/nmeter.c9
-rw-r--r--procps/ps.c3
-rw-r--r--procps/top.c3
5 files changed, 13 insertions, 8 deletions
diff --git a/procps/free.c b/procps/free.c
index 0d023f7..9fde64b 100644
--- a/procps/free.c
+++ b/procps/free.c
@@ -22,6 +22,7 @@
//usage: "Total: 386144 257128 129016\n"
#include "libbb.h"
+#include "common_bufsiz.h"
#ifdef __linux__
# include <sys/sysinfo.h>
#endif
@@ -35,7 +36,7 @@ struct globals {
# define G_unit_steps 10
#endif
} FIX_ALIASING;
-#define G (*(struct globals*)&bb_common_bufsiz1)
+#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { } while (0)
diff --git a/procps/fuser.c b/procps/fuser.c
index 05b52ab..2cda0f9 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -18,6 +18,7 @@
//usage: "\n -SIGNAL Signal to send (default: KILL)"
#include "libbb.h"
+#include "common_bufsiz.h"
#define MAX_LINE 255
@@ -43,7 +44,7 @@ struct globals {
smallint kill_failed;
int killsig;
} FIX_ALIASING;
-#define G (*(struct globals*)&bb_common_bufsiz1)
+#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
G.mypid = getpid(); \
G.killsig = SIGKILL; \
diff --git a/procps/nmeter.c b/procps/nmeter.c
index 33de379..efa3d55 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -53,6 +53,7 @@
// totalswap=134209536, freeswap=134209536, procs=157})
#include "libbb.h"
+#include "common_bufsiz.h"
typedef unsigned long long ullong;
@@ -115,8 +116,8 @@ struct globals {
G.deltanz = G.delta = 1000000; \
} while (0)
-// We depend on this being a char[], not char* - we take sizeof() of it
-#define outbuf bb_common_bufsiz1
+#define outbuf bb_common_bufsiz1
+#define sizeof_outbuf COMMON_BUFSIZE
static inline void reset_outbuf(void)
{
@@ -140,7 +141,7 @@ static void print_outbuf(void)
static void put(const char *s)
{
char *p = cur_outbuf;
- int sz = outbuf + sizeof(outbuf) - p;
+ int sz = outbuf + sizeof_outbuf - p;
while (*s && --sz >= 0)
*p++ = *s++;
cur_outbuf = p;
@@ -148,7 +149,7 @@ static void put(const char *s)
static void put_c(char c)
{
- if (cur_outbuf < outbuf + sizeof(outbuf))
+ if (cur_outbuf < outbuf + sizeof_outbuf)
*cur_outbuf++ = c;
}
diff --git a/procps/ps.c b/procps/ps.c
index fbafa68..65d62e2 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -62,6 +62,7 @@
//usage: " 2990 andersen andersen R ps\n"
#include "libbb.h"
+#include "common_bufsiz.h"
#ifdef __linux__
# include <sys/sysinfo.h>
#endif
@@ -144,7 +145,7 @@ struct globals {
unsigned long seconds_since_boot;
#endif
} FIX_ALIASING;
-#define G (*(struct globals*)&bb_common_bufsiz1)
+#define G (*(struct globals*)bb_common_bufsiz1)
#define out (G.out )
#define out_cnt (G.out_cnt )
#define print_header (G.print_header )
diff --git a/procps/top.c b/procps/top.c
index ddf794d..1c42b24 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -105,6 +105,7 @@
//config: Enable 's' in top (gives lots of memory info).
#include "libbb.h"
+#include "common_bufsiz.h"
typedef struct top_status_t {
@@ -183,7 +184,7 @@ struct globals {
char line_buf[80];
}; //FIX_ALIASING; - large code growth
enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) };
-#define G (*(struct globals*)&bb_common_bufsiz1)
+#define G (*(struct globals*)bb_common_bufsiz1)
#define top (G.top )
#define ntop (G.ntop )
#define sort_field (G.sort_field )