aboutsummaryrefslogtreecommitdiff
path: root/sysklogd/logread.c
diff options
context:
space:
mode:
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 @@
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)