Fix a divide-by-zero on kern.log_wakeups_per_second tunable.

Submitted by: Christian S.J. Peron <maneo@bsdpro.com>
PR: kern/53557
This commit is contained in:
bmilekic 2003-06-20 22:18:38 +00:00
parent d9eb578392
commit 32040dcc61

View File

@ -101,6 +101,10 @@ logopen(dev_t dev, int flags, int mode, struct thread *td)
log_open = 1;
callout_init(&logsoftc.sc_callout, 0);
fsetown(td->td_proc->p_pid, &logsoftc.sc_sigio); /* signal process only */
if (log_wakeups_per_second < 1) {
printf("syslog wakeup is less than one. Adjusting to 1.\n");
log_wakeups_per_second = 1;
}
callout_reset(&logsoftc.sc_callout, hz / log_wakeups_per_second,
logtimeout, NULL);
return (0);
@ -183,6 +187,10 @@ logtimeout(void *arg)
if (!log_open)
return;
if (log_wakeups_per_second < 1) {
printf("syslog wakeup is less than one. Adjusting to 1.\n");
log_wakeups_per_second = 1;
}
if (msgbuftrigger == 0) {
callout_reset(&logsoftc.sc_callout,
hz / log_wakeups_per_second, logtimeout, NULL);