summaryrefslogtreecommitdiff
path: root/sysklogd/syslogd.c
diff options
context:
space:
mode:
authorEric Andersen2003-12-19 11:32:14 +0000
committerEric Andersen2003-12-19 11:32:14 +0000
commitd4a5e255c479647d172c9d7d7f61049277b7c0b9 (patch)
tree7931e79c7b1cc3c4d8804c39da6dc6cf9fb667ab /sysklogd/syslogd.c
parent3752d337b3b8e704f1fe27451d481eae85d64f48 (diff)
downloadbusybox-d4a5e255c479647d172c9d7d7f61049277b7c0b9.zip
busybox-d4a5e255c479647d172c9d7d7f61049277b7c0b9.tar.gz
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.
Diffstat (limited to 'sysklogd/syslogd.c')
-rw-r--r--sysklogd/syslogd.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 622500e..42426ed 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -94,6 +94,12 @@ static int local_logging = FALSE;
/* circular buffer variables/structures */
#ifdef CONFIG_FEATURE_IPC_SYSLOG
+
+#if CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE < 4
+#error Sorry, you must set the syslogd buffer size to at least 4KB.
+#error Please check CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE
+#endif
+
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
@@ -114,7 +120,7 @@ static struct sembuf SMwdn[3] = { {0, 0}, {1, 0}, {1, +1} }; // set SMwdn
static int shmid = -1; // ipc shared memory id
static int s_semid = -1; // ipc semaphore id
-static int data_size = 16000; // default data size
+static int shm_size = ((CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE)*1024); // default shm size
static int circular_logging = FALSE;
/*
@@ -156,7 +162,7 @@ void ipcsyslog_cleanup(void)
void ipcsyslog_init(void)
{
if (buf == NULL) {
- if ((shmid = shmget(KEY_ID, data_size, IPC_CREAT | 1023)) == -1) {
+ if ((shmid = shmget(KEY_ID, shm_size, IPC_CREAT | 1023)) == -1) {
bb_perror_msg_and_die("shmget");
}
@@ -164,7 +170,7 @@ void ipcsyslog_init(void)
bb_perror_msg_and_die("shmat");
}
- buf->size = data_size - sizeof(*buf);
+ buf->size = shm_size - sizeof(*buf);
buf->head = buf->tail = 0;
// 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)
if (optarg) {
int buf_size = atoi(optarg);
if (buf_size >= 4) {
- data_size = buf_size;
+ shm_size = buf_size;
}
}
circular_logging = TRUE;