syslogd: Always domark() timer, regardless of -mfoo value
The domark() timer handles a lot of the critical maintenance action in syslogd, it must always be guaranteed to run. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
280b5fd3ec
commit
90dd1b1c37
@ -428,9 +428,7 @@ int main(int argc, char *argv[])
|
|||||||
(void)signal(SIGUSR1, Debug ? debug_switch : SIG_IGN);
|
(void)signal(SIGUSR1, Debug ? debug_switch : SIG_IGN);
|
||||||
(void)signal(SIGXFSZ, SIG_IGN);
|
(void)signal(SIGXFSZ, SIG_IGN);
|
||||||
(void)signal(SIGHUP, sighup_handler);
|
(void)signal(SIGHUP, sighup_handler);
|
||||||
|
alarm(TIMERINTVL);
|
||||||
LastAlarm = MarkInterval;
|
|
||||||
alarm(LastAlarm);
|
|
||||||
|
|
||||||
logit("Starting.\n");
|
logit("Starting.\n");
|
||||||
init();
|
init();
|
||||||
@ -1270,7 +1268,7 @@ static void logmsg(struct buf_msg *buffer)
|
|||||||
seconds = alarm(0);
|
seconds = alarm(0);
|
||||||
MarkSeq += LastAlarm - seconds;
|
MarkSeq += LastAlarm - seconds;
|
||||||
LastAlarm = seconds;
|
LastAlarm = seconds;
|
||||||
if (LastAlarm > TIMERINTVL)
|
if (LastAlarm > TIMERINTVL || LastAlarm <= 0)
|
||||||
LastAlarm = TIMERINTVL;
|
LastAlarm = TIMERINTVL;
|
||||||
alarm(LastAlarm);
|
alarm(LastAlarm);
|
||||||
}
|
}
|
||||||
@ -1295,6 +1293,8 @@ static void logmsg(struct buf_msg *buffer)
|
|||||||
|
|
||||||
MarkSeq += LastAlarm - alarm(0);
|
MarkSeq += LastAlarm - alarm(0);
|
||||||
LastAlarm = MarkInterval - MarkSeq;
|
LastAlarm = MarkInterval - MarkSeq;
|
||||||
|
if (LastAlarm > TIMERINTVL || LastAlarm <= 0)
|
||||||
|
LastAlarm = TIMERINTVL;
|
||||||
alarm(LastAlarm);
|
alarm(LastAlarm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1935,8 +1935,9 @@ void domark(int signo)
|
|||||||
{
|
{
|
||||||
struct filed *f;
|
struct filed *f;
|
||||||
|
|
||||||
|
now = time(NULL);
|
||||||
|
|
||||||
if (MarkInterval > 0) {
|
if (MarkInterval > 0) {
|
||||||
now = time(0);
|
|
||||||
MarkSeq += LastAlarm;
|
MarkSeq += LastAlarm;
|
||||||
if (MarkSeq >= MarkInterval) {
|
if (MarkSeq >= MarkInterval) {
|
||||||
flog(INTERNAL_MARK | LOG_INFO, "-- MARK --");
|
flog(INTERNAL_MARK | LOG_INFO, "-- MARK --");
|
||||||
@ -1956,7 +1957,7 @@ void domark(int signo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LastAlarm = MarkInterval - MarkSeq;
|
LastAlarm = MarkInterval - MarkSeq;
|
||||||
if (DupesPending && LastAlarm > TIMERINTVL)
|
if (LastAlarm > TIMERINTVL || LastAlarm <= 0)
|
||||||
LastAlarm = TIMERINTVL;
|
LastAlarm = TIMERINTVL;
|
||||||
|
|
||||||
(void)alarm(LastAlarm);
|
(void)alarm(LastAlarm);
|
||||||
|
Loading…
Reference in New Issue
Block a user