aboutsummaryrefslogtreecommitdiff
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
parent6884f665bd7bc101f56ff9047afaffbc06dc99e2 (diff)
downloadbusybox-w32-ff2b6d21853ca6417a43c06f37a32201f881245d.tar.gz
busybox-w32-ff2b6d21853ca6417a43c06f37a32201f881245d.tar.bz2
busybox-w32-ff2b6d21853ca6417a43c06f37a32201f881245d.zip
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
-rw-r--r--networking/ifupdown.c16
-rw-r--r--sysklogd/logger.c3
-rw-r--r--sysklogd/logread.c28
3 files changed, 33 insertions, 14 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index c4d72524d..31911cd21 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -134,13 +134,15 @@ static char *get_var(const char *id, size_t idlen, struct interface_defn_t *ifd)
134 int i; 134 int i;
135 135
136 if (strncmpz(id, "iface", idlen) == 0) { 136 if (strncmpz(id, "iface", idlen) == 0) {
137 char *result; 137 static char *label_buf;
138 static char label_buf[20]; 138 //char *result;
139 safe_strncpy(label_buf, ifd->iface, sizeof(label_buf)); 139
140 result = strchr(label_buf, ':'); 140 free(label_buf);
141 if (result) { 141 label_buf = xstrdup(ifd->iface);
142 *result = '\0'; 142 // Remove virtual iface suffix - why?
143 } 143 // ubuntu's ifup doesn't do this
144 //result = strchrnul(label_buf, ':');
145 //*result = '\0';
144 return label_buf; 146 return label_buf;
145 } 147 }
146 if (strncmpz(id, "label", idlen) == 0) { 148 if (strncmpz(id, "label", idlen) == 0) {
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index e2d074605..60eac6ae6 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -11,7 +11,10 @@
11 11
12#if !defined CONFIG_SYSLOGD 12#if !defined CONFIG_SYSLOGD
13 13
14/* SYSLOG_NAMES defined to pull prioritynames[] and facilitynames[]
15 * from syslog.h. Grrrr - glibc puts those in _rwdata_! :( */
14#define SYSLOG_NAMES 16#define SYSLOG_NAMES
17#define SYSLOG_NAMES_CONST /* uclibc is saner :) */
15#include <sys/syslog.h> 18#include <sys/syslog.h>
16 19
17#else 20#else
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 @@
18 18
19enum { KEY_ID = 0x414e4547 }; /* "GENA" */ 19enum { KEY_ID = 0x414e4547 }; /* "GENA" */
20 20
21static struct shbuf_ds { 21struct shbuf_ds {
22 int32_t size; // size of data - 1 22 int32_t size; // size of data - 1
23 int32_t tail; // end of message list 23 int32_t tail; // end of message list
24 char data[1]; // messages 24 char data[1]; // messages
25} *shbuf; 25};
26 26
27// Semaphore operation structures 27static const struct sembuf init_sem[3] = {
28static struct sembuf SMrup[1] = {{0, -1, IPC_NOWAIT | SEM_UNDO}}; // set SMrup 28 {0, -1, IPC_NOWAIT | SEM_UNDO},
29static struct sembuf SMrdn[2] = {{1, 0}, {0, +1, SEM_UNDO}}; // set SMrdn 29 {1, 0}, {0, +1, SEM_UNDO}
30 30};
31
32struct globals {
33 struct sembuf SMrup[1]; // {0, -1, IPC_NOWAIT | SEM_UNDO},
34 struct sembuf SMrdn[2]; // {1, 0}, {0, +1, SEM_UNDO}
35 struct shbuf_ds *shbuf;
36};
37#define G (*(struct globals*)&bb_common_bufsiz1)
38#define SMrup (G.SMrup)
39#define SMrdn (G.SMrdn)
40#define shbuf (G.shbuf)
41#define INIT_G() \
42 do { \
43 memcpy(SMrup, init_sem, sizeof(init_sem)); \
44 } while (0)
31 45
32static void error_exit(const char *str) ATTRIBUTE_NORETURN; 46static void error_exit(const char *str) ATTRIBUTE_NORETURN;
33static void error_exit(const char *str) 47static void error_exit(const char *str)