xref: /freebsd-14.2/lib/libc/sys/kqueue.2 (revision ecac5c29)
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 September 23, 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.  This allows other aspects of the
271event to be modified without requiring the caller to know the
272.Fa udata
273value presently associated.
274This is especially useful with
275.Dv NOTE_TRIGGER
276or flags like
277.Dv EV_ENABLE.
278This flag may not be used with
279.Dv EV_ADD.
280.El
281.Pp
282The predefined system filters are listed below.
283Arguments may be passed to and from the filter via the
284.Va fflags
285and
286.Va data
287fields in the kevent structure.
288.Bl -tag -width "Dv EVFILT_PROCDESC"
289.It Dv EVFILT_READ
290Takes a descriptor as the identifier, and returns whenever
291there is data available to read.
292The behavior of the filter is slightly different depending
293on the descriptor type.
294.Bl -tag -width 2n
295.It Sockets
296Sockets which have previously been passed to
297.Fn listen
298return when there is an incoming connection pending.
299.Va data
300contains the size of the listen backlog.
301.Pp
302Other socket descriptors return when there is data to be read,
303subject to the
304.Dv SO_RCVLOWAT
305value of the socket buffer.
306This may be overridden with a per-filter low water mark at the
307time the filter is added by setting the
308.Dv NOTE_LOWAT
309flag in
310.Va fflags ,
311and specifying the new low water mark in
312.Va data .
313On return,
314.Va data
315contains the number of bytes of protocol data available to read.
316.Pp
317If the read direction of the socket has shutdown, then the filter
318also sets
319.Dv EV_EOF
320in
321.Va flags ,
322and returns the socket error (if any) in
323.Va fflags .
324It is possible for EOF to be returned (indicating the connection is gone)
325while there is still data pending in the socket buffer.
326.It Vnodes
327Returns when the file pointer is not at the end of file.
328.Va data
329contains the offset from current position to end of file,
330and may be negative.
331.Pp
332This behavior is different from
333.Xr poll 2 ,
334where read events are triggered for regular files unconditionally.
335This event can be triggered unconditionally by setting the
336.Dv NOTE_FILE_POLL
337flag in
338.Va fflags .
339.It "Fifos, Pipes"
340Returns when the there is data to read;
341.Va data
342contains the number of bytes available.
343.Pp
344When the last writer disconnects, the filter will set
345.Dv EV_EOF
346in
347.Va flags .
348This will be cleared by the filter when a new writer connects,
349at which point the
350filter will resume waiting for data to become available before
351returning.
352.It "BPF devices"
353Returns when the BPF buffer is full, the BPF timeout has expired, or
354when the BPF has
355.Dq immediate mode
356enabled and there is any data to read;
357.Va data
358contains the number of bytes available.
359.It Eventfds
360Returns when the counter is greater than 0;
361.Va data
362contains the counter value, which must be cast to
363.Vt uint64_t .
364.It Kqueues
365Returns when pending events are present on the queue;
366.Va data
367contains the number of events available.
368.El
369.It Dv EVFILT_WRITE
370Takes a descriptor as the identifier, and returns whenever
371it is possible to write to the descriptor.
372For sockets, pipes
373and fifos,
374.Va data
375will contain the amount of space remaining in the write buffer.
376The filter will set
377.Dv EV_EOF
378when the reader disconnects, and for the fifo case, this will be cleared
379when a new reader connects.
380Note that this filter is not supported for vnodes or BPF devices.
381.Pp
382For sockets, the low water mark and socket error handling is
383identical to the
384.Dv EVFILT_READ
385case.
386.Pp
387For eventfds,
388.Va data
389will contain the maximum value that can be added to the counter
390without blocking.
391.It Dv EVFILT_EMPTY
392Takes a descriptor as the identifier, and returns whenever
393there is no remaining data in the write buffer.
394.It Dv EVFILT_AIO
395Events for this filter are not registered with
396.Fn kevent
397directly but are registered via the
398.Va aio_sigevent
399member of an asynchronous I/O request when it is scheduled via an
400asynchronous I/O system call such as
401.Fn aio_read .
402The filter returns under the same conditions as
403.Fn aio_error .
404For more details on this filter see
405.Xr sigevent 3 and
406.Xr aio 4 .
407.It Dv EVFILT_VNODE
408Takes a file descriptor as the identifier and the events to watch for in
409.Va fflags ,
410and returns when one or more of the requested events occurs on the descriptor.
411The events to monitor are:
412.Bl -tag -width "Dv NOTE_CLOSE_WRITE"
413.It Dv NOTE_ATTRIB
414The file referenced by the descriptor had its attributes changed.
415.It Dv NOTE_CLOSE
416A file descriptor referencing the monitored file, was closed.
417The closed file descriptor did not have write access.
418.It Dv NOTE_CLOSE_WRITE
419A file descriptor referencing the monitored file, was closed.
420The closed file descriptor had write access.
421.Pp
422This note, as well as
423.Dv NOTE_CLOSE ,
424are not activated when files are closed forcibly by
425.Xr unmount 2 or
426.Xr revoke 2 .
427Instead,
428.Dv NOTE_REVOKE
429is sent for such events.
430.It Dv NOTE_DELETE
431The
432.Fn unlink
433system call was called on the file referenced by the descriptor.
434.It Dv NOTE_EXTEND
435For regular file, the file referenced by the descriptor was extended.
436.Pp
437For directory, reports that a directory entry was added or removed,
438as the result of rename operation.
439The
440.Dv NOTE_EXTEND
441event is not reported when a name is changed inside the directory.
442.It Dv NOTE_LINK
443The link count on the file changed.
444In particular, the
445.Dv NOTE_LINK
446event is reported if a subdirectory was created or deleted inside
447the directory referenced by the descriptor.
448.It Dv NOTE_OPEN
449The file referenced by the descriptor was opened.
450.It Dv NOTE_READ
451A read occurred on the file referenced by the descriptor.
452.It Dv NOTE_RENAME
453The file referenced by the descriptor was renamed.
454.It Dv NOTE_REVOKE
455Access to the file was revoked via
456.Xr revoke 2
457or the underlying file system was unmounted.
458.It Dv NOTE_WRITE
459A write occurred on the file referenced by the descriptor.
460.El
461.Pp
462On return,
463.Va fflags
464contains the events which triggered the filter.
465.It Dv EVFILT_PROC
466Takes the process ID to monitor as the identifier and the events to watch for
467in
468.Va fflags ,
469and returns when the process performs one or more of the requested events.
470If a process can normally see another process, it can attach an event to it.
471The events to monitor are:
472.Bl -tag -width "Dv NOTE_TRACKERR"
473.It Dv NOTE_EXIT
474The process has exited.
475The exit status will be stored in
476.Va data .
477.It Dv NOTE_FORK
478The process has called
479.Fn fork .
480.It Dv NOTE_EXEC
481The process has executed a new process via
482.Xr execve 2
483or a similar call.
484.It Dv NOTE_TRACK
485Follow a process across
486.Fn fork
487calls.
488The parent process registers a new kevent to monitor the child process
489using the same
490.Va fflags
491as the original event.
492The child process will signal an event with
493.Dv NOTE_CHILD
494set in
495.Va fflags
496and the parent PID in
497.Va data .
498.Pp
499If the parent process fails to register a new kevent
500.Pq usually due to resource limitations ,
501it will signal an event with
502.Dv NOTE_TRACKERR
503set in
504.Va fflags ,
505and the child process will not signal a
506.Dv NOTE_CHILD
507event.
508.El
509.Pp
510On return,
511.Va fflags
512contains the events which triggered the filter.
513.It Dv EVFILT_PROCDESC
514Takes the process descriptor created by
515.Xr pdfork 2
516to monitor as the identifier and the events to watch for in
517.Va fflags ,
518and returns when the associated process performs one or more of the
519requested events.
520The events to monitor are:
521.Bl -tag -width "Dv NOTE_EXIT"
522.It Dv NOTE_EXIT
523The process has exited.
524The exit status will be stored in
525.Va data .
526.El
527.Pp
528On return,
529.Va fflags
530contains the events which triggered the filter.
531.It Dv EVFILT_SIGNAL
532Takes the signal number to monitor as the identifier and returns
533when the given signal is delivered to the process.
534This coexists with the
535.Fn signal
536and
537.Fn sigaction
538facilities, and has a lower precedence.
539The filter will record
540all attempts to deliver a signal to a process, even if the signal has
541been marked as
542.Dv SIG_IGN ,
543except for the
544.Dv SIGCHLD
545signal, which, if ignored, will not be recorded by the filter.
546Event notification happens after normal
547signal delivery processing.
548.Va data
549returns the number of times the signal has occurred since the last call to
550.Fn kevent .
551This filter automatically sets the
552.Dv EV_CLEAR
553flag internally.
554.It Dv EVFILT_TIMER
555Establishes an arbitrary timer identified by
556.Va ident .
557When adding a timer,
558.Va data
559specifies the moment to fire the timer (for
560.Dv NOTE_ABSTIME )
561or the timeout period.
562The timer will be periodic unless
563.Dv EV_ONESHOT
564or
565.Dv NOTE_ABSTIME
566is specified.
567On return,
568.Va data
569contains the number of times the timeout has expired since the last call to
570.Fn kevent .
571For non-monotonic timers, this filter automatically sets the
572.Dv EV_CLEAR
573flag internally.
574.Pp
575The filter accepts the following flags in the
576.Va fflags
577argument:
578.Bl -tag -width "Dv NOTE_MSECONDS"
579.It Dv NOTE_SECONDS
580.Va data
581is in seconds.
582.It Dv NOTE_MSECONDS
583.Va data
584is in milliseconds.
585.It Dv NOTE_USECONDS
586.Va data
587is in microseconds.
588.It Dv NOTE_NSECONDS
589.Va data
590is in nanoseconds.
591.It Dv NOTE_ABSTIME
592The specified expiration time is absolute.
593.El
594.Pp
595If
596.Va fflags
597is not set, the default is milliseconds.
598On return,
599.Va fflags
600contains the events which triggered the filter.
601.Pp
602If an existing timer is re-added, the existing timer will be
603effectively canceled (throwing away any undelivered record of previous
604timer expiration) and re-started using the new parameters contained in
605.Va data
606and
607.Va fflags .
608.Pp
609There is a system wide limit on the number of timers
610which is controlled by the
611.Va kern.kq_calloutmax
612sysctl.
613.It Dv EVFILT_USER
614Establishes a user event identified by
615.Va ident
616which is not associated with any kernel mechanism but is triggered by
617user level code.
618The lower 24 bits of the
619.Va fflags
620may be used for user defined flags and manipulated using the following:
621.Bl -tag -width "Dv NOTE_FFLAGSMASK"
622.It Dv NOTE_FFNOP
623Ignore the input
624.Va fflags .
625.It Dv NOTE_FFAND
626Bitwise AND
627.Va fflags .
628.It Dv NOTE_FFOR
629Bitwise OR
630.Va fflags .
631.It Dv NOTE_FFCOPY
632Copy
633.Va fflags .
634.It Dv NOTE_FFCTRLMASK
635Control mask for
636.Va fflags .
637.It Dv NOTE_FFLAGSMASK
638User defined flag mask for
639.Va fflags .
640.El
641.Pp
642A user event is triggered for output with the following:
643.Bl -tag -width "Dv NOTE_FFLAGSMASK"
644.It Dv NOTE_TRIGGER
645Cause the event to be triggered.
646.El
647.Pp
648On return,
649.Va fflags
650contains the users defined flags in the lower 24 bits.
651.El
652.Sh CANCELLATION BEHAVIOUR
653If
654.Fa nevents
655is non-zero, i.e., the function is potentially blocking, the call
656is a cancellation point.
657Otherwise, i.e., if
658.Fa nevents
659is zero, the call is not cancellable.
660Cancellation can only occur before any changes are made to the kqueue,
661or when the call was blocked and no changes to the queue were requested.
662.Sh RETURN VALUES
663The
664.Fn kqueue
665system call
666creates a new kernel event queue and returns a file descriptor.
667If there was an error creating the kernel event queue, a value of -1 is
668returned and errno set.
669.Pp
670The
671.Fn kevent
672system call
673returns the number of events placed in the
674.Fa eventlist ,
675up to the value given by
676.Fa nevents .
677If an error occurs while processing an element of the
678.Fa changelist
679and there is enough room in the
680.Fa eventlist ,
681then the event will be placed in the
682.Fa eventlist
683with
684.Dv EV_ERROR
685set in
686.Va flags
687and the system error in
688.Va data .
689Otherwise,
690.Dv -1
691will be returned, and
692.Dv errno
693will be set to indicate the error condition.
694If the time limit expires, then
695.Fn kevent
696returns 0.
697.Sh EXAMPLES
698.Bd -literal -compact
699#include <sys/event.h>
700#include <err.h>
701#include <fcntl.h>
702#include <stdio.h>
703#include <stdlib.h>
704#include <string.h>
705
706int
707main(int argc, char **argv)
708{
709    struct kevent event;    /* Event we want to monitor */
710    struct kevent tevent;   /* Event triggered */
711    int kq, fd, ret;
712
713    if (argc != 2)
714	err(EXIT_FAILURE, "Usage: %s path\en", argv[0]);
715    fd = open(argv[1], O_RDONLY);
716    if (fd == -1)
717	err(EXIT_FAILURE, "Failed to open '%s'", argv[1]);
718
719    /* Create kqueue. */
720    kq = kqueue();
721    if (kq == -1)
722	err(EXIT_FAILURE, "kqueue() failed");
723
724    /* Initialize kevent structure. */
725    EV_SET(&event, fd, EVFILT_VNODE, EV_ADD | EV_CLEAR, NOTE_WRITE,
726	0, NULL);
727    /* Attach event to the kqueue. */
728    ret = kevent(kq, &event, 1, NULL, 0, NULL);
729    if (ret == -1)
730	err(EXIT_FAILURE, "kevent register");
731    if (event.flags & EV_ERROR)
732	errx(EXIT_FAILURE, "Event error: %s", strerror(event.data));
733
734    for (;;) {
735	/* Sleep until something happens. */
736	ret = kevent(kq, NULL, 0, &tevent, 1, NULL);
737	if (ret == -1) {
738	    err(EXIT_FAILURE, "kevent wait");
739	} else if (ret > 0) {
740	    printf("Something was written in '%s'\en", argv[1]);
741	}
742    }
743}
744.Ed
745.Sh ERRORS
746The
747.Fn kqueue
748system call fails if:
749.Bl -tag -width Er
750.It Bq Er ENOMEM
751The kernel failed to allocate enough memory for the kernel queue.
752.It Bq Er ENOMEM
753The
754.Dv RLIMIT_KQUEUES
755rlimit
756(see
757.Xr getrlimit 2 )
758for the current user would be exceeded.
759.It Bq Er EMFILE
760The per-process descriptor table is full.
761.It Bq Er ENFILE
762The system file table is full.
763.El
764.Pp
765The
766.Fn kevent
767system call fails if:
768.Bl -tag -width Er
769.It Bq Er EACCES
770The process does not have permission to register a filter.
771.It Bq Er EFAULT
772There was an error reading or writing the
773.Va kevent
774structure.
775.It Bq Er EBADF
776The specified descriptor is invalid.
777.It Bq Er EINTR
778A signal was delivered before the timeout expired and before any
779events were placed on the kqueue for return.
780.It Bq Er EINTR
781A cancellation request was delivered to the thread, but not yet handled.
782.It Bq Er EINVAL
783The specified time limit or filter is invalid.
784.It Bq Er EINVAL
785The specified length of the event or change lists is negative.
786.It Bq Er ENOENT
787The event could not be found to be modified or deleted.
788.It Bq Er ENOMEM
789No memory was available to register the event
790or, in the special case of a timer, the maximum number of
791timers has been exceeded.
792This maximum is configurable via the
793.Va kern.kq_calloutmax
794sysctl.
795.It Bq Er ESRCH
796The specified process to attach to does not exist.
797.El
798.Pp
799When
800.Fn kevent
801call fails with
802.Er EINTR
803error, all changes in the
804.Fa changelist
805have been applied.
806.Sh SEE ALSO
807.Xr aio_error 2 ,
808.Xr aio_read 2 ,
809.Xr aio_return 2 ,
810.Xr poll 2 ,
811.Xr read 2 ,
812.Xr select 2 ,
813.Xr sigaction 2 ,
814.Xr write 2 ,
815.Xr pthread_setcancelstate 3 ,
816.Xr signal 3
817.Rs
818.%A Jonathan Lemon
819.%T "Kqueue: A Generic and Scalable Event Notification Facility"
820.%I USENIX Association
821.%B Proceedings of the FREENIX Track: 2001 USENIX Annual Technical Conference
822.%D June 25-30, 2001
823.\".http://www.usenix.org/event/usenix01/freenix01/full_papers/lemon/lemon.pdf
824.Re
825.Sh HISTORY
826The
827.Fn kqueue
828and
829.Fn kevent
830system calls first appeared in
831.Fx 4.1 .
832.Sh AUTHORS
833The
834.Fn kqueue
835system and this manual page were written by
836.An Jonathan Lemon Aq Mt [email protected] .
837.Sh BUGS
838The
839.Fa timeout
840value is limited to 24 hours; longer timeouts will be silently
841reinterpreted as 24 hours.
842.Pp
843In versions older than
844.Fx 12.0 ,
845.In sys/event.h
846failed to parse without including
847.In sys/types.h
848manually.
849