xref: /freebsd/share/man/man9/kqueue.9 (revision 604de40a024c760df5db542171d3953493f56bfb)
14ce04b3dSJohn-Mark Gurney.\" Copyright 2006,2011 John-Mark Gurney
290db62acSJohn-Mark Gurney.\" All rights reserved.
390db62acSJohn-Mark Gurney.\"
490db62acSJohn-Mark Gurney.\" Redistribution and use in source and binary forms, with or without
590db62acSJohn-Mark Gurney.\" modification, are permitted provided that the following conditions
690db62acSJohn-Mark Gurney.\" are met:
790db62acSJohn-Mark Gurney.\" 1. Redistributions of source code must retain the above copyright
890db62acSJohn-Mark Gurney.\"    notice, this list of conditions and the following disclaimer.
990db62acSJohn-Mark Gurney.\" 2. Redistributions in binary form must reproduce the above copyright
1090db62acSJohn-Mark Gurney.\"    notice, this list of conditions and the following disclaimer in the
1190db62acSJohn-Mark Gurney.\"    documentation and/or other materials provided with the distribution.
1290db62acSJohn-Mark Gurney.\"
1390db62acSJohn-Mark Gurney.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1490db62acSJohn-Mark Gurney.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1590db62acSJohn-Mark Gurney.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1690db62acSJohn-Mark Gurney.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1790db62acSJohn-Mark Gurney.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1890db62acSJohn-Mark Gurney.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1990db62acSJohn-Mark Gurney.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2090db62acSJohn-Mark Gurney.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2190db62acSJohn-Mark Gurney.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2290db62acSJohn-Mark Gurney.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2390db62acSJohn-Mark Gurney.\" SUCH DAMAGE.
2490db62acSJohn-Mark Gurney.\"
25*604de40aSMark Johnston.Dd December 18, 2023
2690db62acSJohn-Mark Gurney.Dt KQUEUE 9
2790db62acSJohn-Mark Gurney.Os
2890db62acSJohn-Mark Gurney.Sh NAME
2974a603ebSRuslan Ermilov.Nm kqueue_add_filteropts , kqueue_del_filteropts ,
3074a603ebSRuslan Ermilov.Nm kqfd_register ,
3174a603ebSRuslan Ermilov.Nm knote_fdclose ,
323454a7caSRobert Wing.Nm knlist_init , knlist_init_mtx ,
33b3a71465SRobert Wing.Nm knlist_add , knlist_remove , knlist_empty ,
344ce04b3dSJohn-Mark Gurney.Nm knlist_clear , knlist_delete , knlist_destroy ,
3590db62acSJohn-Mark Gurney.Nm KNOTE_LOCKED , KNOTE_UNLOCKED
3674a603ebSRuslan Ermilov.Nd "event delivery subsystem"
3790db62acSJohn-Mark Gurney.Sh SYNOPSIS
3890db62acSJohn-Mark Gurney.In sys/event.h
3990db62acSJohn-Mark Gurney.Ft int
4074a603ebSRuslan Ermilov.Fn kqueue_add_filteropts "int filt" "struct filterops *filtops"
4190db62acSJohn-Mark Gurney.Ft int
4290db62acSJohn-Mark Gurney.Fn kqueue_del_filteropts "int filt"
4390db62acSJohn-Mark Gurney.Ft int
4474a603ebSRuslan Ermilov.Fn kqfd_register "int fd" "struct kevent *kev" "struct thread *td" "int waitok"
4590db62acSJohn-Mark Gurney.Ft void
4674a603ebSRuslan Ermilov.Fn knote_fdclose "struct thread *td" "int fd"
4790db62acSJohn-Mark Gurney.Ft void
4874a603ebSRuslan Ermilov.Fo knlist_init
4974a603ebSRuslan Ermilov.Fa "struct knlist *knl"
5074a603ebSRuslan Ermilov.Fa "void *lock"
5174a603ebSRuslan Ermilov.Fa "void \*[lp]*kl_lock\*[rp]\*[lp]void *\*[rp]"
5274a603ebSRuslan Ermilov.Fa "void \*[lp]*kl_unlock\*[rp]\*[lp]void *\*[rp]"
5374a603ebSRuslan Ermilov.Fa "int \*[lp]*kl_locked\*[rp]\*[lp]void *\*[rp]"
5474a603ebSRuslan Ermilov.Fc
5590db62acSJohn-Mark Gurney.Ft void
564ce04b3dSJohn-Mark Gurney.Fn knlist_init_mtx "struct knlist *knl" "struct mtx *lock"
574ce04b3dSJohn-Mark Gurney.Ft void
584ce04b3dSJohn-Mark Gurney.Fn knlist_add "struct knlist *knl" "struct knote *kn" "int islocked"
594ce04b3dSJohn-Mark Gurney.Ft void
604ce04b3dSJohn-Mark Gurney.Fn knlist_remove "struct knlist *knl" "struct knote *kn" "int islocked"
614ce04b3dSJohn-Mark Gurney.Ft int
624ce04b3dSJohn-Mark Gurney.Fn knlist_empty "struct knlist *knl"
6390db62acSJohn-Mark Gurney.Ft void
6474a603ebSRuslan Ermilov.Fn knlist_clear "struct knlist *knl" "int islocked"
6590db62acSJohn-Mark Gurney.Ft void
6674a603ebSRuslan Ermilov.Fn knlist_delete "struct knlist *knl" "struct thread *td" "int islocked"
6790db62acSJohn-Mark Gurney.Ft void
684ce04b3dSJohn-Mark Gurney.Fn knlist_destroy "struct knlist *knl"
694ce04b3dSJohn-Mark Gurney.Ft void
7074a603ebSRuslan Ermilov.Fn KNOTE_LOCKED "struct knlist *knl" "long hint"
7190db62acSJohn-Mark Gurney.Ft void
7274a603ebSRuslan Ermilov.Fn KNOTE_UNLOCKED "struct knlist *knl" "long hint"
7390db62acSJohn-Mark Gurney.Sh DESCRIPTION
7490db62acSJohn-Mark GurneyThe functions
7590db62acSJohn-Mark Gurney.Fn kqueue_add_filteropts
7690db62acSJohn-Mark Gurneyand
7790db62acSJohn-Mark Gurney.Fn kqueue_del_filteropts
7874a603ebSRuslan Ermilovallow for the addition and removal of a filter type.
7974a603ebSRuslan ErmilovThe filter is statically defined by the
8090db62acSJohn-Mark Gurney.Dv EVFILT_*
8190db62acSJohn-Mark Gurneymacros.
8290db62acSJohn-Mark GurneyThe function
8390db62acSJohn-Mark Gurney.Fn kqueue_add_filteropts
8474a603ebSRuslan Ermilovwill make
8574a603ebSRuslan Ermilov.Fa filt
8674a603ebSRuslan Ermilovavailable.
8774a603ebSRuslan ErmilovThe
8890db62acSJohn-Mark Gurney.Vt "struct filterops"
8990db62acSJohn-Mark Gurneyhas the following members:
9090db62acSJohn-Mark Gurney.Bl -tag -width ".Va f_attach"
9190db62acSJohn-Mark Gurney.It Va f_isfd
9290db62acSJohn-Mark GurneyIf
9390db62acSJohn-Mark Gurney.Va f_isfd
9490db62acSJohn-Mark Gurneyis set,
9590db62acSJohn-Mark Gurney.Va ident
9690db62acSJohn-Mark Gurneyin
9790db62acSJohn-Mark Gurney.Vt "struct kevent"
9890db62acSJohn-Mark Gurneyis taken to be a file descriptor.
9974a603ebSRuslan ErmilovIn this case, the
10074a603ebSRuslan Ermilov.Vt knote
10174a603ebSRuslan Ermilovpassed into
10290db62acSJohn-Mark Gurney.Va f_attach
10390db62acSJohn-Mark Gurneywill have the
10490db62acSJohn-Mark Gurney.Va kn_fp
10574a603ebSRuslan Ermilovmember initialized to the
10690db62acSJohn-Mark Gurney.Vt "struct file *"
10774a603ebSRuslan Ermilovthat represents the file descriptor.
10890db62acSJohn-Mark Gurney.It Va f_attach
10990db62acSJohn-Mark GurneyThe
11090db62acSJohn-Mark Gurney.Va f_attach
11174a603ebSRuslan Ermilovfunction will be called when attaching a
11290db62acSJohn-Mark Gurney.Vt knote
11390db62acSJohn-Mark Gurneyto the object.
11490db62acSJohn-Mark GurneyThe method should call
11590db62acSJohn-Mark Gurney.Fn knlist_add
11690db62acSJohn-Mark Gurneyto add the
11790db62acSJohn-Mark Gurney.Vt knote
11874a603ebSRuslan Ermilovto the list that was initialized with
11990db62acSJohn-Mark Gurney.Fn knlist_init .
12090db62acSJohn-Mark GurneyThe call to
12190db62acSJohn-Mark Gurney.Fn knlist_add
12274a603ebSRuslan Ermilovis only necessary if the object can have multiple
12374a603ebSRuslan Ermilov.Vt knotes
12474a603ebSRuslan Ermilovassociated with it.
12590db62acSJohn-Mark GurneyIf there is no
12690db62acSJohn-Mark Gurney.Vt knlist
12790db62acSJohn-Mark Gurneyto call
12890db62acSJohn-Mark Gurney.Fn knlist_add
12990db62acSJohn-Mark Gurneywith, the function
13090db62acSJohn-Mark Gurney.Va f_attach
13190db62acSJohn-Mark Gurneymust clear the
13290db62acSJohn-Mark Gurney.Dv KN_DETACHED
13390db62acSJohn-Mark Gurneybit of
13490db62acSJohn-Mark Gurney.Va kn_status
13590db62acSJohn-Mark Gurneyin the
13674a603ebSRuslan Ermilov.Vt knote .
1374ce04b3dSJohn-Mark GurneyThe function shall return 0 on success, or appropriate error for the failure,
1384ce04b3dSJohn-Mark Gurneysuch as when the object is being destroyed, or does not exist.
13974a603ebSRuslan ErmilovDuring
14074a603ebSRuslan Ermilov.Va f_attach ,
14190db62acSJohn-Mark Gurneyit is valid to change the
14208580603SKyle Evans.Va kn_fop
14390db62acSJohn-Mark Gurneypointer to a different pointer.
14490db62acSJohn-Mark GurneyThis will change the
14590db62acSJohn-Mark Gurney.Va f_event
14690db62acSJohn-Mark Gurneyand
14790db62acSJohn-Mark Gurney.Va f_detach
14874a603ebSRuslan Ermilovfunctions called when processing the
14974a603ebSRuslan Ermilov.Vt knote .
15090db62acSJohn-Mark Gurney.It Va f_detach
15190db62acSJohn-Mark GurneyThe
15290db62acSJohn-Mark Gurney.Va f_detach
15374a603ebSRuslan Ermilovfunction will be called to detach the
15490db62acSJohn-Mark Gurney.Vt knote
15590db62acSJohn-Mark Gurneyif the
15690db62acSJohn-Mark Gurney.Vt knote
15790db62acSJohn-Mark Gurneyhas not already been detached by a call to
158b3a71465SRobert Wing.Fn knlist_remove
1594ce04b3dSJohn-Mark Gurneyor
1604ce04b3dSJohn-Mark Gurney.Fn knlist_delete .
1614ce04b3dSJohn-Mark GurneyThe list
1624ce04b3dSJohn-Mark Gurney.Fa lock
1634ce04b3dSJohn-Mark Gurneywill not be held when this function is called.
16490db62acSJohn-Mark Gurney.It Va f_event
16590db62acSJohn-Mark GurneyThe
16690db62acSJohn-Mark Gurney.Va f_event
16774a603ebSRuslan Ermilovfunction will be called to update the status of the
16890db62acSJohn-Mark Gurney.Vt knote .
16990db62acSJohn-Mark GurneyIf the function returns 0, it will be assumed that the object is not
17090db62acSJohn-Mark Gurneyready (or no longer ready) to be woken up.
17174a603ebSRuslan ErmilovThe
17274a603ebSRuslan Ermilov.Fa hint
17374a603ebSRuslan Ermilovargument will be 0 when scanning
17474a603ebSRuslan Ermilov.Vt knotes
17574a603ebSRuslan Ermilovto see which are triggered.
17674a603ebSRuslan ErmilovOtherwise, the
17774a603ebSRuslan Ermilov.Fa hint
17874a603ebSRuslan Ermilovargument will be the value passed to either
17990db62acSJohn-Mark Gurney.Dv KNOTE_LOCKED
18090db62acSJohn-Mark Gurneyor
18190db62acSJohn-Mark Gurney.Dv KNOTE_UNLOCKED .
18290db62acSJohn-Mark GurneyThe
18390db62acSJohn-Mark Gurney.Va kn_data
18490db62acSJohn-Mark Gurneyvalue should be updated as necessary to reflect the current value, such as
18590db62acSJohn-Mark Gurneynumber of bytes available for reading, or buffer space available for writing.
186cd457d4eSJohn-Mark Gurney.Pp
187cd457d4eSJohn-Mark GurneyLocks
188cd457d4eSJohn-Mark Gurney.Em must not
18999be3bc6SJohn-Mark Gurneybe acquired in
190cd457d4eSJohn-Mark Gurney.Va f_event .
191cd457d4eSJohn-Mark GurneyIf a lock is required in
192cd457d4eSJohn-Mark Gurney.Va f_event ,
193cd457d4eSJohn-Mark Gurneyit must be obtained in the
194cd457d4eSJohn-Mark Gurney.Fa kl_lock
195cd457d4eSJohn-Mark Gurneyfunction of the
196cd457d4eSJohn-Mark Gurney.Vt knlist
197cd457d4eSJohn-Mark Gurneythat the
198cd457d4eSJohn-Mark Gurney.Va knote
199cd457d4eSJohn-Mark Gurneywas added to.
20090db62acSJohn-Mark Gurney.El
20190db62acSJohn-Mark Gurney.Pp
20290db62acSJohn-Mark GurneyThe function
20390db62acSJohn-Mark Gurney.Fn kqfd_register
20490db62acSJohn-Mark Gurneywill register the
20590db62acSJohn-Mark Gurney.Vt kevent
20690db62acSJohn-Mark Gurneyon the kqueue file descriptor
20790db62acSJohn-Mark Gurney.Fa fd .
20874a603ebSRuslan ErmilovIf it is safe to sleep,
20974a603ebSRuslan Ermilov.Fa waitok
21074a603ebSRuslan Ermilovshould be set.
21190db62acSJohn-Mark Gurney.Pp
21290db62acSJohn-Mark GurneyThe function
21390db62acSJohn-Mark Gurney.Fn knote_fdclose
21490db62acSJohn-Mark Gurneyis used to delete all
21590db62acSJohn-Mark Gurney.Vt knotes
21690db62acSJohn-Mark Gurneyassociated with
21790db62acSJohn-Mark Gurney.Fa fd .
21874a603ebSRuslan ErmilovOnce returned, there will no longer be any
21990db62acSJohn-Mark Gurney.Vt knotes
22090db62acSJohn-Mark Gurneyassociated with the
22190db62acSJohn-Mark Gurney.Fa fd .
22290db62acSJohn-Mark GurneyThe
22390db62acSJohn-Mark Gurney.Vt knotes
22490db62acSJohn-Mark Gurneyremoved will never be returned from a
22590db62acSJohn-Mark Gurney.Xr kevent 2
22690db62acSJohn-Mark Gurneycall, so if userland uses the
22790db62acSJohn-Mark Gurney.Vt knote
22890db62acSJohn-Mark Gurneyto track resources, they will be leaked.
22990db62acSJohn-Mark GurneyThe
23090db62acSJohn-Mark Gurney.Fn FILEDESC_LOCK
23174a603ebSRuslan Ermilovlock must be held over the call to
23290db62acSJohn-Mark Gurney.Fn knote_fdclose
23390db62acSJohn-Mark Gurneyso that file descriptors cannot be added or removed.
23490db62acSJohn-Mark Gurney.Pp
23590db62acSJohn-Mark GurneyThe
23690db62acSJohn-Mark Gurney.Fn knlist_*
23774a603ebSRuslan Ermilovfamily of functions are for managing
23874a603ebSRuslan Ermilov.Vt knotes
23974a603ebSRuslan Ermilovassociated with an object.
24090db62acSJohn-Mark GurneyA
24174a603ebSRuslan Ermilov.Vt knlist
24290db62acSJohn-Mark Gurneyis not required, but is commonly used.
24390db62acSJohn-Mark GurneyIf used, the
24490db62acSJohn-Mark Gurney.Vt knlist
2454ce04b3dSJohn-Mark Gurneymust be initialized with either
2463454a7caSRobert Wing.Fn knlist_init
2474ce04b3dSJohn-Mark Gurneyor
2483454a7caSRobert Wing.Fn knlist_init_mtx .
24990db62acSJohn-Mark GurneyThe
25090db62acSJohn-Mark Gurney.Vt knlist
25174a603ebSRuslan Ermilovstructure may be embedded into the object structure.
25290db62acSJohn-Mark GurneyThe
25390db62acSJohn-Mark Gurney.Fa lock
2544ce04b3dSJohn-Mark Gurneywill be held over
2554ce04b3dSJohn-Mark Gurney.Va f_event
2564ce04b3dSJohn-Mark Gurneycalls.
2574ce04b3dSJohn-Mark Gurney.Pp
2584ce04b3dSJohn-Mark GurneyFor the
2594ce04b3dSJohn-Mark Gurney.Fn knlist_init
2604ce04b3dSJohn-Mark Gurneyfunction, if
2614ce04b3dSJohn-Mark Gurney.Fa lock
2624ce04b3dSJohn-Mark Gurneyis
2634ce04b3dSJohn-Mark Gurney.Dv NULL ,
2644ce04b3dSJohn-Mark Gurneya shared global lock will be used and the remaining arguments must be
2654ce04b3dSJohn-Mark Gurney.Dv NULL .
2664ce04b3dSJohn-Mark GurneyThe function pointers
2674ce04b3dSJohn-Mark Gurney.Fa kl_lock , kl_unlock
2684ce04b3dSJohn-Mark Gurneyand
2694ce04b3dSJohn-Mark Gurney.Fa kl_locked
2704ce04b3dSJohn-Mark Gurneywill be used to manipulate the argument
2714ce04b3dSJohn-Mark Gurney.Fa lock .
2724ce04b3dSJohn-Mark GurneyIf any of the function pointers are
2734ce04b3dSJohn-Mark Gurney.Dv NULL ,
2744ce04b3dSJohn-Mark Gurneya function operating on
2754ce04b3dSJohn-Mark Gurney.Dv MTX_DEF
2764ce04b3dSJohn-Mark Gurneystyle
2774ce04b3dSJohn-Mark Gurney.Xr mutex 9
2784ce04b3dSJohn-Mark Gurneylocks will be used instead.
2794ce04b3dSJohn-Mark Gurney.Pp
2804ce04b3dSJohn-Mark GurneyThe function
2814ce04b3dSJohn-Mark Gurney.Fn knlist_init_mtx
2823102cfe2SGlen Barbermay be used to initialize a
2834ce04b3dSJohn-Mark Gurney.Vt knlist
2844ce04b3dSJohn-Mark Gurneywhen
2854ce04b3dSJohn-Mark Gurney.Fa lock
2864ce04b3dSJohn-Mark Gurneyis a
2874ce04b3dSJohn-Mark Gurney.Dv MTX_DEF
2884ce04b3dSJohn-Mark Gurneystyle
2894ce04b3dSJohn-Mark Gurney.Xr mutex 9
2904ce04b3dSJohn-Mark Gurneylock.
2914ce04b3dSJohn-Mark Gurney.Pp
29290db62acSJohn-Mark GurneyThe function
29390db62acSJohn-Mark Gurney.Fn knlist_empty
2944ce04b3dSJohn-Mark Gurneyreturns true when there are no
2954ce04b3dSJohn-Mark Gurney.Vt knotes
2964ce04b3dSJohn-Mark Gurneyon the list.
2974ce04b3dSJohn-Mark GurneyThe function requires that the
29890db62acSJohn-Mark Gurney.Fa lock
2994ce04b3dSJohn-Mark Gurneybe held when called.
3004ce04b3dSJohn-Mark Gurney.Pp
30190db62acSJohn-Mark GurneyThe function
30290db62acSJohn-Mark Gurney.Fn knlist_clear
3034ce04b3dSJohn-Mark Gurneyremoves all
30474a603ebSRuslan Ermilov.Vt knotes
3054ce04b3dSJohn-Mark Gurneyfrom the list.
30690db62acSJohn-Mark GurneyThe
30790db62acSJohn-Mark Gurney.Fa islocked
3084ce04b3dSJohn-Mark Gurneyargument declares if the
30990db62acSJohn-Mark Gurney.Fa lock
31074a603ebSRuslan Ermilovhas been acquired.
31190db62acSJohn-Mark GurneyAll
31290db62acSJohn-Mark Gurney.Vt knotes
3134ce04b3dSJohn-Mark Gurneywill have
31490db62acSJohn-Mark Gurney.Dv EV_ONESHOT
3154ce04b3dSJohn-Mark Gurneyset so that the
31690db62acSJohn-Mark Gurney.Vt knote
317646fa387SEdward Tomasz Napieralawill be returned and removed during the next scan.
3184ce04b3dSJohn-Mark GurneyThe
3194ce04b3dSJohn-Mark Gurney.Va f_detach
3204ce04b3dSJohn-Mark Gurneyfunction will be called when the
3214ce04b3dSJohn-Mark Gurney.Vt knote
322646fa387SEdward Tomasz Napieralais deleted during the next scan.
3234ce04b3dSJohn-Mark Gurney.Pp
3244ce04b3dSJohn-Mark GurneyThe function
3254ce04b3dSJohn-Mark Gurney.Fn knlist_delete
3264ce04b3dSJohn-Mark Gurneyremoves and deletes all
3274ce04b3dSJohn-Mark Gurney.Vt knotes
3284ce04b3dSJohn-Mark Gurneyon the list.
3294ce04b3dSJohn-Mark GurneyThe function
3304ce04b3dSJohn-Mark Gurney.Va f_detach
3314ce04b3dSJohn-Mark Gurneywill not be called, and the
3324ce04b3dSJohn-Mark Gurney.Vt knote
3334ce04b3dSJohn-Mark Gurneywill not be returned on the next scan.
3344ce04b3dSJohn-Mark GurneyUsing this function could leak userland resources if a process uses the
3354ce04b3dSJohn-Mark Gurney.Vt knote
3364ce04b3dSJohn-Mark Gurneyto track resources.
3374ce04b3dSJohn-Mark Gurney.Pp
3384ce04b3dSJohn-Mark GurneyBoth the
3394ce04b3dSJohn-Mark Gurney.Fn knlist_clear
3404ce04b3dSJohn-Mark Gurneyand
3414ce04b3dSJohn-Mark Gurney.Fn knlist_delete
3424ce04b3dSJohn-Mark Gurneyfunctions may sleep.
3434ce04b3dSJohn-Mark GurneyThey also may release the
3444ce04b3dSJohn-Mark Gurney.Fa lock
3454ce04b3dSJohn-Mark Gurneyto wait for other
3464ce04b3dSJohn-Mark Gurney.Vt knotes
3474ce04b3dSJohn-Mark Gurneyto drain.
3484ce04b3dSJohn-Mark Gurney.Pp
34974a603ebSRuslan ErmilovThe
35090db62acSJohn-Mark Gurney.Fn knlist_destroy
35174a603ebSRuslan Ermilovfunction is used to destroy a
35274a603ebSRuslan Ermilov.Vt knlist .
35390db62acSJohn-Mark GurneyThere must be no
35490db62acSJohn-Mark Gurney.Vt knotes
35590db62acSJohn-Mark Gurneyassociated with the
35690db62acSJohn-Mark Gurney.Vt knlist
3571e9469d1SChristian Brueffer.Po Fn knlist_empty
3581e9469d1SChristian Bruefferreturns true
3591e9469d1SChristian Brueffer.Pc
36074a603ebSRuslan Ermilovand no more
36190db62acSJohn-Mark Gurney.Vt knotes
36274a603ebSRuslan Ermilovmay be attached to the object.
36374a603ebSRuslan ErmilovA
36474a603ebSRuslan Ermilov.Vt knlist
36574a603ebSRuslan Ermilovmay be emptied by calling
3664ce04b3dSJohn-Mark Gurney.Fn knlist_clear
3674ce04b3dSJohn-Mark Gurneyor
3684ce04b3dSJohn-Mark Gurney.Fn knlist_delete .
36990db62acSJohn-Mark Gurney.Pp
37074a603ebSRuslan ErmilovThe macros
37190db62acSJohn-Mark Gurney.Fn KNOTE_LOCKED
37290db62acSJohn-Mark Gurneyand
37390db62acSJohn-Mark Gurney.Fn KNOTE_UNLOCKED
37474a603ebSRuslan Ermilovare used to notify
37574a603ebSRuslan Ermilov.Vt knotes
37674a603ebSRuslan Ermilovabout events associated with the object.
37774a603ebSRuslan ErmilovIt will iterate over all
37890db62acSJohn-Mark Gurney.Vt knotes
37990db62acSJohn-Mark Gurneyon the list calling the
38090db62acSJohn-Mark Gurney.Va f_event
38190db62acSJohn-Mark Gurneyfunction associated with the
38290db62acSJohn-Mark Gurney.Vt knote .
38374a603ebSRuslan ErmilovThe macro
38490db62acSJohn-Mark Gurney.Fn KNOTE_LOCKED
38590db62acSJohn-Mark Gurneymust be used if the lock associated with the
38690db62acSJohn-Mark Gurney.Fa knl
3874ce04b3dSJohn-Mark Gurneyis held.
38890db62acSJohn-Mark GurneyThe function
38990db62acSJohn-Mark Gurney.Fn KNOTE_UNLOCKED
39074a603ebSRuslan Ermilovwill acquire the lock before iterating over the list of
39174a603ebSRuslan Ermilov.Vt knotes .
39290db62acSJohn-Mark Gurney.Sh RETURN VALUES
39390db62acSJohn-Mark GurneyThe function
39490db62acSJohn-Mark Gurney.Fn kqueue_add_filteropts
39590db62acSJohn-Mark Gurneywill return zero on success,
39690db62acSJohn-Mark Gurney.Er EINVAL
39790db62acSJohn-Mark Gurneyin the case of an invalid
39874a603ebSRuslan Ermilov.Fa filt ,
39990db62acSJohn-Mark Gurneyor
40090db62acSJohn-Mark Gurney.Er EEXIST
40190db62acSJohn-Mark Gurneyif the filter has already been installed.
40290db62acSJohn-Mark Gurney.Pp
40390db62acSJohn-Mark GurneyThe function
40490db62acSJohn-Mark Gurney.Fn kqueue_del_filteropts
40590db62acSJohn-Mark Gurneywill return zero on success,
40690db62acSJohn-Mark Gurney.Er EINVAL
40790db62acSJohn-Mark Gurneyin the case of an invalid
40874a603ebSRuslan Ermilov.Fa filt ,
40990db62acSJohn-Mark Gurneyor
41090db62acSJohn-Mark Gurney.Er EBUSY
41190db62acSJohn-Mark Gurneyif the filter is still in use.
41290db62acSJohn-Mark Gurney.Pp
41390db62acSJohn-Mark GurneyThe function
41490db62acSJohn-Mark Gurney.Fn kqfd_register
41590db62acSJohn-Mark Gurneywill return zero on success,
41690db62acSJohn-Mark Gurney.Er EBADF
41774a603ebSRuslan Ermilovif the file descriptor is not a kqueue, or any of the possible values returned
41890db62acSJohn-Mark Gurneyby
41974a603ebSRuslan Ermilov.Xr kevent 2 .
42090db62acSJohn-Mark Gurney.Sh SEE ALSO
42174a603ebSRuslan Ermilov.Xr kevent 2 ,
42274a603ebSRuslan Ermilov.Xr kqueue 2
42390db62acSJohn-Mark Gurney.Sh AUTHORS
42490db62acSJohn-Mark GurneyThis
42590db62acSJohn-Mark Gurneymanual page was written by
4268a7314fcSBaptiste Daroussin.An John-Mark Gurney Aq Mt jmg@FreeBSD.org .
427