kern_event.c (4e27d36d38f4c3b12bcc1855c5d41527d08d1ce0) kern_event.c (9696feebe2320c9976607df4090f91a34c6549c3)
1/*-
2 * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
3 * Copyright 2004 John-Mark Gurney <jmg@FreeBSD.org>
4 * Copyright (c) 2009 Apple, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 51 unchanged lines hidden (view full) ---

60#include <sys/socket.h>
61#include <sys/socketvar.h>
62#include <sys/stat.h>
63#include <sys/sysctl.h>
64#include <sys/sysproto.h>
65#include <sys/syscallsubr.h>
66#include <sys/taskqueue.h>
67#include <sys/uio.h>
1/*-
2 * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
3 * Copyright 2004 John-Mark Gurney <jmg@FreeBSD.org>
4 * Copyright (c) 2009 Apple, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 51 unchanged lines hidden (view full) ---

60#include <sys/socket.h>
61#include <sys/socketvar.h>
62#include <sys/stat.h>
63#include <sys/sysctl.h>
64#include <sys/sysproto.h>
65#include <sys/syscallsubr.h>
66#include <sys/taskqueue.h>
67#include <sys/uio.h>
68#include <sys/user.h>
68#ifdef KTRACE
69#include <sys/ktrace.h>
70#endif
71
72#include <vm/uma.h>
73
74static MALLOC_DEFINE(M_KQUEUE, "kqueue", "memory for kqueue system");
75

--- 33 unchanged lines hidden (view full) ---

109static struct filterops *kqueue_fo_find(int filt);
110static void kqueue_fo_release(int filt);
111
112static fo_ioctl_t kqueue_ioctl;
113static fo_poll_t kqueue_poll;
114static fo_kqfilter_t kqueue_kqfilter;
115static fo_stat_t kqueue_stat;
116static fo_close_t kqueue_close;
69#ifdef KTRACE
70#include <sys/ktrace.h>
71#endif
72
73#include <vm/uma.h>
74
75static MALLOC_DEFINE(M_KQUEUE, "kqueue", "memory for kqueue system");
76

--- 33 unchanged lines hidden (view full) ---

110static struct filterops *kqueue_fo_find(int filt);
111static void kqueue_fo_release(int filt);
112
113static fo_ioctl_t kqueue_ioctl;
114static fo_poll_t kqueue_poll;
115static fo_kqfilter_t kqueue_kqfilter;
116static fo_stat_t kqueue_stat;
117static fo_close_t kqueue_close;
118static fo_fill_kinfo_t kqueue_fill_kinfo;
117
118static struct fileops kqueueops = {
119 .fo_read = invfo_rdwr,
120 .fo_write = invfo_rdwr,
121 .fo_truncate = invfo_truncate,
122 .fo_ioctl = kqueue_ioctl,
123 .fo_poll = kqueue_poll,
124 .fo_kqfilter = kqueue_kqfilter,
125 .fo_stat = kqueue_stat,
126 .fo_close = kqueue_close,
127 .fo_chmod = invfo_chmod,
128 .fo_chown = invfo_chown,
129 .fo_sendfile = invfo_sendfile,
119
120static struct fileops kqueueops = {
121 .fo_read = invfo_rdwr,
122 .fo_write = invfo_rdwr,
123 .fo_truncate = invfo_truncate,
124 .fo_ioctl = kqueue_ioctl,
125 .fo_poll = kqueue_poll,
126 .fo_kqfilter = kqueue_kqfilter,
127 .fo_stat = kqueue_stat,
128 .fo_close = kqueue_close,
129 .fo_chmod = invfo_chmod,
130 .fo_chown = invfo_chown,
131 .fo_sendfile = invfo_sendfile,
132 .fo_fill_kinfo = kqueue_fill_kinfo,
130};
131
132static int knote_attach(struct knote *kn, struct kqueue *kq);
133static void knote_drop(struct knote *kn, struct thread *td);
134static void knote_enqueue(struct knote *kn);
135static void knote_dequeue(struct knote *kn);
136static void knote_init(void);
137static struct knote *knote_alloc(int waitok);

--- 1659 unchanged lines hidden (view full) ---

1797 chgkqcnt(kq->kq_cred->cr_ruidinfo, -1, 0);
1798 crfree(kq->kq_cred);
1799 free(kq, M_KQUEUE);
1800 fp->f_data = NULL;
1801
1802 return (0);
1803}
1804
133};
134
135static int knote_attach(struct knote *kn, struct kqueue *kq);
136static void knote_drop(struct knote *kn, struct thread *td);
137static void knote_enqueue(struct knote *kn);
138static void knote_dequeue(struct knote *kn);
139static void knote_init(void);
140static struct knote *knote_alloc(int waitok);

--- 1659 unchanged lines hidden (view full) ---

1800 chgkqcnt(kq->kq_cred->cr_ruidinfo, -1, 0);
1801 crfree(kq->kq_cred);
1802 free(kq, M_KQUEUE);
1803 fp->f_data = NULL;
1804
1805 return (0);
1806}
1807
1808static int
1809kqueue_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
1810{
1811
1812 kif->kf_type = KF_TYPE_KQUEUE;
1813 return (0);
1814}
1815
1805static void
1806kqueue_wakeup(struct kqueue *kq)
1807{
1808 KQ_OWNED(kq);
1809
1810 if ((kq->kq_state & KQ_SLEEP) == KQ_SLEEP) {
1811 kq->kq_state &= ~KQ_SLEEP;
1812 wakeup(kq);

--- 518 unchanged lines hidden ---
1816static void
1817kqueue_wakeup(struct kqueue *kq)
1818{
1819 KQ_OWNED(kq);
1820
1821 if ((kq->kq_state & KQ_SLEEP) == KQ_SLEEP) {
1822 kq->kq_state &= ~KQ_SLEEP;
1823 wakeup(kq);

--- 518 unchanged lines hidden ---