diff -Naur busybox/docs/busybox.sgml busybox-corvil/docs/busybox.sgml --- busybox/docs/busybox.sgml 2002-12-14 01:58:56.000000000 +0000 +++ busybox-corvil/docs/busybox.sgml 2003-05-12 14:46:14.000000000 +0000 @@ -3103,7 +3103,7 @@ -O FILE Use an alternate log file (default=/var/log/messages) -R HOST[:PORT] Log remotely to IP or hostname on PORT (default PORT=514/UDP) -L Log locally as well as network logging (default is network only) - -C Log to a circular buffer. Read this buffer using 'logread' + -C [size(KiB)] Log to a circular buffer. Read this buffer using 'logread' diff -Naur busybox/include/usage.h busybox-corvil/include/usage.h --- busybox/include/usage.h 2003-05-11 14:52:37.000000000 +0000 +++ busybox-corvil/include/usage.h 2003-05-12 14:46:35.000000000 +0000 @@ -2080,7 +2080,7 @@ "\n\t-R HOST[:PORT]\tLog to IP or hostname on PORT (default PORT=514/UDP)\n" \ "\t-L\t\tLog locally and via network logging (default is network only)") \ USAGE_IPC_LOG( \ - "\n\t-C\t\tLog to a circular buffer (read the buffer using logread)") + "\n\t-C [size(KiB)]\tLog to a circular buffer (read the buffer using logread)") #define syslogd_example_usage \ "$ syslogd -R masterlog:514\n" \ "$ syslogd -R 192.168.1.1:601\n" diff -Naur busybox/sysklogd/syslogd.c busybox-corvil/sysklogd/syslogd.c --- busybox/sysklogd/syslogd.c 2003-03-19 09:12:57.000000000 +0000 +++ busybox-corvil/sysklogd/syslogd.c 2003-05-12 14:46:35.000000000 +0000 @@ -113,8 +113,7 @@ static int shmid = -1; // ipc shared memory id static int s_semid = -1; // ipc semaphore id -int data_size = 16000; // data size -int shm_size = 16000 + sizeof(*buf); // our buffer size +static int data_size = 16000; // default data size static int circular_logging = FALSE; /* @@ -156,7 +155,7 @@ void ipcsyslog_init(void) { if (buf == NULL) { - if ((shmid = shmget(KEY_ID, shm_size, IPC_CREAT | 1023)) == -1) { + if ((shmid = shmget(KEY_ID, data_size, IPC_CREAT | 1023)) == -1) { bb_perror_msg_and_die("shmget"); } @@ -164,7 +163,7 @@ bb_perror_msg_and_die("shmat"); } - buf->size = data_size; + buf->size = data_size - sizeof(*buf); buf->head = buf->tail = 0; // we'll trust the OS to set initial semval to 0 (let's hope) @@ -587,7 +586,7 @@ char *p; /* do normal option parsing */ - while ((opt = getopt(argc, argv, "m:nO:R:LC")) > 0) { + while ((opt = getopt(argc, argv, "m:nO:R:LC::")) > 0) { switch (opt) { case 'm': MarkInterval = atoi(optarg) * 60; @@ -615,6 +614,12 @@ #endif #ifdef CONFIG_FEATURE_IPC_SYSLOG case 'C': + if (optarg) { + int buf_size = atoi(optarg); + if (buf_size >= 4) { + data_size = buf_size * 1024; + } + } circular_logging = TRUE; break; #endif