FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_ktrace.h"
#include "opt_kqueue.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/capsicum.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/rwlock.h>
#include <sys/proc.h>
#include <sys/malloc.h>
#include <sys/unistd.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/filio.h>
#include <sys/fcntl.h>
#include <sys/kthread.h>
#include <sys/selinfo.h>
#include <sys/queue.h>
#include <sys/event.h>
#include <sys/eventvar.h>
#include <sys/poll.h>
#include <sys/protosw.h>
#include <sys/resourcevar.h>
#include <sys/sigio.h>
#include <sys/signalvar.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/sysproto.h>
#include <sys/syscallsubr.h>
#include <sys/taskqueue.h>
#include <sys/uio.h>
#include <sys/user.h>
#include <machine/atomic.h>
#include <vm/uma.h>
Go to the source code of this file.
Data Structures | |
struct | kq_timer_cb_data |
struct | g_kevent_args |
Macros | |
#define | KQ_GLOBAL_LOCK(lck, haslck) |
#define | KQ_GLOBAL_UNLOCK(lck, haslck) |
#define | KNOTE_ACTIVATE(kn, islock) |
#define | KQ_LOCK(kq) |
#define | KQ_FLUX_WAKEUP(kq) |
#define | KQ_UNLOCK_FLUX(kq) |
#define | KQ_UNLOCK(kq) |
#define | KQ_OWNED(kq) |
#define | KQ_NOTOWNED(kq) |
#define | KNL_ASSERT_LOCK(knl, islocked) |
#define | KNL_ASSERT_LOCKED(knl) do {} while (0) |
#define | KNL_ASSERT_UNLOCKED(knl) do {} while (0) |
#define | KN_HASHSIZE 64 /* XXX should be tunable */ |
#define | KN_HASH(val, mask) (((val) ^ (val >> 8)) & (mask)) |
#define | NOTE_TIMER_PRECMASK (NOTE_SECONDS | NOTE_MSECONDS | NOTE_USECONDS | NOTE_NSECONDS) |
#define | NS_TO_SBT(ns) (((ns) * (((uint64_t)1 << 63) / 500000000)) >> 32) |
#define | US_TO_SBT(us) (((us) * (((uint64_t)1 << 63) / 500000)) >> 32) |
#define | MS_TO_SBT(ms) (((ms) * (((uint64_t)1 << 63) / 500)) >> 32) |
#define | KQ_TIMER_CB_ENQUEUED 0x01 |
Functions | |
__FBSDID ("$FreeBSD$") | |
static | MALLOC_DEFINE (M_KQUEUE, "kqueue", "memory for kqueue system") |
MTX_SYSINIT (kq_global, &kq_global, "kqueue order", MTX_DEF) | |
TASKQUEUE_DEFINE_THREAD (kqueue_ctx) | |
static int | kevent_copyout (void *arg, struct kevent *kevp, int count) |
static int | kevent_copyin (void *arg, struct kevent *kevp, int count) |
static int | kqueue_register (struct kqueue *kq, struct kevent *kev, struct thread *td, int mflag) |
static int | kqueue_acquire (struct file *fp, struct kqueue **kqp) |
static void | kqueue_release (struct kqueue *kq, int locked) |
static void | kqueue_destroy (struct kqueue *kq) |
static void | kqueue_drain (struct kqueue *kq, struct thread *td) |
static int | kqueue_expand (struct kqueue *kq, struct filterops *fops, uintptr_t ident, int mflag) |
static void | kqueue_task (void *arg, int pending) |
static int | kqueue_scan (struct kqueue *kq, int maxevents, struct kevent_copyops *k_ops, const struct timespec *timeout, struct kevent *keva, struct thread *td) |
static void | kqueue_wakeup (struct kqueue *kq) |
static struct filterops * | kqueue_fo_find (int filt) |
static void | kqueue_fo_release (int filt) |
static int | kern_kevent_generic (struct thread *td, struct g_kevent_args *uap, struct kevent_copyops *k_ops, const char *struct_name) |
static int | knote_attach (struct knote *kn, struct kqueue *kq) |
static void | knote_drop (struct knote *kn, struct thread *td) |
static void | knote_drop_detached (struct knote *kn, struct thread *td) |
static void | knote_enqueue (struct knote *kn) |
static void | knote_dequeue (struct knote *kn) |
static void | knote_init (void) |
static struct knote * | knote_alloc (int mflag) |
static void | knote_free (struct knote *kn) |
static void | filt_kqdetach (struct knote *kn) |
static int | filt_kqueue (struct knote *kn, long hint) |
static int | filt_procattach (struct knote *kn) |
static void | filt_procdetach (struct knote *kn) |
static int | filt_proc (struct knote *kn, long hint) |
static int | filt_fileattach (struct knote *kn) |
static void | filt_timerexpire (void *knx) |
static void | filt_timerexpire_l (struct knote *kn, bool proc_locked) |
static int | filt_timerattach (struct knote *kn) |
static void | filt_timerdetach (struct knote *kn) |
static void | filt_timerstart (struct knote *kn, sbintime_t to) |
static void | filt_timertouch (struct knote *kn, struct kevent *kev, u_long type) |
static int | filt_timervalidate (struct knote *kn, sbintime_t *to) |
static int | filt_timer (struct knote *kn, long hint) |
static int | filt_userattach (struct knote *kn) |
static void | filt_userdetach (struct knote *kn) |
static int | filt_user (struct knote *kn, long hint) |
static void | filt_usertouch (struct knote *kn, struct kevent *kev, u_long type) |
SYSCTL_UINT (_kern, OID_AUTO, kq_calloutmax, CTLFLAG_RW, &kq_calloutmax, 0, "Maximum number of callouts allocated for kqueue") | |
static struct knlist * | kn_list_lock (struct knote *kn) |
static void | kn_list_unlock (struct knlist *knl) |
static bool | kn_in_flux (struct knote *kn) |
static void | kn_enter_flux (struct knote *kn) |
static bool | kn_leave_flux (struct knote *kn) |
static int | filt_nullattach (struct knote *kn) |
MTX_SYSINIT (kqueue_filterops, &filterops_lock, "protect sysfilt_ops", MTX_DEF) | |
static int | kqueue_kqfilter (struct file *fp, struct knote *kn) |
void | knote_fork (struct knlist *list, int pid) |
static sbintime_t | timer2sbintime (int64_t data, int flags) |
static void | kqtimer_sched_callout (struct kq_timer_cb_data *kc) |
void | kqtimer_proc_continue (struct proc *p) |
static void | filt_userdetach (__unused struct knote *kn) |
static int | filt_user (struct knote *kn, __unused long hint) |
int | sys_kqueue (struct thread *td, struct kqueue_args *uap) |
static void | kqueue_init (struct kqueue *kq) |
int | kern_kqueue (struct thread *td, int flags, struct filecaps *fcaps) |
int | sys_kevent (struct thread *td, struct kevent_args *uap) |
int | kern_kevent (struct thread *td, int fd, int nchanges, int nevents, struct kevent_copyops *k_ops, const struct timespec *timeout) |
static int | kqueue_kevent (struct kqueue *kq, struct thread *td, int nchanges, int nevents, struct kevent_copyops *k_ops, const struct timespec *timeout) |
int | kern_kevent_fp (struct thread *td, struct file *fp, int nchanges, int nevents, struct kevent_copyops *k_ops, const struct timespec *timeout) |
int | kern_kevent_anonymous (struct thread *td, int nevents, struct kevent_copyops *k_ops) |
int | kqueue_add_filteropts (int filt, struct filterops *filtops) |
int | kqueue_del_filteropts (int filt) |
void | kqueue_drain_schedtask (void) |
static void | kqueue_schedtask (struct kqueue *kq) |
static int | kqueue_ioctl (struct file *fp, u_long cmd, void *data, struct ucred *active_cred, struct thread *td) |
static int | kqueue_poll (struct file *fp, int events, struct ucred *active_cred, struct thread *td) |
static int | kqueue_stat (struct file *fp, struct stat *st, struct ucred *active_cred) |
static int | kqueue_close (struct file *fp, struct thread *td) |
static int | kqueue_fill_kinfo (struct file *fp, struct kinfo_file *kif, struct filedesc *fdp) |
void | knote (struct knlist *list, long hint, int lockflags) |
void | knlist_add (struct knlist *knl, struct knote *kn, int islocked) |
static void | knlist_remove_kq (struct knlist *knl, struct knote *kn, int knlislocked, int kqislocked) |
void | knlist_remove (struct knlist *knl, struct knote *kn, int islocked) |
int | knlist_empty (struct knlist *knl) |
MTX_SYSINIT (knlist_lock, &knlist_lock, "knlist lock for lockless objects", MTX_DEF) | |
static void | knlist_mtx_lock (void *arg) |
static void | knlist_mtx_unlock (void *arg) |
static void | knlist_mtx_assert_lock (void *arg, int what) |
static void | knlist_rw_rlock (void *arg) |
static void | knlist_rw_runlock (void *arg) |
static void | knlist_rw_assert_lock (void *arg, int what) |
void | knlist_init (struct knlist *knl, void *lock, void(*kl_lock)(void *), void(*kl_unlock)(void *), void(*kl_assert_lock)(void *, int)) |
void | knlist_init_mtx (struct knlist *knl, struct mtx *lock) |
struct knlist * | knlist_alloc (struct mtx *lock) |
void | knlist_init_rw_reader (struct knlist *knl, struct rwlock *lock) |
void | knlist_destroy (struct knlist *knl) |
void | knlist_detach (struct knlist *knl) |
void | knlist_cleardel (struct knlist *knl, struct thread *td, int islocked, int killkn) |
void | knote_fdclose (struct thread *td, int fd) |
SYSINIT (knote, SI_SUB_PSEUDO, SI_ORDER_ANY, knote_init, NULL) | |
int | kqfd_register (int fd, struct kevent *kev, struct thread *td, int mflag) |
Variables | |
static struct mtx | kq_global |
static fo_ioctl_t | kqueue_ioctl |
static fo_poll_t | kqueue_poll |
static fo_kqfilter_t | kqueue_kqfilter |
static fo_stat_t | kqueue_stat |
static fo_close_t | kqueue_close |
static fo_fill_kinfo_t | kqueue_fill_kinfo |
static struct fileops | kqueueops |
static struct filterops | file_filtops |
static struct filterops | kqread_filtops |
static struct filterops | proc_filtops |
static struct filterops | timer_filtops |
static struct filterops | user_filtops |
static uma_zone_t | knote_zone |
static unsigned int __exclusive_cache_line | kq_ncallouts |
static unsigned int | kq_calloutmax = 4 * 1024 |
struct filterops | null_filtops |
struct filterops | sig_filtops |
struct filterops | fs_filtops |
static struct mtx | filterops_lock |
struct { | |
struct filterops * for_fop | |
int for_nolock | |
int for_refcnt | |
} | sysfilt_ops [EVFILT_SYSCOUNT] |
static struct mtx | knlist_lock |
Definition at line 323 of file kern_event.c.
#define KN_HASHSIZE 64 /* XXX should be tunable */ |
Definition at line 320 of file kern_event.c.
#define KNL_ASSERT_LOCK | ( | knl, | |
islocked | |||
) |
Definition at line 301 of file kern_event.c.
#define KNL_ASSERT_LOCKED | ( | knl | ) | do {} while (0) |
Definition at line 315 of file kern_event.c.
#define KNL_ASSERT_UNLOCKED | ( | knl | ) | do {} while (0) |
Definition at line 316 of file kern_event.c.
#define KNOTE_ACTIVATE | ( | kn, | |
islock | |||
) |
Definition at line 215 of file kern_event.c.
#define KQ_FLUX_WAKEUP | ( | kq | ) |
Definition at line 229 of file kern_event.c.
#define KQ_GLOBAL_LOCK | ( | lck, | |
haslck | |||
) |
Definition at line 90 of file kern_event.c.
#define KQ_GLOBAL_UNLOCK | ( | lck, | |
haslck | |||
) |
Definition at line 95 of file kern_event.c.
#define KQ_LOCK | ( | kq | ) |
Definition at line 226 of file kern_event.c.
#define KQ_NOTOWNED | ( | kq | ) |
Definition at line 245 of file kern_event.c.
#define KQ_OWNED | ( | kq | ) |
Definition at line 242 of file kern_event.c.
#define KQ_TIMER_CB_ENQUEUED 0x01 |
Definition at line 689 of file kern_event.c.
#define KQ_UNLOCK | ( | kq | ) |
Definition at line 239 of file kern_event.c.
#define KQ_UNLOCK_FLUX | ( | kq | ) |
Definition at line 235 of file kern_event.c.
#define MS_TO_SBT | ( | ms | ) | (((ms) * (((uint64_t)1 << 63) / 500)) >> 32) |
#define NOTE_TIMER_PRECMASK (NOTE_SECONDS | NOTE_MSECONDS | NOTE_USECONDS | NOTE_NSECONDS) |
Definition at line 619 of file kern_event.c.
#define NS_TO_SBT | ( | ns | ) | (((ns) * (((uint64_t)1 << 63) / 500000000)) >> 32) |
#define US_TO_SBT | ( | us | ) | (((us) * (((uint64_t)1 << 63) / 500000)) >> 32) |
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 372 of file kern_event.c.
|
static |
Definition at line 395 of file kern_event.c.
References knlist_remove().
|
static |
Definition at line 404 of file kern_event.c.
|
static |
Definition at line 326 of file kern_event.c.
|
static |
Definition at line 492 of file kern_event.c.
Referenced by filt_procattach().
|
static |
Definition at line 414 of file kern_event.c.
References filt_proc(), knlist_add(), KNOTE_ACTIVATE, p_cansee(), pfind(), and pfind_any().
|
static |
Definition at line 483 of file kern_event.c.
References knlist_remove().
|
static |
Definition at line 960 of file kern_event.c.
|
static |
Definition at line 812 of file kern_event.c.
References kq_timer_cb_data::c, callout_init(), kq_timer_cb_data::cpuid, filt_timerstart(), filt_timervalidate(), kq_timer_cb_data::flags, kq_timer_cb_data::kn, kq_calloutmax, kq_ncallouts, malloc(), and kq_timer_cb_data::p.
|
static |
Definition at line 864 of file kern_event.c.
References kq_timer_cb_data::c, kq_timer_cb_data::flags, free(), kq_timer_cb_data::kn, kq_ncallouts, KQ_TIMER_CB_ENQUEUED, and kq_timer_cb_data::p.
|
static |
Definition at line 775 of file kern_event.c.
References filt_timerexpire_l().
Referenced by kqtimer_sched_callout().
|
static |
Definition at line 721 of file kern_event.c.
References kq_timer_cb_data::flags, KNOTE_ACTIVATE, KQ_TIMER_CB_ENQUEUED, kqtimer_sched_callout(), and kq_timer_cb_data::p.
Referenced by filt_timerexpire(), and kqtimer_proc_continue().
|
static |
Definition at line 848 of file kern_event.c.
References kq_timer_cb_data::kn, and kqtimer_sched_callout().
Referenced by filt_timerattach(), and filt_timertouch().
|
static |
Definition at line 893 of file kern_event.c.
References kq_timer_cb_data::c, filt_timerstart(), filt_timervalidate(), knote_dequeue(), KQ_LOCK, KQ_UNLOCK, panic(), and type.
|
static |
Definition at line 784 of file kern_event.c.
References bintime(), bt, getboottimebin(), NOTE_TIMER_PRECMASK, and timer2sbintime().
Referenced by filt_timerattach(), and filt_timertouch().
|
static |
Definition at line 991 of file kern_event.c.
|
static |
|
static |
Definition at line 967 of file kern_event.c.
|
static |
Definition at line 982 of file kern_event.c.
|
static |
|
static |
int kern_kevent | ( | struct thread * | td, |
int | fd, | ||
int | nchanges, | ||
int | nevents, | ||
struct kevent_copyops * | k_ops, | ||
const struct timespec * | timeout | ||
) |
Definition at line 1290 of file kern_event.c.
References fd, fget(), and kern_kevent_fp().
Referenced by kern_kevent_generic().
int kern_kevent_anonymous | ( | struct thread * | td, |
int | nevents, | ||
struct kevent_copyops * | k_ops | ||
) |
Definition at line 1376 of file kern_event.c.
References kqueue_destroy(), kqueue_drain(), kqueue_init(), and kqueue_kevent().
int kern_kevent_fp | ( | struct thread * | td, |
struct file * | fp, | ||
int | nchanges, | ||
int | nevents, | ||
struct kevent_copyops * | k_ops, | ||
const struct timespec * | timeout | ||
) |
Definition at line 1357 of file kern_event.c.
References kqueue_acquire(), kqueue_kevent(), and kqueue_release().
Referenced by kern_kevent().
|
static |
Definition at line 1139 of file kern_event.c.
References g_kevent_args::changelist, g_kevent_args::eventlist, g_kevent_args::fd, kern_kevent(), g_kevent_args::nchanges, g_kevent_args::nevents, g_kevent_args::timeout, and ts.
Referenced by sys_kevent().
int kern_kqueue | ( | struct thread * | td, |
int | flags, | ||
struct filecaps * | fcaps | ||
) |
Definition at line 1072 of file kern_event.c.
References chgkqcnt(), crhold(), falloc_caps(), fd, finit(), flags, kqueue_init(), kqueueops, lim_cur(), and malloc().
Referenced by sys_kqueue().
|
static |
Definition at line 1196 of file kern_event.c.
References count.
Referenced by sys_kevent().
|
static |
Definition at line 1178 of file kern_event.c.
References count.
Referenced by sys_kevent().
|
static |
Definition at line 283 of file kern_event.c.
References KQ_OWNED.
Referenced by knlist_cleardel(), knote(), knote_fdclose(), knote_fork(), kqueue_drain(), kqueue_register(), and kqueue_scan().
|
static |
Definition at line 276 of file kern_event.c.
Referenced by knlist_add(), knlist_cleardel(), knlist_remove_kq(), knote(), knote_attach(), knote_fdclose(), knote_fork(), kqueue_drain(), kqueue_register(), and kqueue_scan().
|
static |
Definition at line 292 of file kern_event.c.
References KQ_OWNED.
Referenced by knote(), knote_fork(), kqueue_register(), and kqueue_scan().
|
static |
Definition at line 250 of file kern_event.c.
Referenced by kqueue_register(), and kqueue_scan().
|
static |
Definition at line 261 of file kern_event.c.
References free(), knlist_destroy(), and knlist_empty().
Referenced by knlist_remove_kq(), kqueue_register(), and kqueue_scan().
void knlist_add | ( | struct knlist * | knl, |
struct knote * | kn, | ||
int | islocked | ||
) |
Definition at line 2420 of file kern_event.c.
References kn_in_flux(), KNL_ASSERT_LOCK, KQ_LOCK, KQ_NOTOWNED, and KQ_UNLOCK.
Referenced by devkqfilter(), eventfd_kqfilter(), filt_aioattach(), filt_fsattach(), filt_lioattach(), filt_procattach(), filt_sigattach(), kqueue_kqfilter(), logkqfilter(), mqf_kqfilter(), pipe_kqfilter(), procdesc_kqfilter(), ptsdev_kqfilter(), soo_kqfilter(), ttydev_kqfilter(), and vfs_kqfilter().
struct knlist * knlist_alloc | ( | struct mtx * | lock | ) |
Definition at line 2571 of file kern_event.c.
References knlist_init_mtx(), and malloc().
Referenced by fork1(), and proc0_init().
void knlist_cleardel | ( | struct knlist * | knl, |
struct thread * | td, | ||
int | islocked, | ||
int | killkn | ||
) |
Definition at line 2613 of file kern_event.c.
References kn_enter_flux(), kn_in_flux(), KNL_ASSERT_LOCKED, KNL_ASSERT_UNLOCKED, knlist_remove_kq(), knote(), knote_drop_detached(), KQ_LOCK, and KQ_UNLOCK.
void knlist_destroy | ( | struct knlist * | knl | ) |
Definition at line 2589 of file kern_event.c.
Referenced by destroy_vpollinfo_free(), eventfd_close(), kn_list_unlock(), knlist_detach(), kqueue_destroy(), mqueue_free(), pipe_paircreate(), pipeclose(), procdesc_free(), ptsdrv_free(), sofree(), and tty_dealloc().
void knlist_detach | ( | struct knlist * | knl | ) |
Definition at line 2597 of file kern_event.c.
References free(), KNL_ASSERT_LOCKED, knlist_destroy(), and knlist_empty().
Referenced by proc_reap().
int knlist_empty | ( | struct knlist * | knl | ) |
Definition at line 2474 of file kern_event.c.
References KNL_ASSERT_LOCKED.
Referenced by filt_aiodetach(), filt_liodetach(), filt_sordetach(), filt_sowdetach(), kn_list_unlock(), knlist_detach(), kqueue_drain(), and kqueue_wakeup().
void knlist_init | ( | struct knlist * | knl, |
void * | lock, | ||
void(*)(void *) | kl_lock, | ||
void(*)(void *) | kl_unlock, | ||
void(*)(void *, int) | kl_assert_lock | ||
) |
Definition at line 2536 of file kern_event.c.
References knlist_lock, knlist_mtx_assert_lock(), knlist_mtx_lock(), and knlist_mtx_unlock().
Referenced by knlist_init_mtx(), knlist_init_rw_reader(), socreate(), sonewconn(), and v_addpollinfo().
void knlist_init_mtx | ( | struct knlist * | knl, |
struct mtx * | lock | ||
) |
Definition at line 2564 of file kern_event.c.
References knlist_init().
Referenced by aio_aqueue(), devinit(), eventfd_create_file(), kern_lio_listio(), knlist_alloc(), kqueue_init(), log_drvinit(), mqueue_alloc(), pipe_paircreate(), procdesc_new(), pts_alloc(), pts_alloc_external(), tty_alloc_mutex(), and vfs_event_init().
void knlist_init_rw_reader | ( | struct knlist * | knl, |
struct rwlock * | lock | ||
) |
Definition at line 2581 of file kern_event.c.
References knlist_init(), knlist_rw_assert_lock(), knlist_rw_rlock(), and knlist_rw_runlock().
|
static |
Definition at line 2502 of file kern_event.c.
References mtx.
Referenced by knlist_init().
|
static |
Definition at line 2488 of file kern_event.c.
References mtx.
Referenced by knlist_init().
|
static |
Definition at line 2495 of file kern_event.c.
References mtx.
Referenced by knlist_init().
void knlist_remove | ( | struct knlist * | knl, |
struct knote * | kn, | ||
int | islocked | ||
) |
Definition at line 2467 of file kern_event.c.
References knlist_remove_kq().
Referenced by filt_aiodetach(), filt_devctl_detach(), filt_eventfddetach(), filt_fsdetach(), filt_kqdetach(), filt_liodetach(), filt_mqdetach(), filt_pipedetach(), filt_procdetach(), filt_sigdetach(), filt_sordetach(), filt_sowdetach(), filt_vfsdetach(), logkqdetach(), procdesc_kqops_detach(), pts_kqops_read_detach(), pts_kqops_write_detach(), tty_kqops_read_detach(), and tty_kqops_write_detach().
|
static |
Definition at line 2440 of file kern_event.c.
References kn_in_flux(), kn_list_unlock(), KNL_ASSERT_LOCK, knote(), KQ_LOCK, and KQ_UNLOCK.
Referenced by knlist_cleardel(), and knlist_remove().
|
static |
Definition at line 2526 of file kern_event.c.
Referenced by knlist_init_rw_reader().
|
static |
Definition at line 2512 of file kern_event.c.
Referenced by knlist_init_rw_reader().
|
static |
Definition at line 2519 of file kern_event.c.
Referenced by knlist_init_rw_reader().
void knote | ( | struct knlist * | list, |
long | hint, | ||
int | lockflags | ||
) |
Definition at line 2363 of file kern_event.c.
References kn_enter_flux(), kn_in_flux(), kn_leave_flux(), KNL_ASSERT_LOCK, knote(), KNOTE_ACTIVATE, KQ_LOCK, KQ_UNLOCK, and KQ_UNLOCK_FLUX.
Referenced by knlist_cleardel(), knlist_remove_kq(), knote(), knote_drop_detached(), knote_fdclose(), knote_fork(), knote_init(), kqueue_drain(), kqueue_register(), kqueue_scan(), and vfs_kqfilter().
|
static |
Definition at line 2817 of file kern_event.c.
References knote_zone.
Referenced by kqueue_register(), and kqueue_scan().
|
static |
Definition at line 2713 of file kern_event.c.
References KN_HASH, kn_in_flux(), and KQ_OWNED.
Referenced by kqueue_register().
|
static |
Definition at line 2795 of file kern_event.c.
References KQ_OWNED.
Referenced by filt_timertouch(), and knote_drop_detached().
|
static |
Definition at line 2736 of file kern_event.c.
References knote_drop_detached().
Referenced by knote_fdclose(), kqueue_drain(), kqueue_register(), and kqueue_scan().
|
static |
Definition at line 2745 of file kern_event.c.
References KN_HASH, knote(), knote_dequeue(), knote_free(), KQ_LOCK, KQ_NOTOWNED, KQ_UNLOCK_FLUX, and kqueue_fo_release().
Referenced by knlist_cleardel(), knote_drop(), and kqueue_register().
|
static |
Definition at line 2781 of file kern_event.c.
References KQ_OWNED, and kqueue_wakeup().
Referenced by kqueue_register().
void knote_fdclose | ( | struct thread * | td, |
int | fd | ||
) |
Definition at line 2674 of file kern_event.c.
References fd, kn_enter_flux(), kn_in_flux(), knote(), knote_drop(), KQ_LOCK, KQ_UNLOCK, KQ_UNLOCK_FLUX, and wakeup().
Referenced by closefp_impl(), and fdsetugidsafety().
void knote_fork | ( | struct knlist * | list, |
int | pid | ||
) |
Definition at line 531 of file kern_event.c.
References kn_enter_flux(), kn_in_flux(), kn_leave_flux(), KNL_ASSERT_LOCKED, knote(), KNOTE_ACTIVATE, KQ_LOCK, KQ_UNLOCK, KQ_UNLOCK_FLUX, and kqueue_register().
Referenced by do_fork().
|
static |
Definition at line 2824 of file kern_event.c.
References knote_zone.
Referenced by knote_drop_detached(), kqueue_register(), and kqueue_scan().
|
static |
Definition at line 2808 of file kern_event.c.
References knote(), and knote_zone.
int kqfd_register | ( | int | fd, |
struct kevent * | kev, | ||
struct thread * | td, | ||
int | mflag | ||
) |
Definition at line 2834 of file kern_event.c.
References fd, fget(), kqueue_acquire(), kqueue_register(), and kqueue_release().
Referenced by aio_aqueue(), and kern_lio_listio().
void kqtimer_proc_continue | ( | struct proc * | p | ) |
Definition at line 699 of file kern_event.c.
References bintime(), bt, filt_timerexpire_l(), kq_timer_cb_data::flags, getboottimebin(), kq_timer_cb_data::kn, and kqtimer_sched_callout().
Referenced by ptrace_unsuspend(), and tdsendsignal().
|
static |
Definition at line 692 of file kern_event.c.
References kq_timer_cb_data::c, callout_reset_sbt_on(), kq_timer_cb_data::cpuid, filt_timerexpire(), and kq_timer_cb_data::kn.
Referenced by filt_timerexpire_l(), filt_timerstart(), and kqtimer_proc_continue().
|
static |
Definition at line 1749 of file kern_event.c.
References KQ_LOCK, and KQ_UNLOCK.
Referenced by kern_kevent_fp(), kqfd_register(), kqueue_close(), and kqueue_poll().
int kqueue_add_filteropts | ( | int | filt, |
struct filterops * | filtops | ||
) |
Definition at line 1391 of file kern_event.c.
References filterops_lock, for_fop, null_filtops, printf(), and sysfilt_ops.
Referenced by aio_onceonly().
|
static |
Definition at line 2288 of file kern_event.c.
References chgkqcnt(), crfree(), free(), kqueue_acquire(), kqueue_destroy(), and kqueue_drain().
int kqueue_del_filteropts | ( | int | filt | ) |
Definition at line 1416 of file kern_event.c.
References filterops_lock, for_fop, for_refcnt, null_filtops, and sysfilt_ops.
|
static |
Definition at line 2269 of file kern_event.c.
References free(), funsetown(), knlist_destroy(), and seldrain().
Referenced by kern_kevent_anonymous(), and kqueue_close().
|
static |
Definition at line 2206 of file kern_event.c.
References kn_enter_flux(), kn_in_flux(), knlist_empty(), knote(), knote_drop(), KQ_LOCK, KQ_UNLOCK, and selwakeuppri().
Referenced by kern_kevent_anonymous(), and kqueue_close().
void kqueue_drain_schedtask | ( | void | ) |
Definition at line 1786 of file kern_event.c.
References taskqueue_quiesce().
Referenced by ast().
|
static |
Definition at line 1816 of file kern_event.c.
References fd, free(), hashinit_flags(), KN_HASHSIZE, KQ_LOCK, KQ_NOTOWNED, KQ_UNLOCK, and malloc().
Referenced by kqueue_register().
|
static |
Definition at line 2326 of file kern_event.c.
|
static |
Definition at line 1440 of file kern_event.c.
References filterops_lock, for_fop, for_nolock, null_filtops, and sysfilt_ops.
Referenced by kqueue_register().
|
static |
Definition at line 1459 of file kern_event.c.
References filterops_lock, for_nolock, for_refcnt, and sysfilt_ops.
Referenced by knote_drop_detached(), and kqueue_register().
|
static |
Definition at line 1062 of file kern_event.c.
References knlist_init_mtx(), and kqueue_task().
Referenced by kern_kevent_anonymous(), and kern_kqueue().
|
static |
Definition at line 2115 of file kern_event.c.
References data, fgetown(), and fsetown().
|
static |
Definition at line 1313 of file kern_event.c.
References kqueue_register(), and kqueue_scan().
Referenced by kern_kevent_anonymous(), and kern_kevent_fp().
|
static |
Definition at line 380 of file kern_event.c.
References knlist_add(), and kqread_filtops.
|
static |
Definition at line 2163 of file kern_event.c.
References KQ_LOCK, KQ_UNLOCK, kqueue_acquire(), kqueue_release(), and selrecord().
|
static |
Definition at line 1479 of file kern_event.c.
References cap_event_rights, fget(), kn_enter_flux(), KN_HASH, kn_in_flux(), kn_leave_flux(), kn_list_lock(), kn_list_unlock(), knote(), KNOTE_ACTIVATE, knote_alloc(), knote_attach(), knote_drop(), knote_drop_detached(), knote_enqueue(), knote_free(), kq_global, KQ_GLOBAL_LOCK, KQ_GLOBAL_UNLOCK, KQ_LOCK, KQ_UNLOCK, KQ_UNLOCK_FLUX, kqueue_expand(), kqueue_fo_find(), and kqueue_fo_release().
Referenced by knote_fork(), kqfd_register(), and kqueue_kevent().
|
static |
Definition at line 1772 of file kern_event.c.
References KQ_LOCK, KQ_OWNED, KQ_UNLOCK, and wakeup().
Referenced by kern_kevent_fp(), kqfd_register(), and kqueue_poll().
|
static |
Definition at line 1910 of file kern_event.c.
References count, kn_enter_flux(), kn_in_flux(), kn_leave_flux(), kn_list_lock(), kn_list_unlock(), knote(), knote_alloc(), knote_drop(), knote_free(), KQ_FLUX_WAKEUP, kq_global, KQ_GLOBAL_LOCK, KQ_GLOBAL_UNLOCK, KQ_LOCK, KQ_NOTOWNED, KQ_OWNED, KQ_UNLOCK, KQ_UNLOCK_FLUX, tc_precexp, and tc_tick_sbt.
Referenced by kqueue_kevent().
|
static |
Definition at line 1792 of file kern_event.c.
References KQ_OWNED, and taskqueue_enqueue().
Referenced by kqueue_wakeup().
|
static |
Definition at line 2190 of file kern_event.c.
References st.
|
static |
Definition at line 1884 of file kern_event.c.
References kq_global, KQ_GLOBAL_LOCK, KQ_GLOBAL_UNLOCK, KQ_LOCK, KQ_UNLOCK, and wakeup().
Referenced by kqueue_init().
|
static |
Definition at line 2334 of file kern_event.c.
References knlist_empty(), KQ_OWNED, kqueue_schedtask(), pgsigio(), selwakeuppri(), and wakeup().
Referenced by knote_enqueue().
|
static |
MTX_SYSINIT | ( | knlist_lock | , |
& | knlist_lock, | ||
"knlist lock for lockless objects" | , | ||
MTX_DEF | |||
) |
MTX_SYSINIT | ( | kq_global | , |
& | kq_global, | ||
"kqueue order" | , | ||
MTX_DEF | |||
) |
MTX_SYSINIT | ( | kqueue_filterops | , |
& | filterops_lock, | ||
"protect sysfilt_ops" | , | ||
MTX_DEF | |||
) |
int sys_kevent | ( | struct thread * | td, |
struct kevent_args * | uap | ||
) |
Definition at line 1118 of file kern_event.c.
References g_kevent_args::fd, kern_kevent_generic(), kevent_copyin(), and kevent_copyout().
int sys_kqueue | ( | struct thread * | td, |
struct kqueue_args * | uap | ||
) |
Definition at line 1055 of file kern_event.c.
References kern_kqueue().
SYSCTL_UINT | ( | _kern | , |
OID_AUTO | , | ||
kq_calloutmax | , | ||
CTLFLAG_RW | , | ||
& | kq_calloutmax, | ||
0 | , | ||
"Maximum number of callouts allocated for kqueue" | |||
) |
SYSINIT | ( | knote | , |
SI_SUB_PSEUDO | , | ||
SI_ORDER_ANY | , | ||
knote_init | , | ||
NULL | |||
) |
TASKQUEUE_DEFINE_THREAD | ( | kqueue_ctx | ) |
|
static |
Definition at line 623 of file kern_event.c.
References data, flags, MS_TO_SBT, NOTE_TIMER_PRECMASK, NS_TO_SBT, and US_TO_SBT.
Referenced by filt_timervalidate().
|
static |
Definition at line 178 of file kern_event.c.
|
static |
Definition at line 344 of file kern_event.c.
Referenced by kqueue_add_filteropts(), kqueue_del_filteropts(), kqueue_fo_find(), and kqueue_fo_release().
struct filterops* for_fop |
Definition at line 348 of file kern_event.c.
Referenced by kqueue_add_filteropts(), kqueue_del_filteropts(), and kqueue_fo_find().
int for_nolock |
Definition at line 349 of file kern_event.c.
Referenced by kqueue_fo_find(), and kqueue_fo_release().
int for_refcnt |
Definition at line 350 of file kern_event.c.
Referenced by kqueue_del_filteropts(), and kqueue_fo_release().
|
extern |
Definition at line 6145 of file vfs_subr.c.
|
static |
Definition at line 2481 of file kern_event.c.
Referenced by knlist_init().
|
static |
Definition at line 208 of file kern_event.c.
Referenced by knote_alloc(), knote_free(), and knote_init().
|
static |
Definition at line 210 of file kern_event.c.
Referenced by filt_timerattach().
|
static |
Definition at line 88 of file kern_event.c.
Referenced by kqueue_register(), kqueue_scan(), and kqueue_task().
|
static |
Definition at line 209 of file kern_event.c.
Referenced by filt_timerattach(), and filt_timerdetach().
|
static |
Definition at line 182 of file kern_event.c.
Referenced by kqueue_kqfilter().
|
static |
Definition at line 130 of file kern_event.c.
|
static |
Definition at line 131 of file kern_event.c.
|
static |
Definition at line 126 of file kern_event.c.
|
static |
Definition at line 128 of file kern_event.c.
|
static |
Definition at line 127 of file kern_event.c.
|
static |
Definition at line 129 of file kern_event.c.
|
static |
Definition at line 133 of file kern_event.c.
Referenced by kern_kqueue().
struct filterops null_filtops |
Definition at line 332 of file kern_event.c.
Referenced by kqueue_add_filteropts(), kqueue_del_filteropts(), and kqueue_fo_find().
|
static |
Definition at line 188 of file kern_event.c.
|
extern |
Definition at line 121 of file kern_sig.c.
struct { ... } sysfilt_ops[EVFILT_SYSCOUNT] |
Referenced by kqueue_add_filteropts(), kqueue_del_filteropts(), kqueue_fo_find(), and kqueue_fo_release().
|
static |
Definition at line 194 of file kern_event.c.
|
static |
Definition at line 201 of file kern_event.c.