[BusyBox-cvs] busybox/sysklogd Config.in, 1.5, 1.6 logread.c, 1.13, 1.14 syslogd.c, 1.105, 1.106
Erik Andersen
andersen at busybox.net
Fri Dec 19 11:32:16 UTC 2003
Update of /var/cvs/busybox/sysklogd
In directory nail:/tmp/cvs-serv21625/sysklogd
Modified Files:
Config.in logread.c syslogd.c
Log Message:
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.
Index: Config.in
===================================================================
RCS file: /var/cvs/busybox/sysklogd/Config.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Config.in 22 Oct 2003 09:58:53 -0000 1.5
+++ Config.in 19 Dec 2003 11:32:14 -0000 1.6
@@ -56,6 +56,14 @@
entire filesystem, which may cause your system to
break badly.
+config CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE
+ int " Circular buffer size in Kbytes (minimum 4KB)"
+ default 16
+ depends on CONFIG_FEATURE_IPC_SYSLOG
+ help
+ This option sets the size of the circular buffer
+ used to record system log messages.
+
config CONFIG_LOGREAD
bool " logread"
default y
@@ -66,6 +74,17 @@
utility will allow you to read the messages that are
stored in the syslogd circular buffer.
+config CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING
+ bool " logread double buffering"
+ default n
+ depends on CONFIG_LOGREAD
+ help
+ 'logread' ouput to slow serial terminals can have
+ side effects on syslog because of the semaphore.
+ This option make logread to double buffer copy
+ from circular buffer, minimizing semaphore
+ contention at some minor memory expense.
+
config CONFIG_KLOGD
bool "klogd"
default n
Index: syslogd.c
===================================================================
RCS file: /var/cvs/busybox/sysklogd/syslogd.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- syslogd.c 15 Dec 2003 21:57:44 -0000 1.105
+++ syslogd.c 19 Dec 2003 11:32:14 -0000 1.106
@@ -94,6 +94,12 @@
/* 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 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_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 @@
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 @@
if (optarg) {
int buf_size = atoi(optarg);
if (buf_size >= 4) {
- data_size = buf_size;
+ shm_size = buf_size;
}
}
circular_logging = TRUE;
Index: logread.c
===================================================================
RCS file: /var/cvs/busybox/sysklogd/logread.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- logread.c 26 Sep 2003 01:03:16 -0000 1.13
+++ logread.c 19 Dec 2003 11:32:14 -0000 1.14
@@ -108,8 +108,7 @@
i = follow ? buf->tail : buf->head;
do {
-#undef RC_LOGREAD
-#ifdef RC_LOGREAD
+#ifdef CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING
char *buf_data;
int log_len,j;
#endif
@@ -128,7 +127,7 @@
}
// Read Memory
-#ifdef RC_LOGREAD
+#ifdef CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING
log_len = buf->tail - i;
if (log_len < 0)
log_len += buf->size;
@@ -155,7 +154,7 @@
// release the lock on the log chain
sem_up(log_semid);
-#ifdef RC_LOGREAD
+#ifdef CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING
for (j=0; j < log_len; j+=strlen(buf_data+j)+1) {
printf("%s", buf_data+j);
if (follow)
More information about the busybox-cvs
mailing list