xref: /freebsd-14.2/lib/libc/sys/kqueue.2 (revision 2e85df65)
1.\" Copyright (c) 2000 Jonathan Lemon
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd October 12, 2021
28.Dt KQUEUE 2
29.Os
30.Sh NAME
31.Nm kqueue ,
32.Nm kevent
33.Nd kernel event notification mechanism
34.Sh LIBRARY
35.Lb libc
36.Sh SYNOPSIS
37.In sys/event.h
38.Ft int
39.Fn kqueue "void"
40.Ft int
41.Fo kevent
42.Fa "int kq"
43.Fa "const struct kevent *changelist"
44.Fa "int nchanges"
45.Fa "struct kevent *eventlist"
46.Fa "int nevents"
47.Fa "const struct timespec *timeout"
48.Fc
49.Fn EV_SET "kev" ident filter flags fflags data udata
50.Sh DESCRIPTION
51The
52.Fn kqueue
53system call
54provides a generic method of notifying the user when an event
55happens or a condition holds, based on the results of small
56pieces of kernel code termed filters.
57A kevent is identified by the (ident, filter) pair; there may only
58be one unique kevent per kqueue.
59.Pp
60The filter is executed upon the initial registration of a kevent
61in order to detect whether a preexisting condition is present, and is also
62executed whenever an event is passed to the filter for evaluation.
63If the filter determines that the condition should be reported,
64then the kevent is placed on the kqueue for the user to retrieve.
65.Pp
66The filter is also run when the user attempts to retrieve the kevent
67from the kqueue.
68If the filter indicates that the condition that triggered
69the event no longer holds, the kevent is removed from the kqueue and
70is not returned.
71.Pp
72Multiple events which trigger the filter do not result in multiple
73kevents being placed on the kqueue; instead, the filter will aggregate
74the events into a single struct kevent.
75Calling
76.Fn close
77on a file descriptor will remove any kevents that reference the descriptor.
78.Pp
79The
80.Fn kqueue
81system call
82creates a new kernel event queue and returns a descriptor.
83The queue is not inherited by a child created with
84.Xr fork 2 .
85However, if
86.Xr rfork 2
87is called without the
88.Dv RFFDG
89flag, then the descriptor table is shared,
90which will allow sharing of the kqueue between two processes.
91.Pp
92The
93.Fn kevent
94system call
95is used to register events with the queue, and return any pending
96events to the user.
97The
98.Fa changelist
99argument
100is a pointer to an array of
101.Va kevent
102structures, as defined in
103.In sys/event.h .
104All changes contained in the
105.Fa changelist
106are applied before any pending events are read from the queue.
107The
108.Fa nchanges
109argument
110gives the size of
111.Fa changelist .
112The
113.Fa eventlist
114argument
115is a pointer to an array of kevent structures.
116The
117.Fa nevents
118argument
119determines the size of
120.Fa eventlist .
121When
122.Fa nevents
123is zero,
124.Fn kevent
125will return immediately even if there is a
126.Fa timeout
127specified unlike
128.Xr select 2 .
129If
130.Fa timeout
131is a non-NULL pointer, it specifies a maximum interval to wait
132for an event, which will be interpreted as a struct timespec.
133If
134.Fa timeout
135is a NULL pointer,
136.Fn kevent
137waits indefinitely.
138To effect a poll, the
139.Fa timeout
140argument should be non-NULL, pointing to a zero-valued
141.Va timespec
142structure.
143The same array may be used for the
144.Fa changelist
145and
146.Fa eventlist .
147.Pp
148The
149.Fn EV_SET
150macro is provided for ease of initializing a
151kevent structure.
152.Pp
153The
154.Va kevent
155structure is defined as:
156.Bd -literal
157struct kevent {
158	uintptr_t  ident;	/* identifier for this event */
159	short	  filter;	/* filter for event */
160	u_short	  flags;	/* action flags for kqueue */
161	u_int	  fflags;	/* filter flag value */
162	int64_t   data;		/* filter data value */
163	void	  *udata;	/* opaque user data identifier */
164	uint64_t  ext[4];	/* extensions */
165};
166.Ed
167.Pp
168The fields of
169.Fa struct kevent
170are:
171.Bl -tag -width "Fa filter"
172.It Fa ident
173Value used to identify this event.
174The exact interpretation is determined by the attached filter,
175but often is a file descriptor.
176.It Fa filter
177Identifies the kernel filter used to process this event.
178The pre-defined
179system filters are described below.
180.It Fa flags
181Actions to perform on the event.
182.It Fa fflags
183Filter-specific flags.
184.It Fa data
185Filter-specific data value.
186.It Fa udata
187Opaque user-defined value passed through the kernel unchanged.
188.It Fa ext
189Extended data passed to and from kernel.
190The
191.Fa ext[0]
192and
193.Fa ext[1]
194members use is defined by the filter.
195If the filter does not use them, the members are copied unchanged.
196The
197.Fa ext[2]
198and
199.Fa ext[3]
200members are always passed through the kernel as-is,
201making additional context available to application.
202.El
203.Pp
204The
205.Va flags
206field can contain the following values:
207.Bl -tag -width EV_DISPATCH
208.It Dv EV_ADD
209Adds the event to the kqueue.
210Re-adding an existing event
211will modify the parameters of the original event, and not result
212in a duplicate entry.
213Adding an event automatically enables it,
214unless overridden by the EV_DISABLE flag.
215.It Dv EV_ENABLE
216Permit
217.Fn kevent
218to return the event if it is triggered.
219.It Dv EV_DISABLE
220Disable the event so
221.Fn kevent
222will not return it.
223The filter itself is not disabled.
224.It Dv EV_DISPATCH
225Disable the event source immediately after delivery of an event.
226See
227.Dv EV_DISABLE
228above.
229.It Dv EV_DELETE
230Removes the event from the kqueue.
231Events which are attached to
232file descriptors are automatically deleted on the last close of
233the descriptor.
234.It Dv EV_RECEIPT
235This flag is useful for making bulk changes to a kqueue without draining
236any pending events.
237When passed as input, it forces
238.Dv EV_ERROR
239to always be returned.
240When a filter is successfully added the
241.Va data
242field will be zero.
243Note that if this flag is encountered and there is no remaining space in
244.Fa eventlist
245to hold the
246.Dv EV_ERROR
247event, then subsequent changes will not get processed.
248.It Dv EV_ONESHOT
249Causes the event to return only the first occurrence of the filter
250being triggered.
251After the user retrieves the event from the kqueue,
252it is deleted.
253.It Dv EV_CLEAR
254After the event is retrieved by the user, its state is reset.
255This is useful for filters which report state transitions
256instead of the current state.
257Note that some filters may automatically
258set this flag internally.
259.It Dv EV_EOF
260Filters may set this flag to indicate filter-specific EOF condition.
261.It Dv EV_ERROR
262See
263.Sx RETURN VALUES
264below.
265.It Dv EV_KEEPUDATA
266Causes
267.Fn kevent
268to leave unchanged any
269.Fa udata
270associated with an existing event.
271This allows other aspects of the event to be modified without requiring the
272caller to know the
273.Fa udata
274value presently associated.
275This is especially useful with
276.Dv NOTE_TRIGGER
277or flags like
278.Dv EV_ENABLE .
279This flag may not be used with
280.Dv EV_ADD .
281.El
282.Pp
283The predefined system filters are listed below.
284Arguments may be passed to and from the filter via the
285.Va fflags
286and
287.Va data
288fields in the kevent structure.
289.Bl -tag -width "Dv EVFILT_PROCDESC"
290.It Dv EVFILT_READ
291Takes a descriptor as the identifier, and returns whenever
292there is data available to read.
293The behavior of the filter is slightly different depending
294on the descriptor type.
295.Bl -tag -width 2n
296.It Sockets
297Sockets which have previously been passed to
298.Fn listen
299return when there is an incoming connection pending.
300.Va data
301contains the size of the listen backlog.
302.Pp
303Other socket descriptors return when there is data to be read,
304subject to the
305.Dv SO_RCVLOWAT
306value of the socket buffer.
307This may be overridden with a per-filter low water mark at the
308time the filter is added by setting the
309.Dv NOTE_LOWAT
310flag in
311.Va fflags ,
312and specifying the new low water mark in
313.Va data .
314On return,
315.Va data
316contains the number of bytes of protocol data available to read.
317.Pp
318If the read direction of the socket has shutdown, then the filter
319also sets
320.Dv EV_EOF
321in
322.Va flags ,
323and returns the socket error (if any) in
324.Va fflags .
325It is possible for EOF to be returned (indicating the connection is gone)
326while there is still data pending in the socket buffer.
327.It Vnodes
328Returns when the file pointer is not at the end of file.
329.Va data
330contains the offset from current position to end of file,
331and may be negative.
332.Pp
333This behavior is different from
334.Xr poll 2 ,
335where read events are triggered for regular files unconditionally.
336This event can be triggered unconditionally by setting the
337.Dv NOTE_FILE_POLL
338flag in
339.Va fflags .
340.It "Fifos, Pipes"
341Returns when the there is data to read;
342.Va data
343contains the number of bytes available.
344.Pp
345When the last writer disconnects, the filter will set
346.Dv EV_EOF
347in
348.Va flags .
349This will be cleared by the filter when a new writer connects,
350at which point the
351filter will resume waiting for data to become available before
352returning.
353.It "BPF devices"
354Returns when the BPF buffer is full, the BPF timeout has expired, or
355when the BPF has
356.Dq immediate mode
357enabled and there is any data to read;
358.Va data
359contains the number of bytes available.
360.It Eventfds
361Returns when the counter is greater than 0;
362.Va data
363contains the counter value, which must be cast to
364.Vt uint64_t .
365.It Kqueues
366Returns when pending events are present on the queue;
367.Va data
368contains the number of events available.
369.El
370.It Dv EVFILT_WRITE
371Takes a descriptor as the identifier, and returns whenever
372it is possible to write to the descriptor.
373For sockets, pipes
374and fifos,
375.Va data
376will contain the amount of space remaining in the write buffer.
377The filter will set
378.Dv EV_EOF
379when the reader disconnects, and for the fifo case, this will be cleared
380when a new reader connects.
381Note that this filter is not supported for vnodes.
382.Pp
383For sockets, the low water mark and socket error handling is
384identical to the
385.Dv EVFILT_READ
386case.
387.Pp
388For eventfds,
389.Va data
390will contain the maximum value that can be added to the counter
391without blocking.
392.Pp
393For BPF devices, the filter always indicates that it is possible to
394write and
395.Va data
396will contain the MTU size of the underlying interface.
397.It Dv EVFILT_EMPTY
398Takes a descriptor as the identifier, and returns whenever
399there is no remaining data in the write buffer.
400.It Dv EVFILT_AIO
401Events for this filter are not registered with
402.Fn kevent
403directly but are registered via the
404.Va aio_sigevent
405member of an asynchronous I/O request when it is scheduled via an
406asynchronous I/O system call such as
407.Fn aio_read .
408The filter returns under the same conditions as
409.Fn aio_error .
410For more details on this filter see
411.Xr sigevent 3 and
412.Xr aio 4 .
413.It Dv EVFILT_VNODE
414Takes a file descriptor as the identifier and the events to watch for in
415.Va fflags ,
416and returns when one or more of the requested events occurs on the descriptor.
417The events to monitor are:
418.Bl -tag -width "Dv NOTE_CLOSE_WRITE"
419.It Dv NOTE_ATTRIB
420The file referenced by the descriptor had its attributes changed.
421.It Dv NOTE_CLOSE
422A file descriptor referencing the monitored file, was closed.
423The closed file descriptor did not have write access.
424.It Dv NOTE_CLOSE_WRITE
425A file descriptor referencing the monitored file, was closed.
426The closed file descriptor had write access.
427.Pp
428This note, as well as
429.Dv NOTE_CLOSE ,
430are not activated when files are closed forcibly by
431.Xr unmount 2 or
432.Xr revoke 2 .
433Instead,
434.Dv NOTE_REVOKE
435is sent for such events.
436.It Dv NOTE_DELETE
437The
438.Fn unlink
439system call was called on the file referenced by the descriptor.
440.It Dv NOTE_EXTEND
441For regular file, the file referenced by the descriptor was extended.
442.Pp
443For directory, reports that a directory entry was added or removed,
444as the result of rename operation.
445The
446.Dv NOTE_EXTEND
447event is not reported when a name is changed inside the directory.
448.It Dv NOTE_LINK
449The link count on the file changed.
450In particular, the
451.Dv NOTE_LINK
452event is reported if a subdirectory was created or deleted inside
453the directory referenced by the descriptor.
454.It Dv NOTE_OPEN
455The file referenced by the descriptor was opened.
456.It Dv NOTE_READ
457A read occurred on the file referenced by the descriptor.
458.It Dv NOTE_RENAME
459The file referenced by the descriptor was renamed.
460.It Dv NOTE_REVOKE
461Access to the file was revoked via
462.Xr revoke 2
463or the underlying file system was unmounted.
464.It Dv NOTE_WRITE
465A write occurred on the file referenced by the descriptor.
466.El
467.Pp
468On return,
469.Va fflags
470contains the events which triggered the filter.
471.It Dv EVFILT_PROC
472Takes the process ID to monitor as the identifier and the events to watch for
473in
474.Va fflags ,
475and returns when the process performs one or more of the requested events.
476If a process can normally see another process, it can attach an event to it.
477The events to monitor are:
478.Bl -tag -width "Dv NOTE_TRACKERR"
479.It Dv NOTE_EXIT
480The process has exited.
481The exit status will be stored in
482.Va data .
483.It Dv NOTE_FORK
484The process has called
485.Fn fork .
486.It Dv NOTE_EXEC
487The process has executed a new process via
488.Xr execve 2
489or a similar call.
490.It Dv NOTE_TRACK
491Follow a process across
492.Fn fork
493calls.
494The parent process registers a new kevent to monitor the child process
495using the same
496.Va fflags
497as the original event.
498The child process will signal an event with
499.Dv NOTE_CHILD
500set in
501.Va fflags
502and the parent PID in
503.Va data .
504.Pp
505If the parent process fails to register a new kevent
506.Pq usually due to resource limitations ,
507it will signal an event with
508.Dv NOTE_TRACKERR
509set in
510.Va fflags ,
511and the child process will not signal a
512.Dv NOTE_CHILD
513event.
514.El
515.Pp
516On return,
517.Va fflags
518contains the events which triggered the filter.
519.It Dv EVFILT_PROCDESC
520Takes the process descriptor created by
521.Xr pdfork 2
522to monitor as the identifier and the events to watch for in
523.Va fflags ,
524and returns when the associated process performs one or more of the
525requested events.
526The events to monitor are:
527.Bl -tag -width "Dv NOTE_EXIT"
528.It Dv NOTE_EXIT
529The process has exited.
530The exit status will be stored in
531.Va data .
532.El
533.Pp
534On return,
535.Va fflags
536contains the events which triggered the filter.
537.It Dv EVFILT_SIGNAL
538Takes the signal number to monitor as the identifier and returns
539when the given signal is delivered to the process.
540This coexists with the
541.Fn signal
542and
543.Fn sigaction
544facilities, and has a lower precedence.
545The filter will record
546all attempts to deliver a signal to a process, even if the signal has
547been marked as
548.Dv SIG_IGN ,
549except for the
550.Dv SIGCHLD
551signal, which, if ignored, will not be recorded by the filter.
552Event notification happens after normal
553signal delivery processing.
554.Va data
555returns the number of times the signal has occurred since the last call to
556.Fn kevent .
557This filter automatically sets the
558.Dv EV_CLEAR
559flag internally.
560.It Dv EVFILT_TIMER
561Establishes an arbitrary timer identified by
562.Va ident .
563When adding a timer,
564.Va data
565specifies the moment to fire the timer (for
566.Dv NOTE_ABSTIME )
567or the timeout period.
568The timer will be periodic unless
569.Dv EV_ONESHOT
570or
571.Dv NOTE_ABSTIME
572is specified.
573On return,
574.Va data
575contains the number of times the timeout has expired since the last call to
576.Fn kevent .
577For non-monotonic timers, this filter automatically sets the
578.Dv EV_CLEAR
579flag internally.
580.Pp
581The filter accepts the following flags in the
582.Va fflags
583argument:
584.Bl -tag -width "Dv NOTE_MSECONDS"
585.It Dv NOTE_SECONDS
586.Va data
587is in seconds.
588.It Dv NOTE_MSECONDS
589.Va data
590is in milliseconds.
591.It Dv NOTE_USECONDS
592.Va data
593is in microseconds.
594.It Dv NOTE_NSECONDS
595.Va data
596is in nanoseconds.
597.It Dv NOTE_ABSTIME
598The specified expiration time is absolute.
599.El
600.Pp
601If
602.Va fflags
603is not set, the default is milliseconds.
604On return,
605.Va fflags
606contains the events which triggered the filter.
607.Pp
608Periodic timers with a specified timeout of 0 will be silently adjusted to
609timeout after 1 of the time units specified by the requested precision in
610.Va fflags .
611If an absolute time is specified that has already passed, then it is treated as
612if the current time were specified and the event will fire as soon as possible.
613.Pp
614If an existing timer is re-added, the existing timer will be
615effectively canceled (throwing away any undelivered record of previous
616timer expiration) and re-started using the new parameters contained in
617.Va data
618and
619.Va fflags .
620.Pp
621There is a system wide limit on the number of timers
622which is controlled by the
623.Va kern.kq_calloutmax
624sysctl.
625.It Dv EVFILT_USER
626Establishes a user event identified by
627.Va ident
628which is not associated with any kernel mechanism but is triggered by
629user level code.
630The lower 24 bits of the
631.Va fflags
632may be used for user defined flags and manipulated using the following:
633.Bl -tag -width "Dv NOTE_FFLAGSMASK"
634.It Dv NOTE_FFNOP
635Ignore the input
636.Va fflags .
637.It Dv NOTE_FFAND
638Bitwise AND
639.Va fflags .
640.It Dv NOTE_FFOR
641Bitwise OR
642.Va fflags .
643.It Dv NOTE_FFCOPY
644Copy
645.Va fflags .
646.It Dv NOTE_FFCTRLMASK
647Control mask for
648.Va fflags .
649.It Dv NOTE_FFLAGSMASK
650User defined flag mask for
651.Va fflags .
652.El
653.Pp
654A user event is triggered for output with the following:
655.Bl -tag -width "Dv NOTE_FFLAGSMASK"
656.It Dv NOTE_TRIGGER
657Cause the event to be triggered.
658.El
659.Pp
660On return,
661.Va fflags
662contains the users defined flags in the lower 24 bits.
663.El
664.Sh CANCELLATION BEHAVIOUR
665If
666.Fa nevents
667is non-zero, i.e., the function is potentially blocking, the call
668is a cancellation point.
669Otherwise, i.e., if
670.Fa nevents
671is zero, the call is not cancellable.
672Cancellation can only occur before any changes are made to the kqueue,
673or when the call was blocked and no changes to the queue were requested.
674.Sh RETURN VALUES
675The
676.Fn kqueue
677system call
678creates a new kernel event queue and returns a file descriptor.
679If there was an error creating the kernel event queue, a value of -1 is
680returned and errno set.
681.Pp
682The
683.Fn kevent
684system call
685returns the number of events placed in the
686.Fa eventlist ,
687up to the value given by
688.Fa nevents .
689If an error occurs while processing an element of the
690.Fa changelist
691and there is enough room in the
692.Fa eventlist ,
693then the event will be placed in the
694.Fa eventlist
695with
696.Dv EV_ERROR
697set in
698.Va flags
699and the system error in
700.Va data .
701Otherwise,
702.Dv -1
703will be returned, and
704.Dv errno
705will be set to indicate the error condition.
706If the time limit expires, then
707.Fn kevent
708returns 0.
709.Sh EXAMPLES
710.Bd -literal -compact
711#include <sys/event.h>
712#include <err.h>
713#include <fcntl.h>
714#include <stdio.h>
715#include <stdlib.h>
716#include <string.h>
717
718int
719main(int argc, char **argv)
720{
721    struct kevent event;    /* Event we want to monitor */
722    struct kevent tevent;   /* Event triggered */
723    int kq, fd, ret;
724
725    if (argc != 2)
726	err(EXIT_FAILURE, "Usage: %s path\en", argv[0]);
727    fd = open(argv[1], O_RDONLY);
728    if (fd == -1)
729	err(EXIT_FAILURE, "Failed to open '%s'", argv[1]);
730
731    /* Create kqueue. */
732    kq = kqueue();
733    if (kq == -1)
734	err(EXIT_FAILURE, "kqueue() failed");
735
736    /* Initialize kevent structure. */
737    EV_SET(&event, fd, EVFILT_VNODE, EV_ADD | EV_CLEAR, NOTE_WRITE,
738	0, NULL);
739    /* Attach event to the kqueue. */
740    ret = kevent(kq, &event, 1, NULL, 0, NULL);
741    if (ret == -1)
742	err(EXIT_FAILURE, "kevent register");
743    if (event.flags & EV_ERROR)
744	errx(EXIT_FAILURE, "Event error: %s", strerror(event.data));
745
746    for (;;) {
747	/* Sleep until something happens. */
748	ret = kevent(kq, NULL, 0, &tevent, 1, NULL);
749	if (ret == -1) {
750	    err(EXIT_FAILURE, "kevent wait");
751	} else if (ret > 0) {
752	    printf("Something was written in '%s'\en", argv[1]);
753	}
754    }
755}
756.Ed
757.Sh ERRORS
758The
759.Fn kqueue
760system call fails if:
761.Bl -tag -width Er
762.It Bq Er ENOMEM
763The kernel failed to allocate enough memory for the kernel queue.
764.It Bq Er ENOMEM
765The
766.Dv RLIMIT_KQUEUES
767rlimit
768(see
769.Xr getrlimit 2 )
770for the current user would be exceeded.
771.It Bq Er EMFILE
772The per-process descriptor table is full.
773.It Bq Er ENFILE
774The system file table is full.
775.El
776.Pp
777The
778.Fn kevent
779system call fails if:
780.Bl -tag -width Er
781.It Bq Er EACCES
782The process does not have permission to register a filter.
783.It Bq Er EFAULT
784There was an error reading or writing the
785.Va kevent
786structure.
787.It Bq Er EBADF
788The specified descriptor is invalid.
789.It Bq Er EINTR
790A signal was delivered before the timeout expired and before any
791events were placed on the kqueue for return.
792.It Bq Er EINTR
793A cancellation request was delivered to the thread, but not yet handled.
794.It Bq Er EINVAL
795The specified time limit or filter is invalid.
796.It Bq Er EINVAL
797The specified length of the event or change lists is negative.
798.It Bq Er ENOENT
799The event could not be found to be modified or deleted.
800.It Bq Er ENOMEM
801No memory was available to register the event
802or, in the special case of a timer, the maximum number of
803timers has been exceeded.
804This maximum is configurable via the
805.Va kern.kq_calloutmax
806sysctl.
807.It Bq Er ESRCH
808The specified process to attach to does not exist.
809.El
810.Pp
811When
812.Fn kevent
813call fails with
814.Er EINTR
815error, all changes in the
816.Fa changelist
817have been applied.
818.Sh SEE ALSO
819.Xr aio_error 2 ,
820.Xr aio_read 2 ,
821.Xr aio_return 2 ,
822.Xr poll 2 ,
823.Xr read 2 ,
824.Xr select 2 ,
825.Xr sigaction 2 ,
826.Xr write 2 ,
827.Xr pthread_setcancelstate 3 ,
828.Xr signal 3
829.Rs
830.%A Jonathan Lemon
831.%T "Kqueue: A Generic and Scalable Event Notification Facility"
832.%I USENIX Association
833.%B Proceedings of the FREENIX Track: 2001 USENIX Annual Technical Conference
834.%D June 25-30, 2001
835.\".http://www.usenix.org/event/usenix01/freenix01/full_papers/lemon/lemon.pdf
836.Re
837.Sh HISTORY
838The
839.Fn kqueue
840and
841.Fn kevent
842system calls first appeared in
843.Fx 4.1 .
844.Sh AUTHORS
845The
846.Fn kqueue
847system and this manual page were written by
848.An Jonathan Lemon Aq Mt [email protected] .
849.Sh BUGS
850The
851.Fa timeout
852value is limited to 24 hours; longer timeouts will be silently
853reinterpreted as 24 hours.
854.Pp
855In versions older than
856.Fx 12.0 ,
857.In sys/event.h
858failed to parse without including
859.In sys/types.h
860manually.
861