Home | History | Annotate | Line # | Download | only in kern
subr_log.c revision 1.41.8.3
      1  1.41.8.3      matt /*	subr_log.c,v 1.41.8.2 2008/01/09 01:56:17 matt Exp	*/
      2  1.41.8.1      matt 
      3  1.41.8.1      matt /*-
      4  1.41.8.1      matt  * Copyright (c) 2007 The NetBSD Foundation, Inc.
      5  1.41.8.1      matt  * All rights reserved.
      6  1.41.8.1      matt  *
      7  1.41.8.1      matt  * This code is derived from software contributed to The NetBSD Foundation
      8  1.41.8.1      matt  * by Andrew Doran.
      9  1.41.8.1      matt  *
     10  1.41.8.1      matt  * Redistribution and use in source and binary forms, with or without
     11  1.41.8.1      matt  * modification, are permitted provided that the following conditions
     12  1.41.8.1      matt  * are met:
     13  1.41.8.1      matt  * 1. Redistributions of source code must retain the above copyright
     14  1.41.8.1      matt  *    notice, this list of conditions and the following disclaimer.
     15  1.41.8.1      matt  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.41.8.1      matt  *    notice, this list of conditions and the following disclaimer in the
     17  1.41.8.1      matt  *    documentation and/or other materials provided with the distribution.
     18  1.41.8.1      matt  * 3. All advertising materials mentioning features or use of this software
     19  1.41.8.1      matt  *    must display the following acknowledgement:
     20  1.41.8.1      matt  *	This product includes software developed by the NetBSD
     21  1.41.8.1      matt  *	Foundation, Inc. and its contributors.
     22  1.41.8.1      matt  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.41.8.1      matt  *    contributors may be used to endorse or promote products derived
     24  1.41.8.1      matt  *    from this software without specific prior written permission.
     25  1.41.8.1      matt  *
     26  1.41.8.1      matt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.41.8.1      matt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.41.8.1      matt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.41.8.1      matt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.41.8.1      matt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.41.8.1      matt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.41.8.1      matt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.41.8.1      matt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.41.8.1      matt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.41.8.1      matt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.41.8.1      matt  * POSSIBILITY OF SUCH DAMAGE.
     37  1.41.8.1      matt  */
     38       1.7       cgd 
     39       1.1       cgd /*
     40       1.6       cgd  * Copyright (c) 1982, 1986, 1993
     41       1.6       cgd  *	The Regents of the University of California.  All rights reserved.
     42       1.1       cgd  *
     43       1.1       cgd  * Redistribution and use in source and binary forms, with or without
     44       1.1       cgd  * modification, are permitted provided that the following conditions
     45       1.1       cgd  * are met:
     46       1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     47       1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     48       1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     49       1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     50       1.1       cgd  *    documentation and/or other materials provided with the distribution.
     51      1.29       agc  * 3. Neither the name of the University nor the names of its contributors
     52       1.1       cgd  *    may be used to endorse or promote products derived from this software
     53       1.1       cgd  *    without specific prior written permission.
     54       1.1       cgd  *
     55       1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     56       1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     57       1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     58       1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     59       1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     60       1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     61       1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     62       1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     63       1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     64       1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     65       1.1       cgd  * SUCH DAMAGE.
     66       1.1       cgd  *
     67      1.15      fvdl  *	@(#)subr_log.c	8.3 (Berkeley) 2/14/95
     68       1.1       cgd  */
     69       1.1       cgd 
     70       1.1       cgd /*
     71       1.1       cgd  * Error log buffer for kernel printf's.
     72       1.1       cgd  */
     73      1.21     lukem 
     74      1.21     lukem #include <sys/cdefs.h>
     75  1.41.8.3      matt __KERNEL_RCSID(0, "subr_log.c,v 1.41.8.2 2008/01/09 01:56:17 matt Exp");
     76       1.1       cgd 
     77       1.4   mycroft #include <sys/param.h>
     78       1.4   mycroft #include <sys/systm.h>
     79  1.41.8.1      matt #include <sys/kernel.h>
     80       1.4   mycroft #include <sys/proc.h>
     81       1.4   mycroft #include <sys/vnode.h>
     82       1.4   mycroft #include <sys/ioctl.h>
     83       1.4   mycroft #include <sys/msgbuf.h>
     84       1.4   mycroft #include <sys/file.h>
     85      1.10  christos #include <sys/syslog.h>
     86      1.11  christos #include <sys/conf.h>
     87      1.12   mycroft #include <sys/select.h>
     88  1.41.8.1      matt #include <sys/poll.h>
     89  1.41.8.1      matt #include <sys/intr.h>
     90       1.1       cgd 
     91  1.41.8.1      matt static void	logsoftintr(void *);
     92       1.1       cgd 
     93  1.41.8.1      matt static bool	log_async;
     94  1.41.8.1      matt static struct selinfo log_selp;		/* process waiting on select call */
     95  1.41.8.1      matt static pid_t	log_pgid;		/* process/group for async I/O */
     96  1.41.8.1      matt static kcondvar_t log_cv;
     97  1.41.8.1      matt static void	*log_sih;
     98       1.1       cgd 
     99  1.41.8.2      matt kmutex_t log_lock;
    100       1.1       cgd int	log_open;			/* also used in log() */
    101      1.13       leo int	msgbufmapped;			/* is the message buffer mapped */
    102      1.13       leo int	msgbufenabled;			/* is logging to the buffer enabled */
    103      1.13       leo struct	kern_msgbuf *msgbufp;		/* the mapped buffer, itself. */
    104      1.23   gehenna 
    105      1.13       leo void
    106      1.35   thorpej initmsgbuf(void *bf, size_t bufsize)
    107      1.13       leo {
    108      1.18  augustss 	struct kern_msgbuf *mbp;
    109      1.13       leo 	long new_bufs;
    110      1.13       leo 
    111      1.13       leo 	/* Sanity-check the given size. */
    112      1.13       leo 	if (bufsize < sizeof(struct kern_msgbuf))
    113      1.13       leo 		return;
    114      1.13       leo 
    115      1.34  christos 	mbp = msgbufp = (struct kern_msgbuf *)bf;
    116      1.13       leo 
    117      1.13       leo 	new_bufs = bufsize - offsetof(struct kern_msgbuf, msg_bufc);
    118      1.13       leo 	if ((mbp->msg_magic != MSG_MAGIC) || (mbp->msg_bufs != new_bufs) ||
    119      1.13       leo 	    (mbp->msg_bufr < 0) || (mbp->msg_bufr >= mbp->msg_bufs) ||
    120      1.13       leo 	    (mbp->msg_bufx < 0) || (mbp->msg_bufx >= mbp->msg_bufs)) {
    121      1.13       leo 		/*
    122      1.13       leo 		 * If the buffer magic number is wrong, has changed
    123      1.13       leo 		 * size (which shouldn't happen often), or is
    124      1.13       leo 		 * internally inconsistent, initialize it.
    125      1.13       leo 		 */
    126      1.13       leo 
    127      1.34  christos 		memset(bf, 0, bufsize);
    128      1.13       leo 		mbp->msg_magic = MSG_MAGIC;
    129      1.13       leo 		mbp->msg_bufs = new_bufs;
    130      1.13       leo 	}
    131      1.13       leo 
    132      1.13       leo 	/* mark it as ready for use. */
    133      1.13       leo 	msgbufmapped = msgbufenabled = 1;
    134      1.13       leo }
    135       1.1       cgd 
    136  1.41.8.1      matt void
    137  1.41.8.1      matt loginit(void)
    138  1.41.8.1      matt {
    139  1.41.8.1      matt 
    140  1.41.8.2      matt 	mutex_init(&log_lock, MUTEX_DEFAULT, IPL_VM);
    141  1.41.8.1      matt 	selinit(&log_selp);
    142  1.41.8.1      matt 	cv_init(&log_cv, "klog");
    143  1.41.8.1      matt 	log_sih = softint_establish(SOFTINT_CLOCK | SOFTINT_MPSAFE,
    144  1.41.8.1      matt 	    logsoftintr, NULL);
    145  1.41.8.1      matt }
    146  1.41.8.1      matt 
    147       1.1       cgd /*ARGSUSED*/
    148      1.35   thorpej static int
    149      1.39      yamt logopen(dev_t dev, int flags, int mode, struct lwp *l)
    150       1.1       cgd {
    151      1.18  augustss 	struct kern_msgbuf *mbp = msgbufp;
    152  1.41.8.1      matt 	int error = 0;
    153       1.1       cgd 
    154  1.41.8.1      matt 	mutex_spin_enter(&log_lock);
    155  1.41.8.1      matt 	if (log_open) {
    156  1.41.8.1      matt 		error = EBUSY;
    157  1.41.8.1      matt 	} else {
    158  1.41.8.1      matt 		log_open = 1;
    159  1.41.8.1      matt 		log_pgid = l->l_proc->p_pid;	/* signal process only */
    160  1.41.8.1      matt 		/*
    161  1.41.8.1      matt 		 * The message buffer is initialized during system
    162  1.41.8.1      matt 		 * configuration.  If it's been clobbered, note that
    163  1.41.8.1      matt 		 * and return an error.  (This allows a user to read
    164  1.41.8.1      matt 		 * the buffer via /dev/kmem, and try to figure out
    165  1.41.8.1      matt 		 * what clobbered it.
    166  1.41.8.1      matt 		 */
    167  1.41.8.1      matt 		if (mbp->msg_magic != MSG_MAGIC) {
    168  1.41.8.1      matt 			msgbufenabled = 0;
    169  1.41.8.1      matt 			error = ENXIO;
    170  1.41.8.1      matt 		}
    171      1.13       leo 	}
    172  1.41.8.1      matt 	mutex_spin_exit(&log_lock);
    173       1.1       cgd 
    174  1.41.8.1      matt 	return error;
    175       1.1       cgd }
    176       1.1       cgd 
    177       1.1       cgd /*ARGSUSED*/
    178      1.35   thorpej static int
    179      1.39      yamt logclose(dev_t dev, int flag, int mode, struct lwp *l)
    180       1.1       cgd {
    181       1.6       cgd 
    182  1.41.8.1      matt 	mutex_spin_enter(&log_lock);
    183  1.41.8.1      matt 	log_pgid = 0;
    184       1.1       cgd 	log_open = 0;
    185  1.41.8.1      matt 	log_async = 0;
    186  1.41.8.1      matt 	mutex_spin_exit(&log_lock);
    187  1.41.8.1      matt 
    188  1.41.8.1      matt 	return 0;
    189       1.1       cgd }
    190       1.1       cgd 
    191       1.1       cgd /*ARGSUSED*/
    192      1.35   thorpej static int
    193      1.39      yamt logread(dev_t dev, struct uio *uio, int flag)
    194       1.1       cgd {
    195      1.18  augustss 	struct kern_msgbuf *mbp = msgbufp;
    196      1.18  augustss 	long l;
    197       1.1       cgd 	int error = 0;
    198       1.1       cgd 
    199  1.41.8.1      matt 	mutex_spin_enter(&log_lock);
    200       1.1       cgd 	while (mbp->msg_bufr == mbp->msg_bufx) {
    201       1.1       cgd 		if (flag & IO_NDELAY) {
    202  1.41.8.1      matt 			mutex_spin_exit(&log_lock);
    203  1.41.8.1      matt 			return EWOULDBLOCK;
    204       1.1       cgd 		}
    205  1.41.8.1      matt 		error = cv_wait_sig(&log_cv, &log_lock);
    206       1.9  christos 		if (error) {
    207  1.41.8.1      matt 			mutex_spin_exit(&log_lock);
    208  1.41.8.1      matt 			return error;
    209       1.1       cgd 		}
    210       1.1       cgd 	}
    211       1.1       cgd 	while (uio->uio_resid > 0) {
    212       1.1       cgd 		l = mbp->msg_bufx - mbp->msg_bufr;
    213       1.1       cgd 		if (l < 0)
    214      1.13       leo 			l = mbp->msg_bufs - mbp->msg_bufr;
    215       1.6       cgd 		l = min(l, uio->uio_resid);
    216       1.1       cgd 		if (l == 0)
    217       1.1       cgd 			break;
    218  1.41.8.1      matt 		mutex_spin_exit(&log_lock);
    219  1.41.8.1      matt 		error = uiomove(&mbp->msg_bufc[mbp->msg_bufr], (int)l, uio);
    220  1.41.8.1      matt 		mutex_spin_enter(&log_lock);
    221       1.1       cgd 		if (error)
    222       1.1       cgd 			break;
    223       1.1       cgd 		mbp->msg_bufr += l;
    224      1.13       leo 		if (mbp->msg_bufr < 0 || mbp->msg_bufr >= mbp->msg_bufs)
    225       1.1       cgd 			mbp->msg_bufr = 0;
    226       1.1       cgd 	}
    227  1.41.8.1      matt 	mutex_spin_exit(&log_lock);
    228  1.41.8.1      matt 
    229  1.41.8.1      matt 	return error;
    230       1.1       cgd }
    231       1.1       cgd 
    232       1.1       cgd /*ARGSUSED*/
    233      1.35   thorpej static int
    234      1.39      yamt logpoll(dev_t dev, int events, struct lwp *l)
    235       1.1       cgd {
    236      1.12   mycroft 	int revents = 0;
    237       1.1       cgd 
    238      1.17   thorpej 	if (events & (POLLIN | POLLRDNORM)) {
    239  1.41.8.1      matt 		mutex_spin_enter(&log_lock);
    240      1.12   mycroft 		if (msgbufp->msg_bufr != msgbufp->msg_bufx)
    241      1.12   mycroft 			revents |= events & (POLLIN | POLLRDNORM);
    242      1.12   mycroft 		else
    243  1.41.8.1      matt 			selrecord(l, &log_selp);
    244  1.41.8.1      matt 		mutex_spin_exit(&log_lock);
    245      1.17   thorpej 	}
    246       1.1       cgd 
    247  1.41.8.1      matt 	return revents;
    248       1.1       cgd }
    249       1.1       cgd 
    250      1.24  jdolecek static void
    251      1.24  jdolecek filt_logrdetach(struct knote *kn)
    252      1.24  jdolecek {
    253      1.24  jdolecek 
    254  1.41.8.1      matt 	mutex_spin_enter(&log_lock);
    255  1.41.8.1      matt 	SLIST_REMOVE(&log_selp.sel_klist, kn, knote, kn_selnext);
    256  1.41.8.1      matt 	mutex_spin_exit(&log_lock);
    257      1.24  jdolecek }
    258      1.24  jdolecek 
    259      1.24  jdolecek static int
    260      1.39      yamt filt_logread(struct knote *kn, long hint)
    261      1.24  jdolecek {
    262  1.41.8.1      matt 	int rv;
    263      1.24  jdolecek 
    264  1.41.8.1      matt 	if ((hint & NOTE_SUBMIT) == 0)
    265  1.41.8.1      matt 		mutex_spin_enter(&log_lock);
    266  1.41.8.1      matt 	if (msgbufp->msg_bufr == msgbufp->msg_bufx) {
    267  1.41.8.1      matt 		rv = 0;
    268  1.41.8.1      matt 	} else if (msgbufp->msg_bufr < msgbufp->msg_bufx) {
    269      1.24  jdolecek 		kn->kn_data = msgbufp->msg_bufx - msgbufp->msg_bufr;
    270  1.41.8.1      matt 		rv = 1;
    271  1.41.8.1      matt 	} else {
    272      1.24  jdolecek 		kn->kn_data = (msgbufp->msg_bufs - msgbufp->msg_bufr) +
    273      1.24  jdolecek 		    msgbufp->msg_bufx;
    274  1.41.8.1      matt 		rv = 1;
    275  1.41.8.1      matt 	}
    276  1.41.8.1      matt 	if ((hint & NOTE_SUBMIT) == 0)
    277  1.41.8.1      matt 		mutex_spin_exit(&log_lock);
    278      1.24  jdolecek 
    279  1.41.8.1      matt 	return rv;
    280      1.24  jdolecek }
    281      1.24  jdolecek 
    282      1.24  jdolecek static const struct filterops logread_filtops =
    283      1.24  jdolecek 	{ 1, NULL, filt_logrdetach, filt_logread };
    284      1.24  jdolecek 
    285      1.35   thorpej static int
    286      1.39      yamt logkqfilter(dev_t dev, struct knote *kn)
    287      1.24  jdolecek {
    288      1.24  jdolecek 	struct klist *klist;
    289      1.24  jdolecek 
    290      1.24  jdolecek 	switch (kn->kn_filter) {
    291      1.24  jdolecek 	case EVFILT_READ:
    292  1.41.8.1      matt 		klist = &log_selp.sel_klist;
    293      1.24  jdolecek 		kn->kn_fop = &logread_filtops;
    294      1.24  jdolecek 		break;
    295      1.24  jdolecek 
    296      1.24  jdolecek 	default:
    297  1.41.8.2      matt 		return (EINVAL);
    298      1.24  jdolecek 	}
    299      1.24  jdolecek 
    300  1.41.8.1      matt 	mutex_spin_enter(&log_lock);
    301      1.24  jdolecek 	kn->kn_hook = NULL;
    302      1.24  jdolecek 	SLIST_INSERT_HEAD(klist, kn, kn_selnext);
    303  1.41.8.1      matt 	mutex_spin_exit(&log_lock);
    304      1.24  jdolecek 
    305      1.24  jdolecek 	return (0);
    306      1.24  jdolecek }
    307      1.24  jdolecek 
    308       1.3    andrew void
    309      1.35   thorpej logwakeup(void)
    310       1.1       cgd {
    311  1.41.8.1      matt 
    312  1.41.8.1      matt 	if (!cold && log_open) {
    313  1.41.8.1      matt 		mutex_spin_enter(&log_lock);
    314  1.41.8.3      matt 		selnotify(&log_selp, 0, NOTE_SUBMIT);
    315  1.41.8.1      matt 		if (log_async)
    316  1.41.8.1      matt 			softint_schedule(log_sih);
    317  1.41.8.1      matt 		cv_broadcast(&log_cv);
    318  1.41.8.1      matt 		mutex_spin_exit(&log_lock);
    319       1.1       cgd 	}
    320       1.1       cgd }
    321       1.1       cgd 
    322  1.41.8.1      matt static void
    323  1.41.8.1      matt logsoftintr(void *cookie)
    324  1.41.8.1      matt {
    325  1.41.8.1      matt 	pid_t pid;
    326  1.41.8.1      matt 
    327  1.41.8.1      matt 	if ((pid = log_pgid) != 0)
    328  1.41.8.1      matt 		fownsignal(pid, SIGIO, 0, 0, NULL);
    329  1.41.8.1      matt }
    330  1.41.8.1      matt 
    331       1.1       cgd /*ARGSUSED*/
    332      1.35   thorpej static int
    333      1.40  christos logioctl(dev_t dev, u_long com, void *data, int flag, struct lwp *lwp)
    334       1.1       cgd {
    335      1.36  christos 	struct proc *p = lwp->l_proc;
    336       1.1       cgd 	long l;
    337       1.1       cgd 
    338       1.1       cgd 	switch (com) {
    339       1.1       cgd 
    340       1.1       cgd 	/* return number of characters immediately available */
    341       1.1       cgd 	case FIONREAD:
    342  1.41.8.1      matt 		mutex_spin_enter(&log_lock);
    343       1.1       cgd 		l = msgbufp->msg_bufx - msgbufp->msg_bufr;
    344       1.1       cgd 		if (l < 0)
    345      1.13       leo 			l += msgbufp->msg_bufs;
    346  1.41.8.1      matt 		mutex_spin_exit(&log_lock);
    347       1.5   deraadt 		*(int *)data = l;
    348       1.1       cgd 		break;
    349       1.1       cgd 
    350       1.1       cgd 	case FIONBIO:
    351       1.1       cgd 		break;
    352       1.1       cgd 
    353       1.1       cgd 	case FIOASYNC:
    354  1.41.8.1      matt 		/* No locking needed, 'thread private'. */
    355  1.41.8.1      matt 		log_async = (*((int *)data) != 0);
    356       1.1       cgd 		break;
    357       1.1       cgd 
    358       1.1       cgd 	case TIOCSPGRP:
    359      1.32  jdolecek 	case FIOSETOWN:
    360  1.41.8.1      matt 		return fsetown(p, &log_pgid, com, data);
    361       1.1       cgd 
    362       1.1       cgd 	case TIOCGPGRP:
    363      1.32  jdolecek 	case FIOGETOWN:
    364  1.41.8.1      matt 		return fgetown(p, log_pgid, com, data);
    365       1.1       cgd 
    366       1.1       cgd 	default:
    367      1.22     enami 		return (EPASSTHROUGH);
    368       1.1       cgd 	}
    369       1.1       cgd 	return (0);
    370       1.1       cgd }
    371      1.35   thorpej 
    372  1.41.8.1      matt void
    373  1.41.8.1      matt logputchar(int c)
    374  1.41.8.1      matt {
    375  1.41.8.1      matt 	struct kern_msgbuf *mbp;
    376  1.41.8.1      matt 
    377  1.41.8.1      matt 	if (!cold)
    378  1.41.8.1      matt 		mutex_spin_enter(&log_lock);
    379  1.41.8.1      matt 	if (msgbufenabled) {
    380  1.41.8.1      matt 		mbp = msgbufp;
    381  1.41.8.1      matt 		if (mbp->msg_magic != MSG_MAGIC) {
    382  1.41.8.1      matt 			/*
    383  1.41.8.1      matt 			 * Arguably should panic or somehow notify the
    384  1.41.8.1      matt 			 * user...  but how?  Panic may be too drastic,
    385  1.41.8.1      matt 			 * and would obliterate the message being kicked
    386  1.41.8.1      matt 			 * out (maybe a panic itself), and printf
    387  1.41.8.1      matt 			 * would invoke us recursively.  Silently punt
    388  1.41.8.1      matt 			 * for now.  If syslog is running, it should
    389  1.41.8.1      matt 			 * notice.
    390  1.41.8.1      matt 			 */
    391  1.41.8.1      matt 			msgbufenabled = 0;
    392  1.41.8.1      matt 		} else {
    393  1.41.8.1      matt 			mbp->msg_bufc[mbp->msg_bufx++] = c;
    394  1.41.8.1      matt 			if (mbp->msg_bufx < 0 || mbp->msg_bufx >= mbp->msg_bufs)
    395  1.41.8.1      matt 				mbp->msg_bufx = 0;
    396  1.41.8.1      matt 			/* If the buffer is full, keep the most recent data. */
    397  1.41.8.1      matt 			if (mbp->msg_bufr == mbp->msg_bufx) {
    398  1.41.8.1      matt 				 if (++mbp->msg_bufr >= mbp->msg_bufs)
    399  1.41.8.1      matt 					mbp->msg_bufr = 0;
    400  1.41.8.1      matt 			}
    401  1.41.8.1      matt 		}
    402  1.41.8.1      matt 	}
    403  1.41.8.1      matt 	if (!cold)
    404  1.41.8.1      matt 		mutex_spin_exit(&log_lock);
    405  1.41.8.1      matt }
    406  1.41.8.1      matt 
    407      1.35   thorpej const struct cdevsw log_cdevsw = {
    408      1.35   thorpej 	logopen, logclose, logread, nowrite, logioctl,
    409  1.41.8.1      matt 	nostop, notty, logpoll, nommap, logkqfilter,
    410  1.41.8.1      matt 	D_OTHER | D_MPSAFE
    411      1.35   thorpej };
    412