2011-11-05 17:55:49 +00:00
|
|
|
.\" Copyright 2006,2011 John-Mark Gurney
|
2006-10-04 20:16:23 +00:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2012-03-26 09:34:17 +00:00
|
|
|
.Dd March 26, 2012
|
2006-10-04 20:16:23 +00:00
|
|
|
.Dt KQUEUE 9
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
2006-10-05 08:42:07 +00:00
|
|
|
.Nm kqueue_add_filteropts , kqueue_del_filteropts ,
|
|
|
|
.Nm kqfd_register ,
|
|
|
|
.Nm knote_fdclose ,
|
2012-03-26 09:34:17 +00:00
|
|
|
.Nm knlist_init , knlist_init_mtx , knlist_init_rw_reader ,
|
2006-10-05 08:42:07 +00:00
|
|
|
.Nm knlist_add , knlist_remove , knlist_remove_inevent , knlist_empty ,
|
2011-11-05 17:55:49 +00:00
|
|
|
.Nm knlist_clear , knlist_delete , knlist_destroy ,
|
2006-10-04 20:16:23 +00:00
|
|
|
.Nm KNOTE_LOCKED , KNOTE_UNLOCKED
|
2006-10-05 08:42:07 +00:00
|
|
|
.Nd "event delivery subsystem"
|
2006-10-04 20:16:23 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In sys/event.h
|
|
|
|
.Ft int
|
2006-10-05 08:42:07 +00:00
|
|
|
.Fn kqueue_add_filteropts "int filt" "struct filterops *filtops"
|
2006-10-04 20:16:23 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn kqueue_del_filteropts "int filt"
|
|
|
|
.Ft int
|
2006-10-05 08:42:07 +00:00
|
|
|
.Fn kqfd_register "int fd" "struct kevent *kev" "struct thread *td" "int waitok"
|
2006-10-04 20:16:23 +00:00
|
|
|
.Ft void
|
2006-10-05 08:42:07 +00:00
|
|
|
.Fn knote_fdclose "struct thread *td" "int fd"
|
2006-10-04 20:16:23 +00:00
|
|
|
.Ft void
|
2006-10-05 08:42:07 +00:00
|
|
|
.Fo knlist_init
|
|
|
|
.Fa "struct knlist *knl"
|
|
|
|
.Fa "void *lock"
|
|
|
|
.Fa "void \*[lp]*kl_lock\*[rp]\*[lp]void *\*[rp]"
|
|
|
|
.Fa "void \*[lp]*kl_unlock\*[rp]\*[lp]void *\*[rp]"
|
|
|
|
.Fa "int \*[lp]*kl_locked\*[rp]\*[lp]void *\*[rp]"
|
|
|
|
.Fc
|
2006-10-04 20:16:23 +00:00
|
|
|
.Ft void
|
2011-11-05 17:55:49 +00:00
|
|
|
.Fn knlist_init_mtx "struct knlist *knl" "struct mtx *lock"
|
|
|
|
.Ft void
|
2012-03-26 09:34:17 +00:00
|
|
|
.Fn knlist_init_rw_reader "struct knlist *knl" "struct rwlock *lock"
|
|
|
|
.Ft void
|
2011-11-05 17:55:49 +00:00
|
|
|
.Fn knlist_add "struct knlist *knl" "struct knote *kn" "int islocked"
|
|
|
|
.Ft void
|
|
|
|
.Fn knlist_remove "struct knlist *knl" "struct knote *kn" "int islocked"
|
|
|
|
.Ft void
|
|
|
|
.Fn knlist_remove_inevent "struct knlist *knl" "struct knote *kn"
|
|
|
|
.Ft int
|
|
|
|
.Fn knlist_empty "struct knlist *knl"
|
2006-10-04 20:16:23 +00:00
|
|
|
.Ft void
|
2006-10-05 08:42:07 +00:00
|
|
|
.Fn knlist_clear "struct knlist *knl" "int islocked"
|
2006-10-04 20:16:23 +00:00
|
|
|
.Ft void
|
2006-10-05 08:42:07 +00:00
|
|
|
.Fn knlist_delete "struct knlist *knl" "struct thread *td" "int islocked"
|
2006-10-04 20:16:23 +00:00
|
|
|
.Ft void
|
2011-11-05 17:55:49 +00:00
|
|
|
.Fn knlist_destroy "struct knlist *knl"
|
|
|
|
.Ft void
|
2006-10-05 08:42:07 +00:00
|
|
|
.Fn KNOTE_LOCKED "struct knlist *knl" "long hint"
|
2006-10-04 20:16:23 +00:00
|
|
|
.Ft void
|
2006-10-05 08:42:07 +00:00
|
|
|
.Fn KNOTE_UNLOCKED "struct knlist *knl" "long hint"
|
2006-10-04 20:16:23 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The functions
|
|
|
|
.Fn kqueue_add_filteropts
|
|
|
|
and
|
|
|
|
.Fn kqueue_del_filteropts
|
2006-10-05 08:42:07 +00:00
|
|
|
allow for the addition and removal of a filter type.
|
|
|
|
The filter is statically defined by the
|
2006-10-04 20:16:23 +00:00
|
|
|
.Dv EVFILT_*
|
|
|
|
macros.
|
|
|
|
The function
|
|
|
|
.Fn kqueue_add_filteropts
|
2006-10-05 08:42:07 +00:00
|
|
|
will make
|
|
|
|
.Fa filt
|
|
|
|
available.
|
|
|
|
The
|
2006-10-04 20:16:23 +00:00
|
|
|
.Vt "struct filterops"
|
|
|
|
has the following members:
|
|
|
|
.Bl -tag -width ".Va f_attach"
|
|
|
|
.It Va f_isfd
|
|
|
|
If
|
|
|
|
.Va f_isfd
|
|
|
|
is set,
|
|
|
|
.Va ident
|
|
|
|
in
|
|
|
|
.Vt "struct kevent"
|
|
|
|
is taken to be a file descriptor.
|
2006-10-05 08:42:07 +00:00
|
|
|
In this case, the
|
|
|
|
.Vt knote
|
|
|
|
passed into
|
2006-10-04 20:16:23 +00:00
|
|
|
.Va f_attach
|
|
|
|
will have the
|
|
|
|
.Va kn_fp
|
2006-10-05 08:42:07 +00:00
|
|
|
member initialized to the
|
2006-10-04 20:16:23 +00:00
|
|
|
.Vt "struct file *"
|
2006-10-05 08:42:07 +00:00
|
|
|
that represents the file descriptor.
|
2006-10-04 20:16:23 +00:00
|
|
|
.It Va f_attach
|
|
|
|
The
|
|
|
|
.Va f_attach
|
2006-10-05 08:42:07 +00:00
|
|
|
function will be called when attaching a
|
2006-10-04 20:16:23 +00:00
|
|
|
.Vt knote
|
|
|
|
to the object.
|
|
|
|
The method should call
|
|
|
|
.Fn knlist_add
|
|
|
|
to add the
|
|
|
|
.Vt knote
|
2006-10-05 08:42:07 +00:00
|
|
|
to the list that was initialized with
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fn knlist_init .
|
|
|
|
The call to
|
|
|
|
.Fn knlist_add
|
2006-10-05 08:42:07 +00:00
|
|
|
is only necessary if the object can have multiple
|
|
|
|
.Vt knotes
|
|
|
|
associated with it.
|
2006-10-04 20:16:23 +00:00
|
|
|
If there is no
|
|
|
|
.Vt knlist
|
|
|
|
to call
|
|
|
|
.Fn knlist_add
|
|
|
|
with, the function
|
|
|
|
.Va f_attach
|
|
|
|
must clear the
|
|
|
|
.Dv KN_DETACHED
|
|
|
|
bit of
|
|
|
|
.Va kn_status
|
|
|
|
in the
|
2006-10-05 08:42:07 +00:00
|
|
|
.Vt knote .
|
2011-11-05 17:55:49 +00:00
|
|
|
The function shall return 0 on success, or appropriate error for the failure,
|
|
|
|
such as when the object is being destroyed, or does not exist.
|
2006-10-05 08:42:07 +00:00
|
|
|
During
|
|
|
|
.Va f_attach ,
|
2006-10-04 20:16:23 +00:00
|
|
|
it is valid to change the
|
|
|
|
.Va kn_fops
|
|
|
|
pointer to a different pointer.
|
|
|
|
This will change the
|
|
|
|
.Va f_event
|
|
|
|
and
|
|
|
|
.Va f_detach
|
2006-10-05 08:42:07 +00:00
|
|
|
functions called when processing the
|
|
|
|
.Vt knote .
|
2006-10-04 20:16:23 +00:00
|
|
|
.It Va f_detach
|
|
|
|
The
|
|
|
|
.Va f_detach
|
2006-10-05 08:42:07 +00:00
|
|
|
function will be called to detach the
|
2006-10-04 20:16:23 +00:00
|
|
|
.Vt knote
|
|
|
|
if the
|
|
|
|
.Vt knote
|
|
|
|
has not already been detached by a call to
|
2011-11-05 17:55:49 +00:00
|
|
|
.Fn knlist_remove ,
|
|
|
|
.Fn knlist_remove_inevent
|
|
|
|
or
|
|
|
|
.Fn knlist_delete .
|
|
|
|
The list
|
|
|
|
.Fa lock
|
|
|
|
will not be held when this function is called.
|
2006-10-04 20:16:23 +00:00
|
|
|
.It Va f_event
|
|
|
|
The
|
|
|
|
.Va f_event
|
2006-10-05 08:42:07 +00:00
|
|
|
function will be called to update the status of the
|
2006-10-04 20:16:23 +00:00
|
|
|
.Vt knote .
|
|
|
|
If the function returns 0, it will be assumed that the object is not
|
|
|
|
ready (or no longer ready) to be woken up.
|
2006-10-05 08:42:07 +00:00
|
|
|
The
|
|
|
|
.Fa hint
|
|
|
|
argument will be 0 when scanning
|
|
|
|
.Vt knotes
|
|
|
|
to see which are triggered.
|
|
|
|
Otherwise, the
|
|
|
|
.Fa hint
|
|
|
|
argument will be the value passed to either
|
2006-10-04 20:16:23 +00:00
|
|
|
.Dv KNOTE_LOCKED
|
|
|
|
or
|
|
|
|
.Dv KNOTE_UNLOCKED .
|
|
|
|
The
|
|
|
|
.Va kn_data
|
|
|
|
value should be updated as necessary to reflect the current value, such as
|
|
|
|
number of bytes available for reading, or buffer space available for writing.
|
|
|
|
If the note needs to be removed,
|
|
|
|
.Fn knlist_remove_inevent
|
|
|
|
must be called.
|
|
|
|
The function
|
|
|
|
.Fn knlist_remove_inevent
|
|
|
|
will remove the note from the list, the
|
|
|
|
.Va f_detach
|
2006-10-05 08:42:07 +00:00
|
|
|
function will not be called and the
|
|
|
|
.Vt knote
|
2006-10-04 20:16:23 +00:00
|
|
|
will not be returned as an event.
|
2006-12-28 19:15:12 +00:00
|
|
|
.Pp
|
|
|
|
Locks
|
|
|
|
.Em must not
|
2006-12-29 22:30:10 +00:00
|
|
|
be acquired in
|
2006-12-28 19:15:12 +00:00
|
|
|
.Va f_event .
|
|
|
|
If a lock is required in
|
|
|
|
.Va f_event ,
|
|
|
|
it must be obtained in the
|
|
|
|
.Fa kl_lock
|
|
|
|
function of the
|
|
|
|
.Vt knlist
|
|
|
|
that the
|
|
|
|
.Va knote
|
|
|
|
was added to.
|
2006-10-04 20:16:23 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The function
|
|
|
|
.Fn kqfd_register
|
|
|
|
will register the
|
|
|
|
.Vt kevent
|
|
|
|
on the kqueue file descriptor
|
|
|
|
.Fa fd .
|
2006-10-05 08:42:07 +00:00
|
|
|
If it is safe to sleep,
|
|
|
|
.Fa waitok
|
|
|
|
should be set.
|
2006-10-04 20:16:23 +00:00
|
|
|
.Pp
|
|
|
|
The function
|
|
|
|
.Fn knote_fdclose
|
|
|
|
is used to delete all
|
|
|
|
.Vt knotes
|
|
|
|
associated with
|
|
|
|
.Fa fd .
|
2006-10-05 08:42:07 +00:00
|
|
|
Once returned, there will no longer be any
|
2006-10-04 20:16:23 +00:00
|
|
|
.Vt knotes
|
|
|
|
associated with the
|
|
|
|
.Fa fd .
|
|
|
|
The
|
|
|
|
.Vt knotes
|
|
|
|
removed will never be returned from a
|
|
|
|
.Xr kevent 2
|
|
|
|
call, so if userland uses the
|
|
|
|
.Vt knote
|
|
|
|
to track resources, they will be leaked.
|
|
|
|
The
|
|
|
|
.Fn FILEDESC_LOCK
|
2006-10-05 08:42:07 +00:00
|
|
|
lock must be held over the call to
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fn knote_fdclose
|
|
|
|
so that file descriptors cannot be added or removed.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn knlist_*
|
2006-10-05 08:42:07 +00:00
|
|
|
family of functions are for managing
|
|
|
|
.Vt knotes
|
|
|
|
associated with an object.
|
2006-10-04 20:16:23 +00:00
|
|
|
A
|
2006-10-05 08:42:07 +00:00
|
|
|
.Vt knlist
|
2006-10-04 20:16:23 +00:00
|
|
|
is not required, but is commonly used.
|
|
|
|
If used, the
|
|
|
|
.Vt knlist
|
2011-11-05 17:55:49 +00:00
|
|
|
must be initialized with either
|
2012-05-20 16:43:47 +00:00
|
|
|
.Fn knlist_init ,
|
2012-03-26 09:34:17 +00:00
|
|
|
.Fn knlist_init_mtx
|
2011-11-05 17:55:49 +00:00
|
|
|
or
|
2012-03-26 09:34:17 +00:00
|
|
|
.Fn knlist_init_rw_reader .
|
2011-11-05 17:55:49 +00:00
|
|
|
The
|
|
|
|
.Vt knlist
|
|
|
|
structure may be embedded into the object structure.
|
|
|
|
The
|
|
|
|
.Fa lock
|
|
|
|
will be held over
|
|
|
|
.Va f_event
|
|
|
|
calls.
|
|
|
|
.Pp
|
|
|
|
For the
|
|
|
|
.Fn knlist_init
|
|
|
|
function, if
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fa lock
|
|
|
|
is
|
|
|
|
.Dv NULL ,
|
2011-11-05 17:55:49 +00:00
|
|
|
a shared global lock will be used and the remaining arguments must be
|
|
|
|
.Dv NULL .
|
|
|
|
The function pointers
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fa kl_lock , kl_unlock
|
|
|
|
and
|
|
|
|
.Fa kl_locked
|
2011-11-05 17:55:49 +00:00
|
|
|
will be used to manipulate the argument
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fa lock .
|
2011-11-05 17:55:49 +00:00
|
|
|
If any of the function pointers are
|
2006-10-04 20:16:23 +00:00
|
|
|
.Dv NULL ,
|
2011-11-05 17:55:49 +00:00
|
|
|
a function operating on
|
|
|
|
.Dv MTX_DEF
|
|
|
|
style
|
|
|
|
.Xr mutex 9
|
|
|
|
locks will be used instead.
|
|
|
|
.Pp
|
|
|
|
The function
|
|
|
|
.Fn knlist_init_mtx
|
2012-02-25 14:31:25 +00:00
|
|
|
may be used to initialize a
|
2006-10-04 20:16:23 +00:00
|
|
|
.Vt knlist
|
2011-11-05 17:55:49 +00:00
|
|
|
when
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fa lock
|
2011-11-05 17:55:49 +00:00
|
|
|
is a
|
|
|
|
.Dv MTX_DEF
|
|
|
|
style
|
|
|
|
.Xr mutex 9
|
|
|
|
lock.
|
|
|
|
.Pp
|
2006-10-04 20:16:23 +00:00
|
|
|
The function
|
2012-03-26 09:34:17 +00:00
|
|
|
.Fn knlist_init_rw_reader
|
|
|
|
may be used to initialize a
|
|
|
|
.Vt knlist
|
|
|
|
when
|
|
|
|
.Fa lock
|
|
|
|
is a
|
|
|
|
.Xr rwlock 9
|
|
|
|
read lock.
|
|
|
|
Lock is acquired via
|
|
|
|
.Fn rw_rlock
|
|
|
|
function.
|
|
|
|
.Pp
|
|
|
|
The function
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fn knlist_empty
|
2011-11-05 17:55:49 +00:00
|
|
|
returns true when there are no
|
|
|
|
.Vt knotes
|
|
|
|
on the list.
|
|
|
|
The function requires that the
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fa lock
|
2011-11-05 17:55:49 +00:00
|
|
|
be held when called.
|
|
|
|
.Pp
|
2006-10-04 20:16:23 +00:00
|
|
|
The function
|
|
|
|
.Fn knlist_clear
|
2011-11-05 17:55:49 +00:00
|
|
|
removes all
|
2006-10-05 08:42:07 +00:00
|
|
|
.Vt knotes
|
2011-11-05 17:55:49 +00:00
|
|
|
from the list.
|
2006-10-04 20:16:23 +00:00
|
|
|
The
|
|
|
|
.Fa islocked
|
2011-11-05 17:55:49 +00:00
|
|
|
argument declares if the
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fa lock
|
2006-10-05 08:42:07 +00:00
|
|
|
has been acquired.
|
2006-10-04 20:16:23 +00:00
|
|
|
All
|
|
|
|
.Vt knotes
|
2011-11-05 17:55:49 +00:00
|
|
|
will have
|
2006-10-04 20:16:23 +00:00
|
|
|
.Dv EV_ONESHOT
|
2011-11-05 17:55:49 +00:00
|
|
|
set so that the
|
2006-10-04 20:16:23 +00:00
|
|
|
.Vt knote
|
2016-06-08 10:38:00 +00:00
|
|
|
will be returned and removed during the next scan.
|
2011-11-05 17:55:49 +00:00
|
|
|
The
|
|
|
|
.Va f_detach
|
|
|
|
function will be called when the
|
|
|
|
.Vt knote
|
2016-06-08 10:38:00 +00:00
|
|
|
is deleted during the next scan.
|
2011-11-05 17:55:49 +00:00
|
|
|
This function must not be used when
|
|
|
|
.Va f_isfd
|
|
|
|
is set in
|
|
|
|
.Vt "struct filterops" ,
|
|
|
|
as the
|
|
|
|
.Fa td
|
|
|
|
argument of
|
|
|
|
.Fn fdrop
|
|
|
|
will be
|
|
|
|
.Dv NULL .
|
|
|
|
.Pp
|
|
|
|
The function
|
|
|
|
.Fn knlist_delete
|
|
|
|
removes and deletes all
|
|
|
|
.Vt knotes
|
|
|
|
on the list.
|
|
|
|
The function
|
|
|
|
.Va f_detach
|
|
|
|
will not be called, and the
|
|
|
|
.Vt knote
|
|
|
|
will not be returned on the next scan.
|
2016-03-28 19:55:30 +00:00
|
|
|
Using this function could leak userland resources if a process uses the
|
2011-11-05 17:55:49 +00:00
|
|
|
.Vt knote
|
|
|
|
to track resources.
|
|
|
|
.Pp
|
|
|
|
Both the
|
|
|
|
.Fn knlist_clear
|
|
|
|
and
|
|
|
|
.Fn knlist_delete
|
|
|
|
functions may sleep.
|
|
|
|
They also may release the
|
|
|
|
.Fa lock
|
|
|
|
to wait for other
|
|
|
|
.Vt knotes
|
|
|
|
to drain.
|
|
|
|
.Pp
|
2006-10-05 08:42:07 +00:00
|
|
|
The
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fn knlist_destroy
|
2006-10-05 08:42:07 +00:00
|
|
|
function is used to destroy a
|
|
|
|
.Vt knlist .
|
2006-10-04 20:16:23 +00:00
|
|
|
There must be no
|
|
|
|
.Vt knotes
|
|
|
|
associated with the
|
|
|
|
.Vt knlist
|
2014-12-21 10:57:42 +00:00
|
|
|
.Po Fn knlist_empty
|
|
|
|
returns true
|
|
|
|
.Pc
|
2006-10-05 08:42:07 +00:00
|
|
|
and no more
|
2006-10-04 20:16:23 +00:00
|
|
|
.Vt knotes
|
2006-10-05 08:42:07 +00:00
|
|
|
may be attached to the object.
|
|
|
|
A
|
|
|
|
.Vt knlist
|
|
|
|
may be emptied by calling
|
2011-11-05 17:55:49 +00:00
|
|
|
.Fn knlist_clear
|
|
|
|
or
|
|
|
|
.Fn knlist_delete .
|
2006-10-04 20:16:23 +00:00
|
|
|
.Pp
|
2006-10-05 08:42:07 +00:00
|
|
|
The macros
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fn KNOTE_LOCKED
|
|
|
|
and
|
|
|
|
.Fn KNOTE_UNLOCKED
|
2006-10-05 08:42:07 +00:00
|
|
|
are used to notify
|
|
|
|
.Vt knotes
|
|
|
|
about events associated with the object.
|
|
|
|
It will iterate over all
|
2006-10-04 20:16:23 +00:00
|
|
|
.Vt knotes
|
|
|
|
on the list calling the
|
|
|
|
.Va f_event
|
|
|
|
function associated with the
|
|
|
|
.Vt knote .
|
2006-10-05 08:42:07 +00:00
|
|
|
The macro
|
2006-10-04 20:16:23 +00:00
|
|
|
.Fn KNOTE_LOCKED
|
|
|
|
must be used if the lock associated with the
|
|
|
|
.Fa knl
|
2011-11-05 17:55:49 +00:00
|
|
|
is held.
|
2006-10-04 20:16:23 +00:00
|
|
|
The function
|
|
|
|
.Fn KNOTE_UNLOCKED
|
2006-10-05 08:42:07 +00:00
|
|
|
will acquire the lock before iterating over the list of
|
|
|
|
.Vt knotes .
|
2006-10-04 20:16:23 +00:00
|
|
|
.Sh RETURN VALUES
|
|
|
|
The function
|
|
|
|
.Fn kqueue_add_filteropts
|
|
|
|
will return zero on success,
|
|
|
|
.Er EINVAL
|
|
|
|
in the case of an invalid
|
2006-10-05 08:42:07 +00:00
|
|
|
.Fa filt ,
|
2006-10-04 20:16:23 +00:00
|
|
|
or
|
|
|
|
.Er EEXIST
|
|
|
|
if the filter has already been installed.
|
|
|
|
.Pp
|
|
|
|
The function
|
|
|
|
.Fn kqueue_del_filteropts
|
|
|
|
will return zero on success,
|
|
|
|
.Er EINVAL
|
|
|
|
in the case of an invalid
|
2006-10-05 08:42:07 +00:00
|
|
|
.Fa filt ,
|
2006-10-04 20:16:23 +00:00
|
|
|
or
|
|
|
|
.Er EBUSY
|
|
|
|
if the filter is still in use.
|
|
|
|
.Pp
|
|
|
|
The function
|
|
|
|
.Fn kqfd_register
|
|
|
|
will return zero on success,
|
|
|
|
.Er EBADF
|
2006-10-05 08:42:07 +00:00
|
|
|
if the file descriptor is not a kqueue, or any of the possible values returned
|
2006-10-04 20:16:23 +00:00
|
|
|
by
|
2006-10-05 08:42:07 +00:00
|
|
|
.Xr kevent 2 .
|
2006-10-04 20:16:23 +00:00
|
|
|
.Sh SEE ALSO
|
2006-10-05 08:42:07 +00:00
|
|
|
.Xr kevent 2 ,
|
|
|
|
.Xr kqueue 2
|
2006-10-04 20:16:23 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
This
|
|
|
|
manual page was written by
|
2014-06-26 21:44:30 +00:00
|
|
|
.An John-Mark Gurney Aq Mt jmg@FreeBSD.org .
|