summaryrefslogtreecommitdiffhomepage
path: root/sysklogd/logread.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-11-23 03:39:45 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-11-23 03:39:45 +0000
commitff2b6d21853ca6417a43c06f37a32201f881245d (patch)
treee29af66c29c2a7cfeb7f7f4ca7c904704def2a5e /sysklogd/logread.c
parent6884f665bd7bc101f56ff9047afaffbc06dc99e2 (diff)
logread: eliminate usage of data/bss
ifup: don't remove virtual iface prefixes (eth0:0) function old new delta shbuf 4 - -4 SMrup 6 - -6 SMrdn 12 - -12 static.label_buf 20 4 -16 get_var 158 140 -18 ------------------------------------------------------------------------------ (add/remove: 0/3 grow/shrink: 0/2 up/down: 0/-56) Total: -56 bytes text data bss dec hex filename 783501 962 9260 793723 c1c7b busybox_old 783483 942 9244 793669 c1c45 busybox_unstripped
Diffstat (limited to 'sysklogd/logread.c')
-rw-r--r--sysklogd/logread.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index 6567df374..51fb7a0ba 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -18,16 +18,30 @@
enum { KEY_ID = 0x414e4547 }; /* "GENA" */
-static struct shbuf_ds {
+struct shbuf_ds {
int32_t size; // size of data - 1
int32_t tail; // end of message list
char data[1]; // messages
-} *shbuf;
-
-// Semaphore operation structures
-static struct sembuf SMrup[1] = {{0, -1, IPC_NOWAIT | SEM_UNDO}}; // set SMrup
-static struct sembuf SMrdn[2] = {{1, 0}, {0, +1, SEM_UNDO}}; // set SMrdn
-
+};
+
+static const struct sembuf init_sem[3] = {
+ {0, -1, IPC_NOWAIT | SEM_UNDO},
+ {1, 0}, {0, +1, SEM_UNDO}
+};
+
+struct globals {
+ struct sembuf SMrup[1]; // {0, -1, IPC_NOWAIT | SEM_UNDO},
+ struct sembuf SMrdn[2]; // {1, 0}, {0, +1, SEM_UNDO}
+ struct shbuf_ds *shbuf;
+};
+#define G (*(struct globals*)&bb_common_bufsiz1)
+#define SMrup (G.SMrup)
+#define SMrdn (G.SMrdn)
+#define shbuf (G.shbuf)
+#define INIT_G() \
+ do { \
+ memcpy(SMrup, init_sem, sizeof(init_sem)); \
+ } while (0)
static void error_exit(const char *str) ATTRIBUTE_NORETURN;
static void error_exit(const char *str)