syslogd: MARK code is buggy. Disabling it altogether on anti-bloat grounds

This commit is contained in:
Denis Vlasenko 2007-02-14 20:51:46 +00:00
parent 9ab2658836
commit 4998c81891
2 changed files with 12 additions and 1 deletions

View File

@ -3054,7 +3054,6 @@
"System logging utility.\n" \ "System logging utility.\n" \
"Note that this version of syslogd ignores /etc/syslog.conf." \ "Note that this version of syslogd ignores /etc/syslog.conf." \
"\n\nOptions:" \ "\n\nOptions:" \
"\n -m MIN Minutes between MARK lines (default=20, 0=off)" \
"\n -n Run as foreground process" \ "\n -n Run as foreground process" \
"\n -O FILE Use an alternate log file (default=/var/log/messages)" \ "\n -O FILE Use an alternate log file (default=/var/log/messages)" \
"\n -l n Sets the local log level of messages to n" \ "\n -l n Sets the local log level of messages to n" \
@ -3068,6 +3067,7 @@
USE_FEATURE_IPC_SYSLOG( \ USE_FEATURE_IPC_SYSLOG( \
"\n -C[size(KiB)] Log to a shared mem buffer (read the buffer using logread)") "\n -C[size(KiB)] Log to a shared mem buffer (read the buffer using logread)")
/* NB: -Csize shouldn't have space (because size is optional) */ /* NB: -Csize shouldn't have space (because size is optional) */
/* "\n -m MIN Minutes between MARK lines (default=20, 0=off)" */
#define syslogd_example_usage \ #define syslogd_example_usage \
"$ syslogd -R masterlog:514\n" \ "$ syslogd -R masterlog:514\n" \
"$ syslogd -R 192.168.1.1:601\n" "$ syslogd -R 192.168.1.1:601\n"

View File

@ -28,8 +28,13 @@
static const char *logFilePath = "/var/log/messages"; static const char *logFilePath = "/var/log/messages";
static int logFD = -1; static int logFD = -1;
/* This is not very useful, is bloat, and broken:
* can deadlock if alarmed to make MARK while writing to IPC buffer
* (semaphores are down but do_mark routine tries to down them again) */
#ifdef SYSLOGD_MARK
/* interval between marks in seconds */ /* interval between marks in seconds */
static int markInterval = 20 * 60; static int markInterval = 20 * 60;
#endif
/* level of messages to be locally logged */ /* level of messages to be locally logged */
static int logLevel = 8; static int logLevel = 8;
@ -448,6 +453,7 @@ static void quit_signal(int sig)
exit(1); exit(1);
} }
#ifdef SYSLOGD_MARK
static void do_mark(int sig) static void do_mark(int sig)
{ {
if (markInterval) { if (markInterval) {
@ -455,6 +461,7 @@ static void do_mark(int sig)
alarm(markInterval); alarm(markInterval);
} }
} }
#endif
static void do_syslogd(void) ATTRIBUTE_NORETURN; static void do_syslogd(void) ATTRIBUTE_NORETURN;
static void do_syslogd(void) static void do_syslogd(void)
@ -473,8 +480,10 @@ static void do_syslogd(void)
#ifdef SIGCLD #ifdef SIGCLD
signal(SIGCLD, SIG_IGN); signal(SIGCLD, SIG_IGN);
#endif #endif
#ifdef SYSLOGD_MARK
signal(SIGALRM, do_mark); signal(SIGALRM, do_mark);
alarm(markInterval); alarm(markInterval);
#endif
memset(&sunx, 0, sizeof(sunx)); memset(&sunx, 0, sizeof(sunx));
sunx.sun_family = AF_UNIX; sunx.sun_family = AF_UNIX;
@ -558,8 +567,10 @@ int syslogd_main(int argc, char **argv)
/* do normal option parsing */ /* do normal option parsing */
opt_complementary = "=0"; /* no non-option params */ opt_complementary = "=0"; /* no non-option params */
getopt32(argc, argv, OPTION_STR, OPTION_PARAM); getopt32(argc, argv, OPTION_STR, OPTION_PARAM);
#ifdef SYSLOGD_MARK
if (option_mask32 & OPT_mark) // -m if (option_mask32 & OPT_mark) // -m
markInterval = xatou_range(opt_m, 0, INT_MAX/60) * 60; markInterval = xatou_range(opt_m, 0, INT_MAX/60) * 60;
#endif
//if (option_mask32 & OPT_nofork) // -n //if (option_mask32 & OPT_nofork) // -n
//if (option_mask32 & OPT_outfile) // -O //if (option_mask32 & OPT_outfile) // -O
if (option_mask32 & OPT_loglevel) // -l if (option_mask32 & OPT_loglevel) // -l