diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-12-19 11:32:14 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-12-19 11:32:14 +0000 |
commit | 6a660d870211e75ce64be7ce66fa433e419afc84 (patch) | |
tree | 7931e79c7b1cc3c4d8804c39da6dc6cf9fb667ab /sysklogd/syslogd.c | |
parent | 5ae5927d26427118c333f2615f79e386d89988e1 (diff) | |
download | busybox-w32-6a660d870211e75ce64be7ce66fa433e419afc84.tar.gz busybox-w32-6a660d870211e75ce64be7ce66fa433e419afc84.tar.bz2 busybox-w32-6a660d870211e75ce64be7ce66fa433e419afc84.zip |
Patch from Fillod Stephane:
You will find in the attached file "syslog.patch" a patch which adds
config options to set at compile time the size of the circular buffer,
and some documentation update.
git-svn-id: svn://busybox.net/trunk/busybox@8129 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'sysklogd/syslogd.c')
-rw-r--r-- | sysklogd/syslogd.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 622500e48..42426ed80 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -94,6 +94,12 @@ static int local_logging = FALSE; | |||
94 | 94 | ||
95 | /* circular buffer variables/structures */ | 95 | /* circular buffer variables/structures */ |
96 | #ifdef CONFIG_FEATURE_IPC_SYSLOG | 96 | #ifdef CONFIG_FEATURE_IPC_SYSLOG |
97 | |||
98 | #if CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE < 4 | ||
99 | #error Sorry, you must set the syslogd buffer size to at least 4KB. | ||
100 | #error Please check CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE | ||
101 | #endif | ||
102 | |||
97 | #include <sys/ipc.h> | 103 | #include <sys/ipc.h> |
98 | #include <sys/sem.h> | 104 | #include <sys/sem.h> |
99 | #include <sys/shm.h> | 105 | #include <sys/shm.h> |
@@ -114,7 +120,7 @@ static struct sembuf SMwdn[3] = { {0, 0}, {1, 0}, {1, +1} }; // set SMwdn | |||
114 | 120 | ||
115 | static int shmid = -1; // ipc shared memory id | 121 | static int shmid = -1; // ipc shared memory id |
116 | static int s_semid = -1; // ipc semaphore id | 122 | static int s_semid = -1; // ipc semaphore id |
117 | static int data_size = 16000; // default data size | 123 | static int shm_size = ((CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE)*1024); // default shm size |
118 | static int circular_logging = FALSE; | 124 | static int circular_logging = FALSE; |
119 | 125 | ||
120 | /* | 126 | /* |
@@ -156,7 +162,7 @@ void ipcsyslog_cleanup(void) | |||
156 | void ipcsyslog_init(void) | 162 | void ipcsyslog_init(void) |
157 | { | 163 | { |
158 | if (buf == NULL) { | 164 | if (buf == NULL) { |
159 | if ((shmid = shmget(KEY_ID, data_size, IPC_CREAT | 1023)) == -1) { | 165 | if ((shmid = shmget(KEY_ID, shm_size, IPC_CREAT | 1023)) == -1) { |
160 | bb_perror_msg_and_die("shmget"); | 166 | bb_perror_msg_and_die("shmget"); |
161 | } | 167 | } |
162 | 168 | ||
@@ -164,7 +170,7 @@ void ipcsyslog_init(void) | |||
164 | bb_perror_msg_and_die("shmat"); | 170 | bb_perror_msg_and_die("shmat"); |
165 | } | 171 | } |
166 | 172 | ||
167 | buf->size = data_size - sizeof(*buf); | 173 | buf->size = shm_size - sizeof(*buf); |
168 | buf->head = buf->tail = 0; | 174 | buf->head = buf->tail = 0; |
169 | 175 | ||
170 | // we'll trust the OS to set initial semval to 0 (let's hope) | 176 | // we'll trust the OS to set initial semval to 0 (let's hope) |
@@ -654,7 +660,7 @@ extern int syslogd_main(int argc, char **argv) | |||
654 | if (optarg) { | 660 | if (optarg) { |
655 | int buf_size = atoi(optarg); | 661 | int buf_size = atoi(optarg); |
656 | if (buf_size >= 4) { | 662 | if (buf_size >= 4) { |
657 | data_size = buf_size; | 663 | shm_size = buf_size; |
658 | } | 664 | } |
659 | } | 665 | } |
660 | circular_logging = TRUE; | 666 | circular_logging = TRUE; |