Print this page
4211 Some syslog facility names and symbols are missing
3232 syslogd shouldn't sync after each LOG_KERN line
1762 Syslogd man page: missing reference.

*** 17,29 **** * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. - * Copyright 2012 Milan Jurik. All rights reserved. */ /* * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T * All Rights Reserved --- 17,30 ---- * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* + * Copyright (c) 2013 Gary Mills + * Copyright 2012 Milan Jurik. All rights reserved. * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T * All Rights Reserved
*** 153,163 **** --- 154,169 ---- "mark", LOG_MARK, "syslog", LOG_SYSLOG, "lpr", LOG_LPR, "news", LOG_NEWS, "uucp", LOG_UUCP, + "bsdcron", LOG_BSDCRON, + "authpriv", LOG_AUTHPRIV, + "ftp", LOG_FTP, + "ntp", LOG_NTP, "audit", LOG_AUDIT, + "console", LOG_CONSOLE, "cron", LOG_CRON, "local0", LOG_LOCAL0, "local1", LOG_LOCAL1, "local2", LOG_LOCAL2, "local3", LOG_LOCAL3,
*** 605,614 **** --- 611,621 ---- /*ARGSUSED*/ static void * sys_poll(void *ap) { int nfds; + int timeout; static int klogerrs = 0; pthread_t mythreadno; if (Debug) { mythreadno = pthread_self();
*** 616,668 **** DPRINT1(1, "sys_poll(%u): sys_thread started\n", mythreadno); /* * Try to process as many messages as we can without blocking on poll. ! * We count such "initial" messages with sys_init_msg_count and * enqueue them without the SYNC_FILE flag. When no more data is * waiting on the local log device, we set timeout to INFTIM, ! * clear sys_init_msg_count, and generate a flush message to sync ! * the previously counted initial messages out to disk. */ ! sys_init_msg_count = 0; for (;;) { errno = 0; t_errno = 0; ! nfds = poll(&Pfd, 1, INFTIM); ! if (nfds == 0) ! continue; ! ! if (nfds < 0) { ! if (errno != EINTR) logerror("poll"); continue; } if (Pfd.revents & POLLIN) { ! getkmsg(INFTIM); ! } else { if (shutting_down) { pthread_exit(0); } if (Pfd.revents & (POLLNVAL|POLLHUP|POLLERR)) { logerror("kernel log driver poll error"); (void) close(Pfd.fd); Pfd.fd = -1; } - } while (Pfd.fd == -1 && klogerrs++ < 10) { Pfd.fd = openklog(LogName, O_RDONLY); } if (klogerrs >= 10) { logerror("can't reopen kernel log device - fatal"); exit(1); } } /*NOTREACHED*/ return (NULL); } --- 623,682 ---- DPRINT1(1, "sys_poll(%u): sys_thread started\n", mythreadno); /* * Try to process as many messages as we can without blocking on poll. ! * We identify such messages with timeout == 0 and * enqueue them without the SYNC_FILE flag. When no more data is * waiting on the local log device, we set timeout to INFTIM, ! * and generate a flush message to sync ! * the previously identified messages out to disk. */ ! timeout = INFTIM; for (;;) { errno = 0; t_errno = 0; ! nfds = poll(&Pfd, 1, timeout); ! if (nfds <= 0) { ! if (nfds < 0 && errno != EINTR) logerror("poll"); + if (timeout == 0) + flushmsg(SYNC_FILE); + timeout = INFTIM; continue; } + if (Pfd.revents & POLLIN) { ! timeout = 0; ! getkmsg(timeout); ! continue; ! } ! if (shutting_down) { pthread_exit(0); } + if (Pfd.revents & (POLLNVAL|POLLHUP|POLLERR)) { logerror("kernel log driver poll error"); (void) close(Pfd.fd); Pfd.fd = -1; } while (Pfd.fd == -1 && klogerrs++ < 10) { Pfd.fd = openklog(LogName, O_RDONLY); } if (klogerrs >= 10) { logerror("can't reopen kernel log device - fatal"); exit(1); } + if (timeout == 0) + flushmsg(SYNC_FILE); + timeout = INFTIM; } /*NOTREACHED*/ return (NULL); }
*** 693,703 **** while ((i = getmsg(Pfd.fd, &ctl, &dat, &flags)) == MOREDATA) { lastline = &dat.buf[dat.len]; *lastline = '\0'; ! DPRINT2(5, "sys_poll:(%u): getmsg: dat.len = %d\n", mythreadno, dat.len); buflen = strlen(buf); len = findnl_bkwd(buf, buflen); (void) memcpy(tmpbuf, buf, len); --- 707,717 ---- while ((i = getmsg(Pfd.fd, &ctl, &dat, &flags)) == MOREDATA) { lastline = &dat.buf[dat.len]; *lastline = '\0'; ! DPRINT2(5, "getkmsg:(%u): getmsg: dat.len = %d\n", mythreadno, dat.len); buflen = strlen(buf); len = findnl_bkwd(buf, buflen); (void) memcpy(tmpbuf, buf, len);