aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-09-26 00:49:05 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-09-26 00:49:05 +0000
commita79220db6e71b7fa509ffa88a02ff1ea785bf811 (patch)
tree511e145ada5a79efd3c891dabcbb4b09dce651ce
parent6b0658f5c09812367c0391e32d745ea2f04af8e4 (diff)
downloadbusybox-w32-a79220db6e71b7fa509ffa88a02ff1ea785bf811.tar.gz
busybox-w32-a79220db6e71b7fa509ffa88a02ff1ea785bf811.tar.bz2
busybox-w32-a79220db6e71b7fa509ffa88a02ff1ea785bf811.zip
add size parameter to syslogd -C
Patch by Padraig, resubmitted by Fillod Stephane
-rw-r--r--sysklogd/syslogd.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index a7712d445..3ba239882 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -106,8 +106,7 @@ static struct sembuf SMwdn[3] = { {0, 0}, {1, 0}, {1, +1} }; // set SMwdn
106 106
107static int shmid = -1; // ipc shared memory id 107static int shmid = -1; // ipc shared memory id
108static int s_semid = -1; // ipc semaphore id 108static int s_semid = -1; // ipc semaphore id
109int data_size = 16000; // data size 109static int data_size = 16000; // default data size
110int shm_size = 16000 + sizeof(*buf); // our buffer size
111static int circular_logging = FALSE; 110static int circular_logging = FALSE;
112 111
113/* 112/*
@@ -149,7 +148,7 @@ void ipcsyslog_cleanup(void)
149void ipcsyslog_init(void) 148void ipcsyslog_init(void)
150{ 149{
151 if (buf == NULL) { 150 if (buf == NULL) {
152 if ((shmid = shmget(KEY_ID, shm_size, IPC_CREAT | 1023)) == -1) { 151 if ((shmid = shmget(KEY_ID, data_size, IPC_CREAT | 1023)) == -1) {
153 bb_perror_msg_and_die("shmget"); 152 bb_perror_msg_and_die("shmget");
154 } 153 }
155 154
@@ -157,7 +156,7 @@ void ipcsyslog_init(void)
157 bb_perror_msg_and_die("shmat"); 156 bb_perror_msg_and_die("shmat");
158 } 157 }
159 158
160 buf->size = data_size; 159 buf->size = data_size - sizeof(*buf);
161 buf->head = buf->tail = 0; 160 buf->head = buf->tail = 0;
162 161
163 // we'll trust the OS to set initial semval to 0 (let's hope) 162 // we'll trust the OS to set initial semval to 0 (let's hope)
@@ -579,7 +578,7 @@ extern int syslogd_main(int argc, char **argv)
579 char *p; 578 char *p;
580 579
581 /* do normal option parsing */ 580 /* do normal option parsing */
582 while ((opt = getopt(argc, argv, "m:nO:R:LC")) > 0) { 581 while ((opt = getopt(argc, argv, "m:nO:R:LC::")) > 0) {
583 switch (opt) { 582 switch (opt) {
584 case 'm': 583 case 'm':
585 MarkInterval = atoi(optarg) * 60; 584 MarkInterval = atoi(optarg) * 60;
@@ -605,6 +604,12 @@ extern int syslogd_main(int argc, char **argv)
605#endif 604#endif
606#ifdef CONFIG_FEATURE_IPC_SYSLOG 605#ifdef CONFIG_FEATURE_IPC_SYSLOG
607 case 'C': 606 case 'C':
607 if (optarg) {
608 int buf_size = atoi(optarg);
609 if (buf_size >= 4) {
610 data_size = buf_size;
611 }
612 }
608 circular_logging = TRUE; 613 circular_logging = TRUE;
609 break; 614 break;
610#endif 615#endif