xref: /freebsd-14.2/lib/libc/sys/kqueue.2 (revision 2300a22c)
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 May 14, 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.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.Xr listen 2
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, when the descriptor is attached to an interface the filter
394always indicates that it is possible to write 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
483in the same format as the status returned by
484.Xr wait 2 .
485.It Dv NOTE_FORK
486The process has called
487.Fn fork .
488.It Dv NOTE_EXEC
489The process has executed a new process via
490.Xr execve 2
491or a similar call.
492.It Dv NOTE_TRACK
493Follow a process across
494.Fn fork
495calls.
496The parent process registers a new kevent to monitor the child process
497using the same
498.Va fflags
499as the original event.
500The child process will signal an event with
501.Dv NOTE_CHILD
502set in
503.Va fflags
504and the parent PID in
505.Va data .
506.Pp
507If the parent process fails to register a new kevent
508.Pq usually due to resource limitations ,
509it will signal an event with
510.Dv NOTE_TRACKERR
511set in
512.Va fflags ,
513and the child process will not signal a
514.Dv NOTE_CHILD
515event.
516.El
517.Pp
518On return,
519.Va fflags
520contains the events which triggered the filter.
521.It Dv EVFILT_PROCDESC
522Takes the process descriptor created by
523.Xr pdfork 2
524to monitor as the identifier and the events to watch for in
525.Va fflags ,
526and returns when the associated process performs one or more of the
527requested events.
528The events to monitor are:
529.Bl -tag -width "Dv NOTE_EXIT"
530.It Dv NOTE_EXIT
531The process has exited.
532The exit status will be stored in
533.Va data .
534.El
535.Pp
536On return,
537.Va fflags
538contains the events which triggered the filter.
539.It Dv EVFILT_SIGNAL
540Takes the signal number to monitor as the identifier and returns
541when the given signal is delivered to the process.
542This coexists with the
543.Fn signal
544and
545.Fn sigaction
546facilities, and has a lower precedence.
547The filter will record
548all attempts to deliver a signal to a process, even if the signal has
549been marked as
550.Dv SIG_IGN ,
551except for the
552.Dv SIGCHLD
553signal, which, if ignored, will not be recorded by the filter.
554Event notification happens after normal
555signal delivery processing.
556.Va data
557returns the number of times the signal has occurred since the last call to
558.Fn kevent .
559This filter automatically sets the
560.Dv EV_CLEAR
561flag internally.
562.It Dv EVFILT_TIMER
563Establishes an arbitrary timer identified by
564.Va ident .
565When adding a timer,
566.Va data
567specifies the moment to fire the timer (for
568.Dv NOTE_ABSTIME )
569or the timeout period.
570The timer will be periodic unless
571.Dv EV_ONESHOT
572or
573.Dv NOTE_ABSTIME
574is specified.
575On return,
576.Va data
577contains the number of times the timeout has expired since the last call to
578.Fn kevent .
579For non-monotonic timers, this filter automatically sets the
580.Dv EV_CLEAR
581flag internally.
582.Pp
583The filter accepts the following flags in the
584.Va fflags
585argument:
586.Bl -tag -width "Dv NOTE_MSECONDS"
587.It Dv NOTE_SECONDS
588.Va data
589is in seconds.
590.It Dv NOTE_MSECONDS
591.Va data
592is in milliseconds.
593.It Dv NOTE_USECONDS
594.Va data
595is in microseconds.
596.It Dv NOTE_NSECONDS
597.Va data
598is in nanoseconds.
599.It Dv NOTE_ABSTIME
600The specified expiration time is absolute.
601.El
602.Pp
603If
604.Va fflags
605is not set, the default is milliseconds.
606On return,
607.Va fflags
608contains the events which triggered the filter.
609.Pp
610Periodic timers with a specified timeout of 0 will be silently adjusted to
611timeout after 1 of the time units specified by the requested precision in
612.Va fflags .
613If an absolute time is specified that has already passed, then it is treated as
614if the current time were specified and the event will fire as soon as possible.
615.Pp
616If an existing timer is re-added, the existing timer will be
617effectively canceled (throwing away any undelivered record of previous
618timer expiration) and re-started using the new parameters contained in
619.Va data
620and
621.Va fflags .
622.Pp
623There is a system wide limit on the number of timers
624which is controlled by the
625.Va kern.kq_calloutmax
626sysctl.
627.It Dv EVFILT_USER
628Establishes a user event identified by
629.Va ident
630which is not associated with any kernel mechanism but is triggered by
631user level code.
632The lower 24 bits of the
633.Va fflags
634may be used for user defined flags and manipulated using the following:
635.Bl -tag -width "Dv NOTE_FFLAGSMASK"
636.It Dv NOTE_FFNOP
637Ignore the input
638.Va fflags .
639.It Dv NOTE_FFAND
640Bitwise AND
641.Va fflags .
642.It Dv NOTE_FFOR
643Bitwise OR
644.Va fflags .
645.It Dv NOTE_FFCOPY
646Copy
647.Va fflags .
648.It Dv NOTE_FFCTRLMASK
649Control mask for
650.Va fflags .
651.It Dv NOTE_FFLAGSMASK
652User defined flag mask for
653.Va fflags .
654.El
655.Pp
656A user event is triggered for output with the following:
657.Bl -tag -width "Dv NOTE_FFLAGSMASK"
658.It Dv NOTE_TRIGGER
659Cause the event to be triggered.
660.El
661.Pp
662On return,
663.Va fflags
664contains the users defined flags in the lower 24 bits.
665.El
666.Sh CANCELLATION BEHAVIOUR
667If
668.Fa nevents
669is non-zero, i.e., the function is potentially blocking, the call
670is a cancellation point.
671Otherwise, i.e., if
672.Fa nevents
673is zero, the call is not cancellable.
674Cancellation can only occur before any changes are made to the kqueue,
675or when the call was blocked and no changes to the queue were requested.
676.Sh RETURN VALUES
677The
678.Fn kqueue
679system call
680creates a new kernel event queue and returns a file descriptor.
681If there was an error creating the kernel event queue, a value of -1 is
682returned and errno set.
683.Pp
684The
685.Fn kevent
686system call
687returns the number of events placed in the
688.Fa eventlist ,
689up to the value given by
690.Fa nevents .
691If an error occurs while processing an element of the
692.Fa changelist
693and there is enough room in the
694.Fa eventlist ,
695then the event will be placed in the
696.Fa eventlist
697with
698.Dv EV_ERROR
699set in
700.Va flags
701and the system error in
702.Va data .
703Otherwise,
704.Dv -1
705will be returned, and
706.Dv errno
707will be set to indicate the error condition.
708If the time limit expires, then
709.Fn kevent
710returns 0.
711.Sh EXAMPLES
712.Bd -literal -compact
713#include <sys/event.h>
714#include <err.h>
715#include <fcntl.h>
716#include <stdio.h>
717#include <stdlib.h>
718#include <string.h>
719
720int
721main(int argc, char **argv)
722{
723    struct kevent event;    /* Event we want to monitor */
724    struct kevent tevent;   /* Event triggered */
725    int kq, fd, ret;
726
727    if (argc != 2)
728	err(EXIT_FAILURE, "Usage: %s path\en", argv[0]);
729    fd = open(argv[1], O_RDONLY);
730    if (fd == -1)
731	err(EXIT_FAILURE, "Failed to open '%s'", argv[1]);
732
733    /* Create kqueue. */
734    kq = kqueue();
735    if (kq == -1)
736	err(EXIT_FAILURE, "kqueue() failed");
737
738    /* Initialize kevent structure. */
739    EV_SET(&event, fd, EVFILT_VNODE, EV_ADD | EV_CLEAR, NOTE_WRITE,
740	0, NULL);
741    /* Attach event to the kqueue. */
742    ret = kevent(kq, &event, 1, NULL, 0, NULL);
743    if (ret == -1)
744	err(EXIT_FAILURE, "kevent register");
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	    if (tevent.flags & EV_ERROR)
753		errx(EXIT_FAILURE, "Event error: %s", strerror(event.data));
754	    else
755		printf("Something was written in '%s'\en", argv[1]);
756}
757
758    }
759}
760.Ed
761.Sh ERRORS
762The
763.Fn kqueue
764system call fails if:
765.Bl -tag -width Er
766.It Bq Er ENOMEM
767The kernel failed to allocate enough memory for the kernel queue.
768.It Bq Er ENOMEM
769The
770.Dv RLIMIT_KQUEUES
771rlimit
772(see
773.Xr getrlimit 2 )
774for the current user would be exceeded.
775.It Bq Er EMFILE
776The per-process descriptor table is full.
777.It Bq Er ENFILE
778The system file table is full.
779.El
780.Pp
781The
782.Fn kevent
783system call fails if:
784.Bl -tag -width Er
785.It Bq Er EACCES
786The process does not have permission to register a filter.
787.It Bq Er EFAULT
788There was an error reading or writing the
789.Va kevent
790structure.
791.It Bq Er EBADF
792The specified descriptor is invalid.
793.It Bq Er EINTR
794A signal was delivered before the timeout expired and before any
795events were placed on the kqueue for return.
796.It Bq Er EINTR
797A cancellation request was delivered to the thread, but not yet handled.
798.It Bq Er EINVAL
799The specified time limit or filter is invalid.
800.It Bq Er EINVAL
801The specified length of the event or change lists is negative.
802.It Bq Er ENOENT
803The event could not be found to be modified or deleted.
804.It Bq Er ENOMEM
805No memory was available to register the event
806or, in the special case of a timer, the maximum number of
807timers has been exceeded.
808This maximum is configurable via the
809.Va kern.kq_calloutmax
810sysctl.
811.It Bq Er ESRCH
812The specified process to attach to does not exist.
813.El
814.Pp
815When
816.Fn kevent
817call fails with
818.Er EINTR
819error, all changes in the
820.Fa changelist
821have been applied.
822.Sh SEE ALSO
823.Xr aio_error 2 ,
824.Xr aio_read 2 ,
825.Xr aio_return 2 ,
826.Xr poll 2 ,
827.Xr read 2 ,
828.Xr select 2 ,
829.Xr sigaction 2 ,
830.Xr write 2 ,
831.Xr pthread_setcancelstate 3 ,
832.Xr signal 3
833.Rs
834.%A Jonathan Lemon
835.%T "Kqueue: A Generic and Scalable Event Notification Facility"
836.%I USENIX Association
837.%B Proceedings of the FREENIX Track: 2001 USENIX Annual Technical Conference
838.%D June 25-30, 2001
839.\".http://www.usenix.org/event/usenix01/freenix01/full_papers/lemon/lemon.pdf
840.Re
841.Sh HISTORY
842The
843.Fn kqueue
844and
845.Fn kevent
846system calls first appeared in
847.Fx 4.1 .
848.Sh AUTHORS
849The
850.Fn kqueue
851system and this manual page were written by
852.An Jonathan Lemon Aq Mt [email protected] .
853.Sh BUGS
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