aboutsummaryrefslogtreecommitdiff
path: root/runit
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-09-28 10:29:17 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-09-28 10:29:17 +0000
commitb9256054419582dc35917b1cb39c7e09f489dfad (patch)
tree2ce3a816b788b3af5fa54109b765ee22d5550c5e /runit
parentc3122bca53255799f052fcc0e911b68237faa12d (diff)
downloadbusybox-w32-b9256054419582dc35917b1cb39c7e09f489dfad.tar.gz
busybox-w32-b9256054419582dc35917b1cb39c7e09f489dfad.tar.bz2
busybox-w32-b9256054419582dc35917b1cb39c7e09f489dfad.zip
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')
-rw-r--r--runit/runsv.c31
-rw-r--r--runit/sv.c22
2 files changed, 40 insertions, 13 deletions
diff --git a/runit/runsv.c b/runit/runsv.c
index b35c26630..1ee3dda01 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -61,8 +61,6 @@ static void gettimeofday_ns(struct timespec *ts)
61/* Compare possibly overflowing unsigned counters */ 61/* Compare possibly overflowing unsigned counters */
62#define LESS(a,b) ((int)((unsigned)(b) - (unsigned)(a)) > 0) 62#define LESS(a,b) ((int)((unsigned)(b) - (unsigned)(a)) > 0)
63 63
64static int selfpipe[2];
65
66/* state */ 64/* state */
67#define S_DOWN 0 65#define S_DOWN 0
68#define S_RUN 1 66#define S_RUN 1
@@ -88,12 +86,27 @@ struct svdir {
88 int fdcontrolwrite; 86 int fdcontrolwrite;
89}; 87};
90 88
91static struct svdir svd[2]; 89struct globals {
92static smallint sigterm; 90 smallint haslog;
93static smallint haslog; 91 smallint sigterm;
94static smallint pidchanged = 1; 92 smallint pidchanged;
95static int logpipe[2]; 93 int selfpipe[2];
96static char *dir; 94 int logpipe[2];
95 char *dir;
96 struct svdir svd[2];
97};
98#define G (*(struct globals*)&bb_common_bufsiz1)
99#define haslog (G.haslog )
100#define sigterm (G.sigterm )
101#define pidchanged (G.pidchanged )
102#define selfpipe (G.selfpipe )
103#define logpipe (G.logpipe )
104#define dir (G.dir )
105#define svd (G.svd )
106#define INIT_G() \
107 do { \
108 pidchanged = 1; \
109 } while (0)
97 110
98static void fatal2_cannot(const char *m1, const char *m2) 111static void fatal2_cannot(const char *m1, const char *m2)
99{ 112{
@@ -434,6 +447,8 @@ int runsv_main(int argc, char **argv)
434 int r; 447 int r;
435 char buf[256]; 448 char buf[256];
436 449
450 INIT_G();
451
437 if (!argv[1] || argv[2]) 452 if (!argv[1] || argv[2])
438 bb_show_usage(); 453 bb_show_usage();
439 dir = argv[1]; 454 dir = argv[1];
diff --git a/runit/sv.c b/runit/sv.c
index 7283bbf7d..757391a54 100644
--- a/runit/sv.c
+++ b/runit/sv.c
@@ -158,12 +158,22 @@ Exit Codes
158#include "libbb.h" 158#include "libbb.h"
159#include "runit_lib.h" 159#include "runit_lib.h"
160 160
161static const char *acts; 161struct globals {
162static char **service; 162 const char *acts;
163static unsigned rc; 163 char **service;
164 unsigned rc;
164/* "Bernstein" time format: unix + 0x400000000000000aULL */ 165/* "Bernstein" time format: unix + 0x400000000000000aULL */
165static uint64_t tstart, tnow; 166 uint64_t tstart, tnow;
166static svstatus_t svstatus; 167 svstatus_t svstatus;
168};
169#define G (*(struct globals*)&bb_common_bufsiz1)
170#define acts (G.acts )
171#define service (G.service )
172#define rc (G.rc )
173#define tstart (G.tstart )
174#define tnow (G.tnow )
175#define svstatus (G.svstatus )
176#define INIT_G() do { } while (0)
167 177
168 178
169static void fatal_cannot(const char *m1) ATTRIBUTE_NORETURN; 179static void fatal_cannot(const char *m1) ATTRIBUTE_NORETURN;
@@ -418,6 +428,8 @@ int sv_main(int argc, char **argv)
418 int (*cbk)(const char*); 428 int (*cbk)(const char*);
419 int curdir; 429 int curdir;
420 430
431 INIT_G();
432
421 xfunc_error_retval = 100; 433 xfunc_error_retval = 100;
422 434
423 x = getenv("SVDIR"); 435 x = getenv("SVDIR");