summaryrefslogtreecommitdiff
path: root/runit/runsv.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-09-28 10:29:17 +0000
committerDenis Vlasenko2007-09-28 10:29:17 +0000
commitb9256054419582dc35917b1cb39c7e09f489dfad (patch)
tree2ce3a816b788b3af5fa54109b765ee22d5550c5e /runit/runsv.c
parentc3122bca53255799f052fcc0e911b68237faa12d (diff)
downloadbusybox-b9256054419582dc35917b1cb39c7e09f489dfad.zip
busybox-b9256054419582dc35917b1cb39c7e09f489dfad.tar.gz
assorted static vars removal
function old new delta tcpudpsvd_main 1829 1839 +10 update_status 567 569 +2 sigterm 1 - -1 ......... dhcprelay_signal_handler 8 - -8 nfs_strerror 60 49 -11 singlemount 4579 4564 -15 static.p 16 - -16 svstatus 20 - -20 dhcprelay_xid_list 32 - -32 runsv_main 1785 1746 -39 static.buf 74 28 -46 svd 56 - -56 dhcprelay_main 1141 1080 -61 ------------------------------------------------------------------------------ (add/remove: 0/20 grow/shrink: 2/10 up/down: 12/-386) Total: -374 bytes
Diffstat (limited to 'runit/runsv.c')
-rw-r--r--runit/runsv.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/runit/runsv.c b/runit/runsv.c
index b35c266..1ee3dda 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -61,8 +61,6 @@ static void gettimeofday_ns(struct timespec *ts)
/* Compare possibly overflowing unsigned counters */
#define LESS(a,b) ((int)((unsigned)(b) - (unsigned)(a)) > 0)
-static int selfpipe[2];
-
/* state */
#define S_DOWN 0
#define S_RUN 1
@@ -88,12 +86,27 @@ struct svdir {
int fdcontrolwrite;
};
-static struct svdir svd[2];
-static smallint sigterm;
-static smallint haslog;
-static smallint pidchanged = 1;
-static int logpipe[2];
-static char *dir;
+struct globals {
+ smallint haslog;
+ smallint sigterm;
+ smallint pidchanged;
+ int selfpipe[2];
+ int logpipe[2];
+ char *dir;
+ struct svdir svd[2];
+};
+#define G (*(struct globals*)&bb_common_bufsiz1)
+#define haslog (G.haslog )
+#define sigterm (G.sigterm )
+#define pidchanged (G.pidchanged )
+#define selfpipe (G.selfpipe )
+#define logpipe (G.logpipe )
+#define dir (G.dir )
+#define svd (G.svd )
+#define INIT_G() \
+ do { \
+ pidchanged = 1; \
+ } while (0)
static void fatal2_cannot(const char *m1, const char *m2)
{
@@ -434,6 +447,8 @@ int runsv_main(int argc, char **argv)
int r;
char buf[256];
+ INIT_G();
+
if (!argv[1] || argv[2])
bb_show_usage();
dir = argv[1];