aboutsummaryrefslogtreecommitdiff
path: root/sysklogd
diff options
context:
space:
mode:
Diffstat (limited to 'sysklogd')
-rw-r--r--sysklogd/logger.c3
-rw-r--r--sysklogd/logread.c28
2 files changed, 24 insertions, 7 deletions
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)