36 #include <sys/cdefs.h>
39 #include <sys/param.h>
40 #include <sys/systm.h>
43 #include <sys/vnode.h>
44 #include <sys/filio.h>
45 #include <sys/ttycom.h>
46 #include <sys/msgbuf.h>
47 #include <sys/signalvar.h>
48 #include <sys/kernel.h>
50 #include <sys/filedesc.h>
51 #include <sys/sysctl.h>
53 #define LOG_RDPRI (PZERO + 1)
55 #define LOG_ASYNC 0x04
67 .d_version = D_VERSION,
110 printf(
"syslog wakeup is less than one. Adjusting to 1.\n");
149 struct msgbuf *mbp = msgbufp;
154 if (flag & IO_NDELAY) {
156 return (EWOULDBLOCK);
164 while (uio->uio_resid > 0) {
165 l = imin(
sizeof(buf), uio->uio_resid);
171 if (error || uio->uio_resid == 0)
181 logpoll(
struct cdev *dev,
int events,
struct thread *td)
185 if (events & (POLLIN | POLLRDNORM)) {
188 revents |= events & (POLLIN | POLLRDNORM);
200 if (kn->kn_filter != EVFILT_READ)
218 return (kn->kn_data != 0);
237 printf(
"syslog wakeup is less than one. Adjusting to 1.\n");
256 logioctl(
struct cdev *dev, u_long com, caddr_t data,
int flag,
struct thread *td)
308 GID_WHEEL, 0600,
"klog");
pid_t fgetown(struct sigio **sigiop)
int fsetown(pid_t pgid, struct sigio **sigiop)
static struct filterops log_read_filterops
void selrecord(struct thread *selector, struct selinfo *sip)
struct callout sc_callout
void knote(struct knlist *list, long hint, int lockflags)
void selwakeuppri(struct selinfo *sip, int pri)
struct cdev * make_dev_credf(int flags, struct cdevsw *devsw, int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt,...)
int callout_schedule(struct callout *c, int to_ticks)
void funsetown(struct sigio **sigiop)
SYSINIT(logdev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, log_drvinit, NULL)
static void logtimeout(void *arg)
MTX_SYSINIT(msgbuf_lock,&msgbuf_lock,"msgbuf lock", MTX_DEF)
void knlist_remove(struct knlist *knl, struct knote *kn, int islocked)
static void log_drvinit(void *unused)
void cv_broadcastpri(struct cv *cvp, int pri)
void knlist_add(struct knlist *knl, struct knote *kn, int islocked)
static d_ioctl_t logioctl
void cv_init(struct cv *cvp, const char *desc)
static d_close_t logclose
int uiomove(void *cp, int n, struct uio *uio)
static void logkqdetach(struct knote *note)
int printf(const char *fmt,...)
static struct cv log_wakeup
static int logkqread(struct knote *note, long hint)
int msgbuf_getcount(struct msgbuf *mbp)
static int log_wakeups_per_second
SYSCTL_INT(_kern, OID_AUTO, log_wakeups_per_second, CTLFLAG_RW,&log_wakeups_per_second, 0,"")
static d_kqfilter_t logkqfilter
void knlist_init_mtx(struct knlist *knl, struct mtx *lock)
int msgbuf_getbytes(struct msgbuf *mbp, char *buf, int buflen)
void pgsigio(struct sigio **sigiop, int sig, int checkctty)
static struct logsoftc logsoftc
static struct cdevsw log_cdevsw