FreeBSD kernel kern code
kern_event.c File Reference
#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>
Include dependency graph for kern_event.c:

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 knoteknote_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
 

Macro Definition Documentation

◆ KN_HASH

#define KN_HASH (   val,
  mask 
)    (((val) ^ (val >> 8)) & (mask))

Definition at line 323 of file kern_event.c.

◆ KN_HASHSIZE

#define KN_HASHSIZE   64 /* XXX should be tunable */

Definition at line 320 of file kern_event.c.

◆ KNL_ASSERT_LOCK

#define KNL_ASSERT_LOCK (   knl,
  islocked 
)
Value:
do { \
if (islocked) \
KNL_ASSERT_LOCKED(knl); \
} while (0)
#define KNL_ASSERT_UNLOCKED(knl)
Definition: kern_event.c:316

Definition at line 301 of file kern_event.c.

◆ KNL_ASSERT_LOCKED

#define KNL_ASSERT_LOCKED (   knl)    do {} while (0)

Definition at line 315 of file kern_event.c.

◆ KNL_ASSERT_UNLOCKED

#define KNL_ASSERT_UNLOCKED (   knl)    do {} while (0)

Definition at line 316 of file kern_event.c.

◆ KNOTE_ACTIVATE

#define KNOTE_ACTIVATE (   kn,
  islock 
)
Value:
do { \
if ((islock)) \
mtx_assert(&(kn)->kn_kq->kq_lock, MA_OWNED); \
KQ_LOCK((kn)->kn_kq); \
(kn)->kn_status |= KN_ACTIVE; \
if (((kn)->kn_status & (KN_QUEUED | KN_DISABLED)) == 0) \
knote_enqueue((kn)); \
if (!(islock)) \
KQ_UNLOCK((kn)->kn_kq); \
} while (0)
#define KQ_LOCK(kq)
Definition: kern_event.c:226

Definition at line 215 of file kern_event.c.

◆ KQ_FLUX_WAKEUP

#define KQ_FLUX_WAKEUP (   kq)
Value:
do { \
if (((kq)->kq_state & KQ_FLUXWAIT) == KQ_FLUXWAIT) { \
(kq)->kq_state &= ~KQ_FLUXWAIT; \
wakeup((kq)); \
} \
} while (0)

Definition at line 229 of file kern_event.c.

◆ KQ_GLOBAL_LOCK

#define KQ_GLOBAL_LOCK (   lck,
  haslck 
)
Value:
do { \
if (!haslck) \
mtx_lock(lck); \
haslck = 1; \
} while (0)

Definition at line 90 of file kern_event.c.

◆ KQ_GLOBAL_UNLOCK

#define KQ_GLOBAL_UNLOCK (   lck,
  haslck 
)
Value:
do { \
if (haslck) \
mtx_unlock(lck); \
haslck = 0; \
} while (0)

Definition at line 95 of file kern_event.c.

◆ KQ_LOCK

#define KQ_LOCK (   kq)
Value:
do { \
mtx_lock(&(kq)->kq_lock); \
} while (0)

Definition at line 226 of file kern_event.c.

◆ KQ_NOTOWNED

#define KQ_NOTOWNED (   kq)
Value:
do { \
mtx_assert(&(kq)->kq_lock, MA_NOTOWNED); \
} while (0)

Definition at line 245 of file kern_event.c.

◆ KQ_OWNED

#define KQ_OWNED (   kq)
Value:
do { \
mtx_assert(&(kq)->kq_lock, MA_OWNED); \
} while (0)

Definition at line 242 of file kern_event.c.

◆ KQ_TIMER_CB_ENQUEUED

#define KQ_TIMER_CB_ENQUEUED   0x01

Definition at line 689 of file kern_event.c.

◆ KQ_UNLOCK

#define KQ_UNLOCK (   kq)
Value:
do { \
mtx_unlock(&(kq)->kq_lock); \
} while (0)

Definition at line 239 of file kern_event.c.

◆ KQ_UNLOCK_FLUX

#define KQ_UNLOCK_FLUX (   kq)
Value:
do { \
KQ_FLUX_WAKEUP(kq); \
mtx_unlock(&(kq)->kq_lock); \
} while (0)

Definition at line 235 of file kern_event.c.

◆ MS_TO_SBT

#define MS_TO_SBT (   ms)    (((ms) * (((uint64_t)1 << 63) / 500)) >> 32)

◆ NOTE_TIMER_PRECMASK

#define NOTE_TIMER_PRECMASK    (NOTE_SECONDS | NOTE_MSECONDS | NOTE_USECONDS | NOTE_NSECONDS)

Definition at line 619 of file kern_event.c.

◆ NS_TO_SBT

#define NS_TO_SBT (   ns)    (((ns) * (((uint64_t)1 << 63) / 500000000)) >> 32)

◆ US_TO_SBT

#define US_TO_SBT (   us)    (((us) * (((uint64_t)1 << 63) / 500000)) >> 32)

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ filt_fileattach()

static int filt_fileattach ( struct knote kn)
static

Definition at line 372 of file kern_event.c.

◆ filt_kqdetach()

static void filt_kqdetach ( struct knote kn)
static

Definition at line 395 of file kern_event.c.

References knlist_remove().

Here is the call graph for this function:

◆ filt_kqueue()

static int filt_kqueue ( struct knote kn,
long  hint 
)
static

Definition at line 404 of file kern_event.c.

◆ filt_nullattach()

static int filt_nullattach ( struct knote kn)
static

Definition at line 326 of file kern_event.c.

◆ filt_proc()

static int filt_proc ( struct knote kn,
long  hint 
)
static

Definition at line 492 of file kern_event.c.

Referenced by filt_procattach().

Here is the caller graph for this function:

◆ filt_procattach()

static int filt_procattach ( struct knote kn)
static

Definition at line 414 of file kern_event.c.

References filt_proc(), knlist_add(), KNOTE_ACTIVATE, p_cansee(), pfind(), and pfind_any().

Here is the call graph for this function:

◆ filt_procdetach()

static void filt_procdetach ( struct knote kn)
static

Definition at line 483 of file kern_event.c.

References knlist_remove().

Here is the call graph for this function:

◆ filt_timer()

static int filt_timer ( struct knote kn,
long  hint 
)
static

Definition at line 960 of file kern_event.c.

◆ filt_timerattach()

static int filt_timerattach ( struct knote kn)
static

◆ filt_timerdetach()

static void filt_timerdetach ( struct knote kn)
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.

Here is the call graph for this function:

◆ filt_timerexpire()

static void filt_timerexpire ( void *  knx)
static

Definition at line 775 of file kern_event.c.

References filt_timerexpire_l().

Referenced by kqtimer_sched_callout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filt_timerexpire_l()

static void filt_timerexpire_l ( struct knote kn,
bool  proc_locked 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filt_timerstart()

static void filt_timerstart ( struct knote kn,
sbintime_t  to 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filt_timertouch()

static void filt_timertouch ( struct knote kn,
struct kevent *  kev,
u_long  type 
)
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.

Here is the call graph for this function:

◆ filt_timervalidate()

static int filt_timervalidate ( struct knote kn,
sbintime_t *  to 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filt_user() [1/2]

static int filt_user ( struct knote kn,
__unused long  hint 
)
static

Definition at line 991 of file kern_event.c.

◆ filt_user() [2/2]

static int filt_user ( struct knote kn,
long  hint 
)
static

◆ filt_userattach()

static int filt_userattach ( struct knote kn)
static

Definition at line 967 of file kern_event.c.

◆ filt_userdetach() [1/2]

static void filt_userdetach ( __unused struct knote kn)
static

Definition at line 982 of file kern_event.c.

◆ filt_userdetach() [2/2]

static void filt_userdetach ( struct knote kn)
static

◆ filt_usertouch()

static void filt_usertouch ( struct knote kn,
struct kevent *  kev,
u_long  type 
)
static

Definition at line 998 of file kern_event.c.

References panic(), and type.

Here is the call graph for this function:

◆ kern_kevent()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_kevent_anonymous()

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().

Here is the call graph for this function:

◆ kern_kevent_fp()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_kevent_generic()

static int kern_kevent_generic ( struct thread *  td,
struct g_kevent_args uap,
struct kevent_copyops *  k_ops,
const char *  struct_name 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_kqueue()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kevent_copyin()

static int kevent_copyin ( void *  arg,
struct kevent *  kevp,
int  count 
)
static

Definition at line 1196 of file kern_event.c.

References count.

Referenced by sys_kevent().

Here is the caller graph for this function:

◆ kevent_copyout()

static int kevent_copyout ( void *  arg,
struct kevent *  kevp,
int  count 
)
static

Definition at line 1178 of file kern_event.c.

References count.

Referenced by sys_kevent().

Here is the caller graph for this function:

◆ kn_enter_flux()

static void kn_enter_flux ( struct knote kn)
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().

Here is the caller graph for this function:

◆ kn_in_flux()

static bool kn_in_flux ( struct knote kn)
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().

Here is the caller graph for this function:

◆ kn_leave_flux()

static bool kn_leave_flux ( struct knote kn)
static

Definition at line 292 of file kern_event.c.

References KQ_OWNED.

Referenced by knote(), knote_fork(), kqueue_register(), and kqueue_scan().

Here is the caller graph for this function:

◆ kn_list_lock()

static struct knlist * kn_list_lock ( struct knote kn)
static

Definition at line 250 of file kern_event.c.

Referenced by kqueue_register(), and kqueue_scan().

Here is the caller graph for this function:

◆ kn_list_unlock()

static void kn_list_unlock ( struct knlist *  knl)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knlist_add()

void knlist_add ( struct knlist *  knl,
struct knote kn,
int  islocked 
)

◆ knlist_alloc()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knlist_cleardel()

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.

Here is the call graph for this function:

◆ knlist_destroy()

void knlist_destroy ( struct knlist *  knl)

◆ knlist_detach()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knlist_empty()

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().

Here is the caller graph for this function:

◆ knlist_init()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knlist_init_mtx()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knlist_init_rw_reader()

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().

Here is the call graph for this function:

◆ knlist_mtx_assert_lock()

static void knlist_mtx_assert_lock ( void *  arg,
int  what 
)
static

Definition at line 2502 of file kern_event.c.

References mtx.

Referenced by knlist_init().

Here is the caller graph for this function:

◆ knlist_mtx_lock()

static void knlist_mtx_lock ( void *  arg)
static

Definition at line 2488 of file kern_event.c.

References mtx.

Referenced by knlist_init().

Here is the caller graph for this function:

◆ knlist_mtx_unlock()

static void knlist_mtx_unlock ( void *  arg)
static

Definition at line 2495 of file kern_event.c.

References mtx.

Referenced by knlist_init().

Here is the caller graph for this function:

◆ knlist_remove()

void knlist_remove ( struct knlist *  knl,
struct knote kn,
int  islocked 
)

◆ knlist_remove_kq()

static void knlist_remove_kq ( struct knlist *  knl,
struct knote kn,
int  knlislocked,
int  kqislocked 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knlist_rw_assert_lock()

static void knlist_rw_assert_lock ( void *  arg,
int  what 
)
static

Definition at line 2526 of file kern_event.c.

Referenced by knlist_init_rw_reader().

Here is the caller graph for this function:

◆ knlist_rw_rlock()

static void knlist_rw_rlock ( void *  arg)
static

Definition at line 2512 of file kern_event.c.

Referenced by knlist_init_rw_reader().

Here is the caller graph for this function:

◆ knlist_rw_runlock()

static void knlist_rw_runlock ( void *  arg)
static

Definition at line 2519 of file kern_event.c.

Referenced by knlist_init_rw_reader().

Here is the caller graph for this function:

◆ knote()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knote_alloc()

static struct knote * knote_alloc ( int  mflag)
static

Definition at line 2817 of file kern_event.c.

References knote_zone.

Referenced by kqueue_register(), and kqueue_scan().

Here is the caller graph for this function:

◆ knote_attach()

static int knote_attach ( struct knote kn,
struct kqueue *  kq 
)
static

Definition at line 2713 of file kern_event.c.

References KN_HASH, kn_in_flux(), and KQ_OWNED.

Referenced by kqueue_register().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knote_dequeue()

static void knote_dequeue ( struct knote kn)
static

Definition at line 2795 of file kern_event.c.

References KQ_OWNED.

Referenced by filt_timertouch(), and knote_drop_detached().

Here is the caller graph for this function:

◆ knote_drop()

static void knote_drop ( struct knote kn,
struct thread *  td 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knote_drop_detached()

static void knote_drop_detached ( struct knote kn,
struct thread *  td 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knote_enqueue()

static void knote_enqueue ( struct knote kn)
static

Definition at line 2781 of file kern_event.c.

References KQ_OWNED, and kqueue_wakeup().

Referenced by kqueue_register().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knote_fdclose()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knote_fork()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knote_free()

static void knote_free ( struct knote kn)
static

Definition at line 2824 of file kern_event.c.

References knote_zone.

Referenced by knote_drop_detached(), kqueue_register(), and kqueue_scan().

Here is the caller graph for this function:

◆ knote_init()

static void knote_init ( void  )
static

Definition at line 2808 of file kern_event.c.

References knote(), and knote_zone.

Here is the call graph for this function:

◆ kqfd_register()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqtimer_proc_continue()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqtimer_sched_callout()

static void kqtimer_sched_callout ( struct kq_timer_cb_data kc)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_acquire()

static int kqueue_acquire ( struct file *  fp,
struct kqueue **  kqp 
)
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().

Here is the caller graph for this function:

◆ kqueue_add_filteropts()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_close()

static int kqueue_close ( struct file *  fp,
struct thread *  td 
)
static

Definition at line 2288 of file kern_event.c.

References chgkqcnt(), crfree(), free(), kqueue_acquire(), kqueue_destroy(), and kqueue_drain().

Here is the call graph for this function:

◆ kqueue_del_filteropts()

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.

◆ kqueue_destroy()

static void kqueue_destroy ( struct kqueue *  kq)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_drain()

static void kqueue_drain ( struct kqueue *  kq,
struct thread *  td 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_drain_schedtask()

void kqueue_drain_schedtask ( void  )

Definition at line 1786 of file kern_event.c.

References taskqueue_quiesce().

Referenced by ast().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_expand()

static int kqueue_expand ( struct kqueue *  kq,
struct filterops *  fops,
uintptr_t  ident,
int  mflag 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_fill_kinfo()

static int kqueue_fill_kinfo ( struct file *  fp,
struct kinfo_file *  kif,
struct filedesc *  fdp 
)
static

Definition at line 2326 of file kern_event.c.

◆ kqueue_fo_find()

static struct filterops * kqueue_fo_find ( int  filt)
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().

Here is the caller graph for this function:

◆ kqueue_fo_release()

static void kqueue_fo_release ( int  filt)
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().

Here is the caller graph for this function:

◆ kqueue_init()

static void kqueue_init ( struct kqueue *  kq)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_ioctl()

static int kqueue_ioctl ( struct file *  fp,
u_long  cmd,
void *  data,
struct ucred *  active_cred,
struct thread *  td 
)
static

Definition at line 2115 of file kern_event.c.

References data, fgetown(), and fsetown().

Here is the call graph for this function:

◆ kqueue_kevent()

static int kqueue_kevent ( struct kqueue *  kq,
struct thread *  td,
int  nchanges,
int  nevents,
struct kevent_copyops *  k_ops,
const struct timespec *  timeout 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_kqfilter()

static int kqueue_kqfilter ( struct file *  fp,
struct knote kn 
)
static

Definition at line 380 of file kern_event.c.

References knlist_add(), and kqread_filtops.

Here is the call graph for this function:

◆ kqueue_poll()

static int kqueue_poll ( struct file *  fp,
int  events,
struct ucred *  active_cred,
struct thread *  td 
)
static

Definition at line 2163 of file kern_event.c.

References KQ_LOCK, KQ_UNLOCK, kqueue_acquire(), kqueue_release(), and selrecord().

Here is the call graph for this function:

◆ kqueue_register()

static int kqueue_register ( struct kqueue *  kq,
struct kevent *  kev,
struct thread *  td,
int  mflag 
)
static

◆ kqueue_release()

static void kqueue_release ( struct kqueue *  kq,
int  locked 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_scan()

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

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_schedtask()

static void kqueue_schedtask ( struct kqueue *  kq)
static

Definition at line 1792 of file kern_event.c.

References KQ_OWNED, and taskqueue_enqueue().

Referenced by kqueue_wakeup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_stat()

static int kqueue_stat ( struct file *  fp,
struct stat *  st,
struct ucred *  active_cred 
)
static

Definition at line 2190 of file kern_event.c.

References st.

◆ kqueue_task()

static void kqueue_task ( void *  arg,
int  pending 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kqueue_wakeup()

static void kqueue_wakeup ( struct kqueue *  kq)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_KQUEUE  ,
"kqueue"  ,
"memory for kqueue system"   
)
static

◆ MTX_SYSINIT() [1/3]

MTX_SYSINIT ( knlist_lock  ,
knlist_lock,
"knlist lock for lockless objects"  ,
MTX_DEF   
)

◆ MTX_SYSINIT() [2/3]

MTX_SYSINIT ( kq_global  ,
kq_global,
"kqueue order"  ,
MTX_DEF   
)

◆ MTX_SYSINIT() [3/3]

MTX_SYSINIT ( kqueue_filterops  ,
filterops_lock,
"protect sysfilt_ops ,
MTX_DEF   
)

◆ sys_kevent()

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().

Here is the call graph for this function:

◆ sys_kqueue()

int sys_kqueue ( struct thread *  td,
struct kqueue_args *  uap 
)

Definition at line 1055 of file kern_event.c.

References kern_kqueue().

Here is the call graph for this function:

◆ SYSCTL_UINT()

SYSCTL_UINT ( _kern  ,
OID_AUTO  ,
kq_calloutmax  ,
CTLFLAG_RW  ,
kq_calloutmax,
,
"Maximum number of callouts allocated for kqueue"   
)

◆ SYSINIT()

SYSINIT ( knote  ,
SI_SUB_PSEUDO  ,
SI_ORDER_ANY  ,
knote_init  ,
NULL   
)

◆ TASKQUEUE_DEFINE_THREAD()

TASKQUEUE_DEFINE_THREAD ( kqueue_ctx  )

◆ timer2sbintime()

static sbintime_t timer2sbintime ( int64_t  data,
int  flags 
)
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().

Here is the caller graph for this function:

Variable Documentation

◆ file_filtops

struct filterops file_filtops
static
Initial value:
= {
.f_isfd = 1,
.f_attach = filt_fileattach,
}
static int filt_fileattach(struct knote *kn)
Definition: kern_event.c:372

Definition at line 178 of file kern_event.c.

◆ filterops_lock

struct mtx filterops_lock
static

◆ for_fop

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().

◆ for_nolock

int for_nolock

Definition at line 349 of file kern_event.c.

Referenced by kqueue_fo_find(), and kqueue_fo_release().

◆ for_refcnt

int for_refcnt

Definition at line 350 of file kern_event.c.

Referenced by kqueue_del_filteropts(), and kqueue_fo_release().

◆ fs_filtops

struct filterops fs_filtops
extern

Definition at line 6145 of file vfs_subr.c.

◆ knlist_lock

struct mtx knlist_lock
static

Definition at line 2481 of file kern_event.c.

Referenced by knlist_init().

◆ knote_zone

uma_zone_t knote_zone
static

Definition at line 208 of file kern_event.c.

Referenced by knote_alloc(), knote_free(), and knote_init().

◆ kq_calloutmax

unsigned int kq_calloutmax = 4 * 1024
static

Definition at line 210 of file kern_event.c.

Referenced by filt_timerattach().

◆ kq_global

struct mtx kq_global
static

Definition at line 88 of file kern_event.c.

Referenced by kqueue_register(), kqueue_scan(), and kqueue_task().

◆ kq_ncallouts

unsigned int __exclusive_cache_line kq_ncallouts
static

Definition at line 209 of file kern_event.c.

Referenced by filt_timerattach(), and filt_timerdetach().

◆ kqread_filtops

struct filterops kqread_filtops
static
Initial value:
= {
.f_isfd = 1,
.f_detach = filt_kqdetach,
.f_event = filt_kqueue,
}
static int filt_kqueue(struct knote *kn, long hint)
Definition: kern_event.c:404
static void filt_kqdetach(struct knote *kn)
Definition: kern_event.c:395

Definition at line 182 of file kern_event.c.

Referenced by kqueue_kqfilter().

◆ kqueue_close

fo_close_t kqueue_close
static

Definition at line 130 of file kern_event.c.

◆ kqueue_fill_kinfo

fo_fill_kinfo_t kqueue_fill_kinfo
static

Definition at line 131 of file kern_event.c.

◆ kqueue_ioctl

fo_ioctl_t kqueue_ioctl
static

Definition at line 126 of file kern_event.c.

◆ kqueue_kqfilter

fo_kqfilter_t kqueue_kqfilter
static

Definition at line 128 of file kern_event.c.

◆ kqueue_poll

fo_poll_t kqueue_poll
static

Definition at line 127 of file kern_event.c.

◆ kqueue_stat

fo_stat_t kqueue_stat
static

Definition at line 129 of file kern_event.c.

◆ kqueueops

struct fileops kqueueops
static
Initial value:
= {
.fo_read = invfo_rdwr,
.fo_write = invfo_rdwr,
.fo_truncate = invfo_truncate,
.fo_ioctl = kqueue_ioctl,
.fo_poll = kqueue_poll,
.fo_kqfilter = kqueue_kqfilter,
.fo_stat = kqueue_stat,
.fo_close = kqueue_close,
.fo_chmod = invfo_chmod,
.fo_chown = invfo_chown,
.fo_sendfile = invfo_sendfile,
.fo_fill_kinfo = kqueue_fill_kinfo,
}
int invfo_truncate(struct file *fp, off_t length, struct ucred *active_cred, struct thread *td)
int invfo_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, struct thread *td)
int invfo_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio, struct uio *trl_uio, off_t offset, size_t nbytes, off_t *sent, int flags, struct thread *td)
int invfo_rdwr(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td)
int invfo_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, struct thread *td)
static fo_close_t kqueue_close
Definition: kern_event.c:130
static fo_ioctl_t kqueue_ioctl
Definition: kern_event.c:126
static fo_poll_t kqueue_poll
Definition: kern_event.c:127
static fo_fill_kinfo_t kqueue_fill_kinfo
Definition: kern_event.c:131
static fo_stat_t kqueue_stat
Definition: kern_event.c:129
static fo_kqfilter_t kqueue_kqfilter
Definition: kern_event.c:128

Definition at line 133 of file kern_event.c.

Referenced by kern_kqueue().

◆ null_filtops

struct filterops null_filtops
Initial value:
= {
.f_isfd = 0,
.f_attach = filt_nullattach,
}
static int filt_nullattach(struct knote *kn)
Definition: kern_event.c:326

Definition at line 332 of file kern_event.c.

Referenced by kqueue_add_filteropts(), kqueue_del_filteropts(), and kqueue_fo_find().

◆ proc_filtops

struct filterops proc_filtops
static
Initial value:
= {
.f_isfd = 0,
.f_attach = filt_procattach,
.f_detach = filt_procdetach,
.f_event = filt_proc,
}
static int filt_proc(struct knote *kn, long hint)
Definition: kern_event.c:492
static void filt_procdetach(struct knote *kn)
Definition: kern_event.c:483
static int filt_procattach(struct knote *kn)
Definition: kern_event.c:414

Definition at line 188 of file kern_event.c.

◆ sig_filtops

struct filterops sig_filtops
extern

Definition at line 121 of file kern_sig.c.

◆ 

struct { ... } sysfilt_ops[EVFILT_SYSCOUNT]
Initial value:
= {
{ &file_filtops, 1 },
{ &file_filtops, 1 },
{ &null_filtops },
{ &file_filtops, 1 },
{ &proc_filtops, 1 },
{ &sig_filtops, 1 },
{ &timer_filtops, 1 },
{ &file_filtops, 1 },
{ &fs_filtops, 1 },
{ &null_filtops },
{ &user_filtops, 1 },
{ &null_filtops },
{ &file_filtops, 1 },
}
struct filterops sig_filtops
Definition: kern_sig.c:121
static struct filterops file_filtops
Definition: kern_event.c:178
static struct filterops user_filtops
Definition: kern_event.c:201
struct filterops fs_filtops
Definition: vfs_subr.c:6145
static struct filterops proc_filtops
Definition: kern_event.c:188
static struct filterops timer_filtops
Definition: kern_event.c:194
struct filterops null_filtops
Definition: kern_event.c:332

Referenced by kqueue_add_filteropts(), kqueue_del_filteropts(), kqueue_fo_find(), and kqueue_fo_release().

◆ timer_filtops

struct filterops timer_filtops
static
Initial value:
= {
.f_isfd = 0,
.f_attach = filt_timerattach,
.f_detach = filt_timerdetach,
.f_event = filt_timer,
.f_touch = filt_timertouch,
}
static void filt_timertouch(struct knote *kn, struct kevent *kev, u_long type)
Definition: kern_event.c:893
static void filt_timerdetach(struct knote *kn)
Definition: kern_event.c:864
static int filt_timer(struct knote *kn, long hint)
Definition: kern_event.c:960
static int filt_timerattach(struct knote *kn)
Definition: kern_event.c:812

Definition at line 194 of file kern_event.c.

◆ user_filtops

struct filterops user_filtops
static
Initial value:
= {
.f_attach = filt_userattach,
.f_detach = filt_userdetach,
.f_event = filt_user,
.f_touch = filt_usertouch,
}
static int filt_userattach(struct knote *kn)
Definition: kern_event.c:967
static int filt_user(struct knote *kn, long hint)
static void filt_usertouch(struct knote *kn, struct kevent *kev, u_long type)
Definition: kern_event.c:998
static void filt_userdetach(struct knote *kn)

Definition at line 201 of file kern_event.c.