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