xref: /freebsd-13.1/lib/libc/sys/kqueue.2 (revision f7b71c8a)
1ad35a4c9SJonathan Lemon.\" Copyright (c) 2000 Jonathan Lemon
2ad35a4c9SJonathan Lemon.\" All rights reserved.
3ad35a4c9SJonathan Lemon.\"
4ad35a4c9SJonathan Lemon.\" Redistribution and use in source and binary forms, with or without
5ad35a4c9SJonathan Lemon.\" modification, are permitted provided that the following conditions
6ad35a4c9SJonathan Lemon.\" are met:
7ad35a4c9SJonathan Lemon.\" 1. Redistributions of source code must retain the above copyright
8ad35a4c9SJonathan Lemon.\"    notice, this list of conditions and the following disclaimer.
9ad35a4c9SJonathan Lemon.\" 2. Redistributions in binary form must reproduce the above copyright
10ad35a4c9SJonathan Lemon.\"    notice, this list of conditions and the following disclaimer in the
11ad35a4c9SJonathan Lemon.\"    documentation and/or other materials provided with the distribution.
12ad35a4c9SJonathan Lemon.\"
13ad35a4c9SJonathan Lemon.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND
14ad35a4c9SJonathan Lemon.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15ad35a4c9SJonathan Lemon.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16ad35a4c9SJonathan Lemon.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17ad35a4c9SJonathan Lemon.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18ad35a4c9SJonathan Lemon.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19ad35a4c9SJonathan Lemon.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20ad35a4c9SJonathan Lemon.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21ad35a4c9SJonathan Lemon.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22ad35a4c9SJonathan Lemon.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23ad35a4c9SJonathan Lemon.\" SUCH DAMAGE.
24ad35a4c9SJonathan Lemon.\"
25ad35a4c9SJonathan Lemon.\" $FreeBSD$
26ad35a4c9SJonathan Lemon.\"
27*f7b71c8aSKonstantin Belousov.Dd May 2, 2016
28ad35a4c9SJonathan Lemon.Dt KQUEUE 2
29ad35a4c9SJonathan Lemon.Os
30ad35a4c9SJonathan Lemon.Sh NAME
314451bb5dSJonathan Lemon.Nm kqueue ,
324451bb5dSJonathan Lemon.Nm kevent
33ad35a4c9SJonathan Lemon.Nd kernel event notification mechanism
344451bb5dSJonathan Lemon.Sh LIBRARY
354451bb5dSJonathan Lemon.Lb libc
36ad35a4c9SJonathan Lemon.Sh SYNOPSIS
3732eef9aeSRuslan Ermilov.In sys/types.h
3832eef9aeSRuslan Ermilov.In sys/event.h
3932eef9aeSRuslan Ermilov.In sys/time.h
40ad35a4c9SJonathan Lemon.Ft int
41ad35a4c9SJonathan Lemon.Fn kqueue "void"
42ad35a4c9SJonathan Lemon.Ft int
43a8e65b91SJonathan Lemon.Fn kevent "int kq" "const struct kevent *changelist" "int nchanges" "struct kevent *eventlist" "int nevents" "const struct timespec *timeout"
44b072e86dSKonstantin Belousov.Fn EV_SET "kev" ident filter flags fflags data udata
45ad35a4c9SJonathan Lemon.Sh DESCRIPTION
462faeeff4SRuslan ErmilovThe
47ad35a4c9SJonathan Lemon.Fn kqueue
482faeeff4SRuslan Ermilovsystem call
49ad35a4c9SJonathan Lemonprovides a generic method of notifying the user when an event
50ad35a4c9SJonathan Lemonhappens or a condition holds, based on the results of small
51ad35a4c9SJonathan Lemonpieces of kernel code termed filters.
523c63f48cSSheldon HearnA kevent is identified by the (ident, filter) pair; there may only
53ad35a4c9SJonathan Lemonbe one unique kevent per kqueue.
544451bb5dSJonathan Lemon.Pp
55ad35a4c9SJonathan LemonThe filter is executed upon the initial registration of a kevent
563c63f48cSSheldon Hearnin order to detect whether a preexisting condition is present, and is also
57ad35a4c9SJonathan Lemonexecuted whenever an event is passed to the filter for evaluation.
58ad35a4c9SJonathan LemonIf the filter determines that the condition should be reported,
59ad35a4c9SJonathan Lemonthen the kevent is placed on the kqueue for the user to retrieve.
604451bb5dSJonathan Lemon.Pp
61ad35a4c9SJonathan LemonThe filter is also run when the user attempts to retrieve the kevent
623c63f48cSSheldon Hearnfrom the kqueue.
633c63f48cSSheldon HearnIf the filter indicates that the condition that triggered
64ad35a4c9SJonathan Lemonthe event no longer holds, the kevent is removed from the kqueue and
65ad35a4c9SJonathan Lemonis not returned.
664451bb5dSJonathan Lemon.Pp
67ad35a4c9SJonathan LemonMultiple events which trigger the filter do not result in multiple
68ad35a4c9SJonathan Lemonkevents being placed on the kqueue; instead, the filter will aggregate
69ad35a4c9SJonathan Lemonthe events into a single struct kevent.
70ad35a4c9SJonathan LemonCalling
71ad35a4c9SJonathan Lemon.Fn close
72ad35a4c9SJonathan Lemonon a file descriptor will remove any kevents that reference the descriptor.
73ad35a4c9SJonathan Lemon.Pp
742faeeff4SRuslan ErmilovThe
75ad35a4c9SJonathan Lemon.Fn kqueue
762faeeff4SRuslan Ermilovsystem call
77ad35a4c9SJonathan Lemoncreates a new kernel event queue and returns a descriptor.
78af7b56f4SJohn-Mark GurneyThe queue is not inherited by a child created with
79af7b56f4SJohn-Mark Gurney.Xr fork 2 .
803c63f48cSSheldon HearnHowever, if
813c63f48cSSheldon Hearn.Xr rfork 2
82ee85cf8bSJonathan Lemonis called without the
833c63f48cSSheldon Hearn.Dv RFFDG
84ee85cf8bSJonathan Lemonflag, then the descriptor table is shared,
85af7b56f4SJohn-Mark Gurneywhich will allow sharing of the kqueue between two processes.
86ad35a4c9SJonathan Lemon.Pp
872faeeff4SRuslan ErmilovThe
88ad35a4c9SJonathan Lemon.Fn kevent
892faeeff4SRuslan Ermilovsystem call
90ad35a4c9SJonathan Lemonis used to register events with the queue, and return any pending
91ad35a4c9SJonathan Lemonevents to the user.
922efeeba5SRuslan ErmilovThe
93ad35a4c9SJonathan Lemon.Fa changelist
942efeeba5SRuslan Ermilovargument
95a8e65b91SJonathan Lemonis a pointer to an array of
96ad35a4c9SJonathan Lemon.Va kevent
97ad35a4c9SJonathan Lemonstructures, as defined in
98fe08efe6SRuslan Ermilov.In sys/event.h .
99ad35a4c9SJonathan LemonAll changes contained in the
100ad35a4c9SJonathan Lemon.Fa changelist
101ad35a4c9SJonathan Lemonare applied before any pending events are read from the queue.
1022efeeba5SRuslan ErmilovThe
103ad35a4c9SJonathan Lemon.Fa nchanges
1042efeeba5SRuslan Ermilovargument
105ad35a4c9SJonathan Lemongives the size of
106ad35a4c9SJonathan Lemon.Fa changelist .
1072efeeba5SRuslan ErmilovThe
108ad35a4c9SJonathan Lemon.Fa eventlist
1092efeeba5SRuslan Ermilovargument
110ad35a4c9SJonathan Lemonis a pointer to an array of kevent structures.
1112efeeba5SRuslan ErmilovThe
112ad35a4c9SJonathan Lemon.Fa nevents
1132efeeba5SRuslan Ermilovargument
114ad35a4c9SJonathan Lemondetermines the size of
115ad35a4c9SJonathan Lemon.Fa eventlist .
116634862b3SJohn-Mark GurneyWhen
117634862b3SJohn-Mark Gurney.Fa nevents
118634862b3SJohn-Mark Gurneyis zero,
119634862b3SJohn-Mark Gurney.Fn kevent
120634862b3SJohn-Mark Gurneywill return immediately even if there is a
121634862b3SJohn-Mark Gurney.Fa timeout
122634862b3SJohn-Mark Gurneyspecified unlike
123634862b3SJohn-Mark Gurney.Xr select 2 .
124ad35a4c9SJonathan LemonIf
125ad35a4c9SJonathan Lemon.Fa timeout
126ad35a4c9SJonathan Lemonis a non-NULL pointer, it specifies a maximum interval to wait
1271a0a9345SRuslan Ermilovfor an event, which will be interpreted as a struct timespec.
1281a0a9345SRuslan ErmilovIf
129ad35a4c9SJonathan Lemon.Fa timeout
130ad35a4c9SJonathan Lemonis a NULL pointer,
131ad35a4c9SJonathan Lemon.Fn kevent
1321a0a9345SRuslan Ermilovwaits indefinitely.
1331a0a9345SRuslan ErmilovTo effect a poll, the
134ad35a4c9SJonathan Lemon.Fa timeout
135ad35a4c9SJonathan Lemonargument should be non-NULL, pointing to a zero-valued
136ad35a4c9SJonathan Lemon.Va timespec
1371a0a9345SRuslan Ermilovstructure.
1381a0a9345SRuslan ErmilovThe same array may be used for the
139ee85cf8bSJonathan Lemon.Fa changelist
140ee85cf8bSJonathan Lemonand
141ee85cf8bSJonathan Lemon.Fa eventlist .
142ad35a4c9SJonathan Lemon.Pp
1432faeeff4SRuslan ErmilovThe
1445d1c9c56SJonathan Lemon.Fn EV_SET
1452faeeff4SRuslan Ermilovmacro is provided for ease of initializing a
1465d1c9c56SJonathan Lemonkevent structure.
1475d1c9c56SJonathan Lemon.Pp
148ad35a4c9SJonathan LemonThe
149ad35a4c9SJonathan Lemon.Va kevent
150ad35a4c9SJonathan Lemonstructure is defined as:
151ad35a4c9SJonathan Lemon.Bd -literal
152ad35a4c9SJonathan Lemonstruct kevent {
153ad35a4c9SJonathan Lemon	uintptr_t ident;	/* identifier for this event */
154ad35a4c9SJonathan Lemon	short	  filter;	/* filter for event */
155ad35a4c9SJonathan Lemon	u_short	  flags;	/* action flags for kqueue */
156ad35a4c9SJonathan Lemon	u_int	  fflags;	/* filter flag value */
157ad35a4c9SJonathan Lemon	intptr_t  data;		/* filter data value */
158ad35a4c9SJonathan Lemon	void	  *udata;	/* opaque user data identifier */
159ad35a4c9SJonathan Lemon};
160ad35a4c9SJonathan Lemon.Ed
161ad35a4c9SJonathan Lemon.Pp
162ad35a4c9SJonathan LemonThe fields of
163ad35a4c9SJonathan Lemon.Fa struct kevent
164ad35a4c9SJonathan Lemonare:
16519eaed53SKonstantin Belousov.Bl -tag -width "Fa filter"
16619eaed53SKonstantin Belousov.It Fa ident
167ad35a4c9SJonathan LemonValue used to identify this event.
168ad35a4c9SJonathan LemonThe exact interpretation is determined by the attached filter,
169ad35a4c9SJonathan Lemonbut often is a file descriptor.
17019eaed53SKonstantin Belousov.It Fa filter
1711a0a9345SRuslan ErmilovIdentifies the kernel filter used to process this event.
1721a0a9345SRuslan ErmilovThe pre-defined
173ad35a4c9SJonathan Lemonsystem filters are described below.
17419eaed53SKonstantin Belousov.It Fa flags
175ad35a4c9SJonathan LemonActions to perform on the event.
17619eaed53SKonstantin Belousov.It Fa fflags
177ad35a4c9SJonathan LemonFilter-specific flags.
17819eaed53SKonstantin Belousov.It Fa data
179ad35a4c9SJonathan LemonFilter-specific data value.
18019eaed53SKonstantin Belousov.It Fa udata
181ad35a4c9SJonathan LemonOpaque user-defined value passed through the kernel unchanged.
182ad35a4c9SJonathan Lemon.El
183ad35a4c9SJonathan Lemon.Pp
184ad35a4c9SJonathan LemonThe
185ad35a4c9SJonathan Lemon.Va flags
186ad35a4c9SJonathan Lemonfield can contain the following values:
18719eaed53SKonstantin Belousov.Bl -tag -width EV_DISPATCH
18819eaed53SKonstantin Belousov.It Dv EV_ADD
1891a0a9345SRuslan ErmilovAdds the event to the kqueue.
1901a0a9345SRuslan ErmilovRe-adding an existing event
191ad35a4c9SJonathan Lemonwill modify the parameters of the original event, and not result
1921a0a9345SRuslan Ermilovin a duplicate entry.
1931a0a9345SRuslan ErmilovAdding an event automatically enables it,
194ad35a4c9SJonathan Lemonunless overridden by the EV_DISABLE flag.
19519eaed53SKonstantin Belousov.It Dv EV_ENABLE
196ad35a4c9SJonathan LemonPermit
197ad35a4c9SJonathan Lemon.Fn kevent
198ad35a4c9SJonathan Lemonto return the event if it is triggered.
19919eaed53SKonstantin Belousov.It Dv EV_DISABLE
200ad35a4c9SJonathan LemonDisable the event so
201ad35a4c9SJonathan Lemon.Fn kevent
2021a0a9345SRuslan Ermilovwill not return it.
2031a0a9345SRuslan ErmilovThe filter itself is not disabled.
20419eaed53SKonstantin Belousov.It Dv EV_DISPATCH
2051a921c41SStacey SonDisable the event source immediately after delivery of an event.
2061a921c41SStacey SonSee
2071a921c41SStacey Son.Dv EV_DISABLE
2081a921c41SStacey Sonabove.
20919eaed53SKonstantin Belousov.It Dv EV_DELETE
2101a0a9345SRuslan ErmilovRemoves the event from the kqueue.
2111a0a9345SRuslan ErmilovEvents which are attached to
212ad35a4c9SJonathan Lemonfile descriptors are automatically deleted on the last close of
213ad35a4c9SJonathan Lemonthe descriptor.
21419eaed53SKonstantin Belousov.It Dv EV_RECEIPT
215fdc1a113SStacey SonThis flag is useful for making bulk changes to a kqueue without draining
216fdc1a113SStacey Sonany pending events.
217fdc1a113SStacey SonWhen passed as input, it forces
218fdc1a113SStacey Son.Dv EV_ERROR
219fdc1a113SStacey Sonto always be returned.
220fdc1a113SStacey SonWhen a filter is successfully added the
221fdc1a113SStacey Son.Va data
222fdc1a113SStacey Sonfield will be zero.
22319eaed53SKonstantin Belousov.It Dv EV_ONESHOT
224ad35a4c9SJonathan LemonCauses the event to return only the first occurrence of the filter
2251a0a9345SRuslan Ermilovbeing triggered.
2261a0a9345SRuslan ErmilovAfter the user retrieves the event from the kqueue,
227ad35a4c9SJonathan Lemonit is deleted.
22819eaed53SKonstantin Belousov.It Dv EV_CLEAR
229ad35a4c9SJonathan LemonAfter the event is retrieved by the user, its state is reset.
230ad35a4c9SJonathan LemonThis is useful for filters which report state transitions
2311a0a9345SRuslan Ermilovinstead of the current state.
2321a0a9345SRuslan ErmilovNote that some filters may automatically
233ad35a4c9SJonathan Lemonset this flag internally.
23419eaed53SKonstantin Belousov.It Dv EV_EOF
235ad35a4c9SJonathan LemonFilters may set this flag to indicate filter-specific EOF condition.
23619eaed53SKonstantin Belousov.It Dv EV_ERROR
237ad35a4c9SJonathan LemonSee
238ad35a4c9SJonathan Lemon.Sx RETURN VALUES
239ad35a4c9SJonathan Lemonbelow.
240ad35a4c9SJonathan Lemon.El
241ad35a4c9SJonathan Lemon.Pp
242ad35a4c9SJonathan LemonThe predefined system filters are listed below.
243ad35a4c9SJonathan LemonArguments may be passed to and from the filter via the
244ad35a4c9SJonathan Lemon.Va fflags
245ad35a4c9SJonathan Lemonand
246ad35a4c9SJonathan Lemon.Va data
247ad35a4c9SJonathan Lemonfields in the kevent structure.
24819eaed53SKonstantin Belousov.Bl -tag -width "Dv EVFILT_PROCDESC"
24919eaed53SKonstantin Belousov.It Dv EVFILT_READ
250ad35a4c9SJonathan LemonTakes a descriptor as the identifier, and returns whenever
251ad35a4c9SJonathan Lemonthere is data available to read.
252ad35a4c9SJonathan LemonThe behavior of the filter is slightly different depending
253ad35a4c9SJonathan Lemonon the descriptor type.
25442635956SRuslan Ermilov.Bl -tag -width 2n
255ad35a4c9SJonathan Lemon.It Sockets
256ad35a4c9SJonathan LemonSockets which have previously been passed to
257ad35a4c9SJonathan Lemon.Fn listen
258ad35a4c9SJonathan Lemonreturn when there is an incoming connection pending.
259ad35a4c9SJonathan Lemon.Va data
260ad35a4c9SJonathan Lemoncontains the size of the listen backlog.
261ad35a4c9SJonathan Lemon.Pp
262ad35a4c9SJonathan LemonOther socket descriptors return when there is data to be read,
2635d1c9c56SJonathan Lemonsubject to the
2645d1c9c56SJonathan Lemon.Dv SO_RCVLOWAT
2655d1c9c56SJonathan Lemonvalue of the socket buffer.
2665d1c9c56SJonathan LemonThis may be overridden with a per-filter low water mark at the
2675d1c9c56SJonathan Lemontime the filter is added by setting the
26819eaed53SKonstantin Belousov.Dv NOTE_LOWAT
2695d1c9c56SJonathan Lemonflag in
2705d1c9c56SJonathan Lemon.Va fflags ,
2715d1c9c56SJonathan Lemonand specifying the new low water mark in
2725d1c9c56SJonathan Lemon.Va data .
2735d1c9c56SJonathan LemonOn return,
274ad35a4c9SJonathan Lemon.Va data
275e0f640e8SKelly Yanceycontains the number of bytes of protocol data available to read.
276ad35a4c9SJonathan Lemon.Pp
277ad35a4c9SJonathan LemonIf the read direction of the socket has shutdown, then the filter
27819eaed53SKonstantin Belousovalso sets
27919eaed53SKonstantin Belousov.Dv EV_EOF
28019eaed53SKonstantin Belousovin
2815d1c9c56SJonathan Lemon.Va flags ,
2825d1c9c56SJonathan Lemonand returns the socket error (if any) in
2835d1c9c56SJonathan Lemon.Va fflags .
284ad35a4c9SJonathan LemonIt is possible for EOF to be returned (indicating the connection is gone)
285ad35a4c9SJonathan Lemonwhile there is still data pending in the socket buffer.
286ad35a4c9SJonathan Lemon.It Vnodes
287ad35a4c9SJonathan LemonReturns when the file pointer is not at the end of file.
288ad35a4c9SJonathan Lemon.Va data
289ad35a4c9SJonathan Lemoncontains the offset from current position to end of file,
290ad35a4c9SJonathan Lemonand may be negative.
2912433a4ebSEd Schouten.Pp
2922433a4ebSEd SchoutenThis behavior is different from
2932433a4ebSEd Schouten.Xr poll 2 ,
2942433a4ebSEd Schoutenwhere read events are triggered for regular files unconditionally.
2952433a4ebSEd SchoutenThis event can be triggered unconditionally by setting the
2962433a4ebSEd Schouten.Dv NOTE_FILE_POLL
2972433a4ebSEd Schoutenflag in
2982433a4ebSEd Schouten.Va fflags .
29942635956SRuslan Ermilov.It "Fifos, Pipes"
300ad35a4c9SJonathan LemonReturns when the there is data to read;
301ad35a4c9SJonathan Lemon.Va data
302ad35a4c9SJonathan Lemoncontains the number of bytes available.
303ad35a4c9SJonathan Lemon.Pp
30419eaed53SKonstantin BelousovWhen the last writer disconnects, the filter will set
30519eaed53SKonstantin Belousov.Dv EV_EOF
30619eaed53SKonstantin Belousovin
307ad35a4c9SJonathan Lemon.Va flags .
30819eaed53SKonstantin BelousovThis may be cleared by passing in
30919eaed53SKonstantin Belousov.Dv EV_CLEAR ,
31019eaed53SKonstantin Belousovat which point the
311ad35a4c9SJonathan Lemonfilter will resume waiting for data to become available before
312ad35a4c9SJonathan Lemonreturning.
31395aab9ccSJohn-Mark Gurney.It "BPF devices"
31495aab9ccSJohn-Mark GurneyReturns when the BPF buffer is full, the BPF timeout has expired, or
31595aab9ccSJohn-Mark Gurneywhen the BPF has
31695aab9ccSJohn-Mark Gurney.Dq immediate mode
31795aab9ccSJohn-Mark Gurneyenabled and there is any data to read;
31895aab9ccSJohn-Mark Gurney.Va data
31995aab9ccSJohn-Mark Gurneycontains the number of bytes available.
320ad35a4c9SJonathan Lemon.El
32119eaed53SKonstantin Belousov.It Dv EVFILT_WRITE
322ad35a4c9SJonathan LemonTakes a descriptor as the identifier, and returns whenever
3231a0a9345SRuslan Ermilovit is possible to write to the descriptor.
3241a0a9345SRuslan ErmilovFor sockets, pipes
325ad35a4c9SJonathan Lemonand fifos,
326ad35a4c9SJonathan Lemon.Va data
327ad35a4c9SJonathan Lemonwill contain the amount of space remaining in the write buffer.
328ad35a4c9SJonathan LemonThe filter will set EV_EOF when the reader disconnects, and for
32919eaed53SKonstantin Belousovthe fifo case, this may be cleared by use of
33019eaed53SKonstantin Belousov.Dv EV_CLEAR .
33195aab9ccSJohn-Mark GurneyNote that this filter is not supported for vnodes or BPF devices.
3325d1c9c56SJonathan Lemon.Pp
3335d1c9c56SJonathan LemonFor sockets, the low water mark and socket error handling is
33419eaed53SKonstantin Belousovidentical to the
33519eaed53SKonstantin Belousov.Dv EVFILT_READ
33619eaed53SKonstantin Belousovcase.
33719eaed53SKonstantin Belousov.It Dv EVFILT_AIO
3385d1c9c56SJonathan LemonThe sigevent portion of the AIO request is filled in, with
3395d1c9c56SJonathan Lemon.Va sigev_notify_kqueue
3405d1c9c56SJonathan Lemoncontaining the descriptor of the kqueue that the event should
3415d1c9c56SJonathan Lemonbe attached to,
34203a67b59SDavid Xu.Va sigev_notify_kevent_flags
34319eaed53SKonstantin Belousovcontaining the kevent flags which should be
34419eaed53SKonstantin Belousov.Dv EV_ONESHOT ,
34519eaed53SKonstantin Belousov.Dv EV_CLEAR
34619eaed53SKonstantin Belousovor
34719eaed53SKonstantin Belousov.Dv EV_DISPATCH ,
3485d1c9c56SJonathan Lemon.Va sigev_value
3495d1c9c56SJonathan Lemoncontaining the udata value, and
3505d1c9c56SJonathan Lemon.Va sigev_notify
35119eaed53SKonstantin Belousovset to
35219eaed53SKonstantin Belousov.Dv SIGEV_KEVENT .
3532faeeff4SRuslan ErmilovWhen the
3542faeeff4SRuslan Ermilov.Fn aio_*
3552faeeff4SRuslan Ermilovsystem call is made, the event will be registered
3565d1c9c56SJonathan Lemonwith the specified kqueue, and the
357ad35a4c9SJonathan Lemon.Va ident
358ad35a4c9SJonathan Lemonargument set to the
359ad35a4c9SJonathan Lemon.Fa struct aiocb
3602faeeff4SRuslan Ermilovreturned by the
3612faeeff4SRuslan Ermilov.Fn aio_*
3622faeeff4SRuslan Ermilovsystem call.
36319eaed53SKonstantin BelousovThe filter returns under the same conditions as
36419eaed53SKonstantin Belousov.Fn aio_error .
36519eaed53SKonstantin Belousov.It Dv EVFILT_VNODE
366ad35a4c9SJonathan LemonTakes a file descriptor as the identifier and the events to watch for in
367ad35a4c9SJonathan Lemon.Va fflags ,
368ad35a4c9SJonathan Lemonand returns when one or more of the requested events occurs on the descriptor.
369ad35a4c9SJonathan LemonThe events to monitor are:
37019eaed53SKonstantin Belousov.Bl -tag -width "Dv NOTE_RENAME"
37119eaed53SKonstantin Belousov.It Dv NOTE_DELETE
3722faeeff4SRuslan ErmilovThe
373ad35a4c9SJonathan Lemon.Fn unlink
3742faeeff4SRuslan Ermilovsystem call
375ad35a4c9SJonathan Lemonwas called on the file referenced by the descriptor.
37619eaed53SKonstantin Belousov.It Dv NOTE_WRITE
377ad35a4c9SJonathan LemonA write occurred on the file referenced by the descriptor.
37819eaed53SKonstantin Belousov.It Dv NOTE_EXTEND
379*f7b71c8aSKonstantin BelousovFor regular file, the file referenced by the descriptor was extended.
380*f7b71c8aSKonstantin Belousov.Pp
381*f7b71c8aSKonstantin BelousovFor directory, reports that a directory entry was added or removed,
382*f7b71c8aSKonstantin Belousovas the result of rename operation.
383*f7b71c8aSKonstantin BelousovThe
384*f7b71c8aSKonstantin Belousov.Dv NOTE_EXTEND
385*f7b71c8aSKonstantin Belousovevent is not reported when a name is changed inside the directory.
38619eaed53SKonstantin Belousov.It Dv NOTE_ATTRIB
387ad35a4c9SJonathan LemonThe file referenced by the descriptor had its attributes changed.
38819eaed53SKonstantin Belousov.It Dv NOTE_LINK
389ad35a4c9SJonathan LemonThe link count on the file changed.
390ba55e112SKonstantin BelousovIn particular, the
391ba55e112SKonstantin Belousov.Dv NOTE_LINK
392ba55e112SKonstantin Belousovevent is reported if a subdirectory was created or deleted inside
393ba55e112SKonstantin Belousovthe directory referenced by the descriptor.
39419eaed53SKonstantin Belousov.It Dv NOTE_RENAME
395ad35a4c9SJonathan LemonThe file referenced by the descriptor was renamed.
39619eaed53SKonstantin Belousov.It Dv NOTE_REVOKE
3975d1c9c56SJonathan LemonAccess to the file was revoked via
3985d1c9c56SJonathan Lemon.Xr revoke 2
3993c6dd63bSMike Pritchardor the underlying file system was unmounted.
400ad35a4c9SJonathan Lemon.El
401ad35a4c9SJonathan Lemon.Pp
402ad35a4c9SJonathan LemonOn return,
403ad35a4c9SJonathan Lemon.Va fflags
404ad35a4c9SJonathan Lemoncontains the events which triggered the filter.
40519eaed53SKonstantin Belousov.It Dv EVFILT_PROC
406ad35a4c9SJonathan LemonTakes the process ID to monitor as the identifier and the events to watch for
407ad35a4c9SJonathan Lemonin
408ad35a4c9SJonathan Lemon.Va fflags ,
409ad35a4c9SJonathan Lemonand returns when the process performs one or more of the requested events.
410ad35a4c9SJonathan LemonIf a process can normally see another process, it can attach an event to it.
411ad35a4c9SJonathan LemonThe events to monitor are:
41219eaed53SKonstantin Belousov.Bl -tag -width "Dv NOTE_TRACKERR"
41319eaed53SKonstantin Belousov.It Dv NOTE_EXIT
414ad35a4c9SJonathan LemonThe process has exited.
4158cc7b0f9SJohn BaldwinThe exit status will be stored in
4168cc7b0f9SJohn Baldwin.Va data .
41719eaed53SKonstantin Belousov.It Dv NOTE_FORK
418ad35a4c9SJonathan LemonThe process has called
419ad35a4c9SJonathan Lemon.Fn fork .
42019eaed53SKonstantin Belousov.It Dv NOTE_EXEC
421ad35a4c9SJonathan LemonThe process has executed a new process via
422ad35a4c9SJonathan Lemon.Xr execve 2
423513bfc4fSJohn Baldwinor a similar call.
42419eaed53SKonstantin Belousov.It Dv NOTE_TRACK
425ad35a4c9SJonathan LemonFollow a process across
426ad35a4c9SJonathan Lemon.Fn fork
4271a0a9345SRuslan Ermilovcalls.
428513bfc4fSJohn BaldwinThe parent process registers a new kevent to monitor the child process
429513bfc4fSJohn Baldwinusing the same
430ad35a4c9SJonathan Lemon.Va fflags
431513bfc4fSJohn Baldwinas the original event.
43219eaed53SKonstantin BelousovThe child process will signal an event with
43319eaed53SKonstantin Belousov.Dv NOTE_CHILD
43419eaed53SKonstantin Belousovset in
435ad35a4c9SJonathan Lemon.Va fflags
436ad35a4c9SJonathan Lemonand the parent PID in
437ad35a4c9SJonathan Lemon.Va data .
438513bfc4fSJohn Baldwin.Pp
439513bfc4fSJohn BaldwinIf the parent process fails to register a new kevent
440513bfc4fSJohn Baldwin.Pq usually due to resource limitations ,
44119eaed53SKonstantin Belousovit will signal an event with
44219eaed53SKonstantin Belousov.Dv NOTE_TRACKERR
44319eaed53SKonstantin Belousovset in
444513bfc4fSJohn Baldwin.Va fflags ,
44519eaed53SKonstantin Belousovand the child process will not signal a
44619eaed53SKonstantin Belousov.Dv NOTE_CHILD
44719eaed53SKonstantin Belousovevent.
448ad35a4c9SJonathan Lemon.El
449ad35a4c9SJonathan Lemon.Pp
450ad35a4c9SJonathan LemonOn return,
451ad35a4c9SJonathan Lemon.Va fflags
452ad35a4c9SJonathan Lemoncontains the events which triggered the filter.
45319eaed53SKonstantin Belousov.It Dv EVFILT_PROCDESC
45438219d6aSEd SchoutenTakes the process descriptor created by
45538219d6aSEd Schouten.Xr pdfork 2
45638219d6aSEd Schoutento monitor as the identifier and the events to watch for in
45738219d6aSEd Schouten.Va fflags ,
45838219d6aSEd Schoutenand returns when the associated process performs one or more of the
45938219d6aSEd Schoutenrequested events.
46038219d6aSEd SchoutenThe events to monitor are:
46119eaed53SKonstantin Belousov.Bl -tag -width "Dv NOTE_EXIT"
46219eaed53SKonstantin Belousov.It Dv NOTE_EXIT
46338219d6aSEd SchoutenThe process has exited.
46438219d6aSEd SchoutenThe exit status will be stored in
46538219d6aSEd Schouten.Va data .
46638219d6aSEd Schouten.El
46738219d6aSEd Schouten.Pp
46838219d6aSEd SchoutenOn return,
46938219d6aSEd Schouten.Va fflags
47038219d6aSEd Schoutencontains the events which triggered the filter.
47119eaed53SKonstantin Belousov.It Dv EVFILT_SIGNAL
472ad35a4c9SJonathan LemonTakes the signal number to monitor as the identifier and returns
473ad35a4c9SJonathan Lemonwhen the given signal is delivered to the process.
474ad35a4c9SJonathan LemonThis coexists with the
475ad35a4c9SJonathan Lemon.Fn signal
476ad35a4c9SJonathan Lemonand
477ad35a4c9SJonathan Lemon.Fn sigaction
4781a0a9345SRuslan Ermilovfacilities, and has a lower precedence.
4791a0a9345SRuslan ErmilovThe filter will record
480ad35a4c9SJonathan Lemonall attempts to deliver a signal to a process, even if the signal has
48119eaed53SKonstantin Belousovbeen marked as
48219eaed53SKonstantin Belousov.Dv SIG_IGN ,
48319eaed53SKonstantin Belousovexcept for the
484ffce2a5bSPawel Jakub Dawidek.Dv SIGCHLD
485ffce2a5bSPawel Jakub Dawideksignal, which, if ignored, won't be recorded by the filter.
4861a0a9345SRuslan ErmilovEvent notification happens after normal
487ad35a4c9SJonathan Lemonsignal delivery processing.
488ad35a4c9SJonathan Lemon.Va data
489ad35a4c9SJonathan Lemonreturns the number of times the signal has occurred since the last call to
490add06812SJonathan Lemon.Fn kevent .
49119eaed53SKonstantin BelousovThis filter automatically sets the
49219eaed53SKonstantin Belousov.Dv EV_CLEAR
49319eaed53SKonstantin Belousovflag internally.
49419eaed53SKonstantin Belousov.It Dv EVFILT_TIMER
495e725a129SJonathan LemonEstablishes an arbitrary timer identified by
496e725a129SJonathan Lemon.Va ident .
497e725a129SJonathan LemonWhen adding a timer,
498e725a129SJonathan Lemon.Va data
49942e62ecaSBaptiste Daroussinspecifies the timeout period.
50019eaed53SKonstantin BelousovThe timer will be periodic unless
50119eaed53SKonstantin Belousov.Dv EV_ONESHOT
50219eaed53SKonstantin Belousovis specified.
503e725a129SJonathan LemonOn return,
504e725a129SJonathan Lemon.Va data
505fea88e76SGuido van Rooijcontains the number of times the timeout has expired since the last call to
506e725a129SJonathan Lemon.Fn kevent .
507e725a129SJonathan LemonThis filter automatically sets the EV_CLEAR flag internally.
508d2b2cceaSCeri DaviesThere is a system wide limit on the number of timers
509d2b2cceaSCeri Davieswhich is controlled by the
510d2b2cceaSCeri Davies.Va kern.kq_calloutmax
511d2b2cceaSCeri Daviessysctl.
51219eaed53SKonstantin Belousov.Bl -tag -width "Dv NOTE_USECONDS"
51342e62ecaSBaptiste Daroussin.It Dv NOTE_SECONDS
51442e62ecaSBaptiste Daroussin.Va data
51542e62ecaSBaptiste Daroussinis in seconds.
51642e62ecaSBaptiste Daroussin.It Dv NOTE_MSECONDS
51742e62ecaSBaptiste Daroussin.Va data
51842e62ecaSBaptiste Daroussinis in milliseconds.
51942e62ecaSBaptiste Daroussin.It Dv NOTE_USECONDS
52042e62ecaSBaptiste Daroussin.Va data
52142e62ecaSBaptiste Daroussinis in microseconds.
52242e62ecaSBaptiste Daroussin.It Dv NOTE_NSECONDS
52342e62ecaSBaptiste Daroussin.Va data
52442e62ecaSBaptiste Daroussinis in nanoseconds.
52542e62ecaSBaptiste Daroussin.El
526bda16723SChristian Brueffer.Pp
52742e62ecaSBaptiste DaroussinIf
52842e62ecaSBaptiste Daroussin.Va fflags
52942e62ecaSBaptiste Daroussinis not set, the default is milliseconds. On return,
530bda16723SChristian Brueffer.Va fflags
531bda16723SChristian Brueffercontains the events which triggered the filter.
5322c2e4499SStacey Son.It Dv EVFILT_USER
5332c2e4499SStacey SonEstablishes a user event identified by
5342c2e4499SStacey Son.Va ident
535f6ac2391SJoel Dahlwhich is not associated with any kernel mechanism but is triggered by
5362c2e4499SStacey Sonuser level code.
5372c2e4499SStacey SonThe lower 24 bits of the
5382c2e4499SStacey Son.Va fflags
5392c2e4499SStacey Sonmay be used for user defined flags and manipulated using the following:
54019eaed53SKonstantin Belousov.Bl -tag -width "Dv NOTE_FFLAGSMASK"
5412c2e4499SStacey Son.It Dv NOTE_FFNOP
5422c2e4499SStacey SonIgnore the input
5432c2e4499SStacey Son.Va fflags .
5442c2e4499SStacey Son.It Dv NOTE_FFAND
5452c2e4499SStacey SonBitwise AND
5462c2e4499SStacey Son.Va fflags .
5472c2e4499SStacey Son.It Dv NOTE_FFOR
5482c2e4499SStacey SonBitwise OR
5492c2e4499SStacey Son.Va fflags .
55020df026cSRuslan Ermilov.It Dv NOTE_FFCOPY
5512c2e4499SStacey SonCopy
5522c2e4499SStacey Son.Va fflags .
5532c2e4499SStacey Son.It Dv NOTE_FFCTRLMASK
5542c2e4499SStacey SonControl mask for
5552c2e4499SStacey Son.Va fflags .
5562c2e4499SStacey Son.It Dv NOTE_FFLAGSMASK
5572c2e4499SStacey SonUser defined flag mask for
5582c2e4499SStacey Son.Va fflags .
5592c2e4499SStacey Son.El
5602c2e4499SStacey Son.Pp
5612c2e4499SStacey SonA user event is triggered for output with the following:
56219eaed53SKonstantin Belousov.Bl -tag -width "Dv NOTE_FFLAGSMASK"
5632c2e4499SStacey Son.It Dv NOTE_TRIGGER
5642c2e4499SStacey SonCause the event to be triggered.
5652c2e4499SStacey Son.El
5662c2e4499SStacey Son.Pp
5672c2e4499SStacey SonOn return,
5682c2e4499SStacey Son.Va fflags
5692c2e4499SStacey Soncontains the users defined flags in the lower 24 bits.
570ad35a4c9SJonathan Lemon.El
571b072e86dSKonstantin Belousov.Sh CANCELLATION BEHAVIOUR
572b072e86dSKonstantin BelousovIf
573b072e86dSKonstantin Belousov.Fa nevents
574b072e86dSKonstantin Belousovis non-zero, i.e. the function is potentially blocking, the call
575b072e86dSKonstantin Belousovis a cancellation point.
576b072e86dSKonstantin BelousovOtherwise, i.e. if
577b072e86dSKonstantin Belousov.Fa nevents
578b072e86dSKonstantin Belousovis zero, the call is not cancellable.
579b072e86dSKonstantin BelousovCancellation can only occur before any changes are made to the kqueue,
580b072e86dSKonstantin Belousovor when the call was blocked and no changes to the queue were requested.
581ad35a4c9SJonathan Lemon.Sh RETURN VALUES
5822faeeff4SRuslan ErmilovThe
583af7b56f4SJohn-Mark Gurney.Fn kqueue
5842faeeff4SRuslan Ermilovsystem call
585af7b56f4SJohn-Mark Gurneycreates a new kernel event queue and returns a file descriptor.
586af7b56f4SJohn-Mark GurneyIf there was an error creating the kernel event queue, a value of -1 is
587af7b56f4SJohn-Mark Gurneyreturned and errno set.
588af7b56f4SJohn-Mark Gurney.Pp
5892faeeff4SRuslan ErmilovThe
590ad35a4c9SJonathan Lemon.Fn kevent
5912faeeff4SRuslan Ermilovsystem call
592ad35a4c9SJonathan Lemonreturns the number of events placed in the
593bb33e422SChris Costello.Fa eventlist ,
594ad35a4c9SJonathan Lemonup to the value given by
595bb33e422SChris Costello.Fa nevents .
596ad35a4c9SJonathan LemonIf an error occurs while processing an element of the
597bb33e422SChris Costello.Fa changelist
598ad35a4c9SJonathan Lemonand there is enough room in the
599bb33e422SChris Costello.Fa eventlist ,
600ad35a4c9SJonathan Lemonthen the event will be placed in the
601bb33e422SChris Costello.Fa eventlist
602ad35a4c9SJonathan Lemonwith
603ad35a4c9SJonathan Lemon.Dv EV_ERROR
604ad35a4c9SJonathan Lemonset in
605ad35a4c9SJonathan Lemon.Va flags
606ad35a4c9SJonathan Lemonand the system error in
607ad35a4c9SJonathan Lemon.Va data .
608ad35a4c9SJonathan LemonOtherwise,
609ad35a4c9SJonathan Lemon.Dv -1
610ad35a4c9SJonathan Lemonwill be returned, and
611ad35a4c9SJonathan Lemon.Dv errno
612ad35a4c9SJonathan Lemonwill be set to indicate the error condition.
613ad35a4c9SJonathan LemonIf the time limit expires, then
614ad35a4c9SJonathan Lemon.Fn kevent
615ad35a4c9SJonathan Lemonreturns 0.
6168c231786SBenedict Reuschling.Sh EXAMPLES
6178c231786SBenedict Reuschling.Bd -literal -compact
6188c231786SBenedict Reuschling#include <sys/types.h>
6198c231786SBenedict Reuschling#include <sys/event.h>
6208c231786SBenedict Reuschling#include <sys/time.h>
6218c231786SBenedict Reuschling#include <err.h>
6228c231786SBenedict Reuschling#include <fcntl.h>
6238c231786SBenedict Reuschling#include <stdio.h>
6248c231786SBenedict Reuschling#include <stdlib.h>
6258c231786SBenedict Reuschling#include <string.h>
6268c231786SBenedict Reuschling#include <unistd.h>
6278c231786SBenedict Reuschling
6288c231786SBenedict Reuschlingint
6298c231786SBenedict Reuschlingmain(int argc, char **argv)
6308c231786SBenedict Reuschling{
6318c231786SBenedict Reuschling    struct kevent event;    /* Event we want to monitor */
6328c231786SBenedict Reuschling    struct kevent tevent;   /* Event triggered */
6338c231786SBenedict Reuschling    int kq, fd, ret;
6348c231786SBenedict Reuschling
6358c231786SBenedict Reuschling    if (argc != 2)
6368c231786SBenedict Reuschling	err(EXIT_FAILURE, "Usage: %s path\en", argv[0]);
6378c231786SBenedict Reuschling    fd = open(argv[1], O_RDONLY);
6388c231786SBenedict Reuschling    if (fd == -1)
6398c231786SBenedict Reuschling	err(EXIT_FAILURE, "Failed to open '%s'", argv[1]);
6408c231786SBenedict Reuschling
6418c231786SBenedict Reuschling    /* Create kqueue. */
6428c231786SBenedict Reuschling    kq = kqueue();
6438c231786SBenedict Reuschling    if (kq == -1)
6448c231786SBenedict Reuschling	err(EXIT_FAILURE, "kqueue() failed");
6458c231786SBenedict Reuschling
6468c231786SBenedict Reuschling    /* Initialize kevent structure. */
6478c231786SBenedict Reuschling    EV_SET(&event, fd, EVFILT_VNODE, EV_ADD | EV_CLEAR, NOTE_WRITE,
6488c231786SBenedict Reuschling	0, NULL);
6498c231786SBenedict Reuschling    /* Attach event to the kqueue. */
6508c231786SBenedict Reuschling    ret = kevent(kq, &event, 1, NULL, 0, NULL);
6518c231786SBenedict Reuschling    if (ret == -1)
6528c231786SBenedict Reuschling	err(EXIT_FAILURE, "kevent register");
6538c231786SBenedict Reuschling    if (event.flags & EV_ERROR)
6548c231786SBenedict Reuschling	errx(EXIT_FAILURE, "Event error: %s", strerror(event.data));
6558c231786SBenedict Reuschling
6568c231786SBenedict Reuschling    for (;;) {
6578c231786SBenedict Reuschling	/* Sleep until something happens. */
6588c231786SBenedict Reuschling	ret = kevent(kq, NULL, 0, &tevent, 1, NULL);
6598c231786SBenedict Reuschling	if (ret == -1) {
6608c231786SBenedict Reuschling	    err(EXIT_FAILURE, "kevent wait");
6618c231786SBenedict Reuschling	} else if (ret > 0) {
6628c231786SBenedict Reuschling	    printf("Something was written in '%s'\en", argv[1]);
6638c231786SBenedict Reuschling	}
6648c231786SBenedict Reuschling    }
6658c231786SBenedict Reuschling}
6668c231786SBenedict Reuschling.Ed
667ad35a4c9SJonathan Lemon.Sh ERRORS
668ad35a4c9SJonathan LemonThe
669af7b56f4SJohn-Mark Gurney.Fn kqueue
6702faeeff4SRuslan Ermilovsystem call fails if:
671af7b56f4SJohn-Mark Gurney.Bl -tag -width Er
672af7b56f4SJohn-Mark Gurney.It Bq Er ENOMEM
673af7b56f4SJohn-Mark GurneyThe kernel failed to allocate enough memory for the kernel queue.
6741947c8a6SJilles Tjoelker.It Bq Er ENOMEM
6751947c8a6SJilles TjoelkerThe
6761947c8a6SJilles Tjoelker.Dv RLIMIT_KQUEUES
6771947c8a6SJilles Tjoelkerrlimit
6781947c8a6SJilles Tjoelker(see
6791947c8a6SJilles Tjoelker.Xr getrlimit 2 )
6801947c8a6SJilles Tjoelkerfor the current user would be exceeded.
681af7b56f4SJohn-Mark Gurney.It Bq Er EMFILE
682af7b56f4SJohn-Mark GurneyThe per-process descriptor table is full.
683af7b56f4SJohn-Mark Gurney.It Bq Er ENFILE
684af7b56f4SJohn-Mark GurneyThe system file table is full.
685af7b56f4SJohn-Mark Gurney.El
686af7b56f4SJohn-Mark Gurney.Pp
687af7b56f4SJohn-Mark GurneyThe
688ad35a4c9SJonathan Lemon.Fn kevent
6892faeeff4SRuslan Ermilovsystem call fails if:
690ad35a4c9SJonathan Lemon.Bl -tag -width Er
691c23155a4SRuslan Ermilov.It Bq Er EACCES
692ad35a4c9SJonathan LemonThe process does not have permission to register a filter.
693ad35a4c9SJonathan Lemon.It Bq Er EFAULT
694ad35a4c9SJonathan LemonThere was an error reading or writing the
695ad35a4c9SJonathan Lemon.Va kevent
696ad35a4c9SJonathan Lemonstructure.
697ad35a4c9SJonathan Lemon.It Bq Er EBADF
698ad35a4c9SJonathan LemonThe specified descriptor is invalid.
699ad35a4c9SJonathan Lemon.It Bq Er EINTR
700ad35a4c9SJonathan LemonA signal was delivered before the timeout expired and before any
701ad35a4c9SJonathan Lemonevents were placed on the kqueue for return.
702b072e86dSKonstantin Belousov.It Bq Er EINTR
703b072e86dSKonstantin BelousovA cancellation request was delivered to the thread, but not yet handled.
704ad35a4c9SJonathan Lemon.It Bq Er EINVAL
705ad35a4c9SJonathan LemonThe specified time limit or filter is invalid.
706b275c430SJonathan Lemon.It Bq Er ENOENT
707b275c430SJonathan LemonThe event could not be found to be modified or deleted.
708ad35a4c9SJonathan Lemon.It Bq Er ENOMEM
709d2b2cceaSCeri DaviesNo memory was available to register the event
710d2b2cceaSCeri Daviesor, in the special case of a timer, the maximum number of
711d2b2cceaSCeri Daviestimers has been exceeded.
712d2b2cceaSCeri DaviesThis maximum is configurable via the
713d2b2cceaSCeri Davies.Va kern.kq_calloutmax
714d2b2cceaSCeri Daviessysctl.
715ad35a4c9SJonathan Lemon.It Bq Er ESRCH
716ad35a4c9SJonathan LemonThe specified process to attach to does not exist.
717ad35a4c9SJonathan Lemon.El
718b072e86dSKonstantin Belousov.Pp
719b072e86dSKonstantin BelousovWhen
720b072e86dSKonstantin Belousov.Fn kevent
721b072e86dSKonstantin Belousovcall fails with
722b072e86dSKonstantin Belousov.Er EINTR
723b072e86dSKonstantin Belousoverror, all changes in the
724b072e86dSKonstantin Belousov.Fa changelist
725b072e86dSKonstantin Belousovhave been applied.
726ad35a4c9SJonathan Lemon.Sh SEE ALSO
727ad35a4c9SJonathan Lemon.Xr aio_error 2 ,
728ad35a4c9SJonathan Lemon.Xr aio_read 2 ,
729ad35a4c9SJonathan Lemon.Xr aio_return 2 ,
730ad35a4c9SJonathan Lemon.Xr poll 2 ,
731ad35a4c9SJonathan Lemon.Xr read 2 ,
732ad35a4c9SJonathan Lemon.Xr select 2 ,
733ad35a4c9SJonathan Lemon.Xr sigaction 2 ,
7343c63f48cSSheldon Hearn.Xr write 2 ,
735b072e86dSKonstantin Belousov.Xr pthread_setcancelstate 3 ,
7363c63f48cSSheldon Hearn.Xr signal 3
737ad35a4c9SJonathan Lemon.Sh HISTORY
738ad35a4c9SJonathan LemonThe
739ad35a4c9SJonathan Lemon.Fn kqueue
740ad35a4c9SJonathan Lemonand
741ad35a4c9SJonathan Lemon.Fn kevent
7422faeeff4SRuslan Ermilovsystem calls first appeared in
74355b8fbfbSJohn-Mark Gurney.Fx 4.1 .
7444451bb5dSJonathan Lemon.Sh AUTHORS
745ad35a4c9SJonathan LemonThe
746ad35a4c9SJonathan Lemon.Fn kqueue
747ad35a4c9SJonathan Lemonsystem and this manual page were written by
7488fbf3d50SBaptiste Daroussin.An Jonathan Lemon Aq Mt [email protected] .
749e585cdf0SJohn-Mark Gurney.Sh BUGS
750bda16723SChristian BruefferThe
7513b38d66bSColin Percival.Fa timeout
7523b38d66bSColin Percivalvalue is limited to 24 hours; longer timeouts will be silently
7533b38d66bSColin Percivalreinterpreted as 24 hours.
754