kqueue.2 (275806) | kqueue.2 (280818) |
---|---|
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. --- 8 unchanged lines hidden (view full) --- 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.\" | 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. --- 8 unchanged lines hidden (view full) --- 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: head/lib/libc/sys/kqueue.2 275806 2014-12-15 14:58:10Z kib $ | 25.\" $FreeBSD: head/lib/libc/sys/kqueue.2 280818 2015-03-29 19:14:41Z kib $ |
26.\" | 26.\" |
27.Dd July 18, 2014 | 27.Dd March 29, 2015 |
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/types.h 38.In sys/event.h 39.In sys/time.h 40.Ft int 41.Fn kqueue "void" 42.Ft int 43.Fn kevent "int kq" "const struct kevent *changelist" "int nchanges" "struct kevent *eventlist" "int nevents" "const struct timespec *timeout" | 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/types.h 38.In sys/event.h 39.In sys/time.h 40.Ft int 41.Fn kqueue "void" 42.Ft int 43.Fn kevent "int kq" "const struct kevent *changelist" "int nchanges" "struct kevent *eventlist" "int nevents" "const struct timespec *timeout" |
44.Fn EV_SET "&kev" ident filter flags fflags data udata | 44.Fn EV_SET "kev" ident filter flags fflags data udata |
45.Sh DESCRIPTION 46The 47.Fn kqueue 48system call 49provides a generic method of notifying the user when an event 50happens or a condition holds, based on the results of small 51pieces of kernel code termed filters. 52A kevent is identified by the (ident, filter) pair; there may only --- 492 unchanged lines hidden (view full) --- 545.It Dv NOTE_TRIGGER 546Cause the event to be triggered. 547.El 548.Pp 549On return, 550.Va fflags 551contains the users defined flags in the lower 24 bits. 552.El | 45.Sh DESCRIPTION 46The 47.Fn kqueue 48system call 49provides a generic method of notifying the user when an event 50happens or a condition holds, based on the results of small 51pieces of kernel code termed filters. 52A kevent is identified by the (ident, filter) pair; there may only --- 492 unchanged lines hidden (view full) --- 545.It Dv NOTE_TRIGGER 546Cause the event to be triggered. 547.El 548.Pp 549On return, 550.Va fflags 551contains the users defined flags in the lower 24 bits. 552.El |
553.Sh CANCELLATION BEHAVIOUR 554If 555.Fa nevents 556is non-zero, i.e. the function is potentially blocking, the call 557is a cancellation point. 558Otherwise, i.e. if 559.Fa nevents 560is zero, the call is not cancellable. 561Cancellation can only occur before any changes are made to the kqueue, 562or when the call was blocked and no changes to the queue were requested. |
|
553.Sh RETURN VALUES 554The 555.Fn kqueue 556system call 557creates a new kernel event queue and returns a file descriptor. 558If there was an error creating the kernel event queue, a value of -1 is 559returned and errno set. 560.Pp --- 54 unchanged lines hidden (view full) --- 615There was an error reading or writing the 616.Va kevent 617structure. 618.It Bq Er EBADF 619The specified descriptor is invalid. 620.It Bq Er EINTR 621A signal was delivered before the timeout expired and before any 622events were placed on the kqueue for return. | 563.Sh RETURN VALUES 564The 565.Fn kqueue 566system call 567creates a new kernel event queue and returns a file descriptor. 568If there was an error creating the kernel event queue, a value of -1 is 569returned and errno set. 570.Pp --- 54 unchanged lines hidden (view full) --- 625There was an error reading or writing the 626.Va kevent 627structure. 628.It Bq Er EBADF 629The specified descriptor is invalid. 630.It Bq Er EINTR 631A signal was delivered before the timeout expired and before any 632events were placed on the kqueue for return. |
633.It Bq Er EINTR 634A cancellation request was delivered to the thread, but not yet handled. |
|
623.It Bq Er EINVAL 624The specified time limit or filter is invalid. 625.It Bq Er ENOENT 626The event could not be found to be modified or deleted. 627.It Bq Er ENOMEM 628No memory was available to register the event 629or, in the special case of a timer, the maximum number of 630timers has been exceeded. 631This maximum is configurable via the 632.Va kern.kq_calloutmax 633sysctl. 634.It Bq Er ESRCH 635The specified process to attach to does not exist. 636.El | 635.It Bq Er EINVAL 636The specified time limit or filter is invalid. 637.It Bq Er ENOENT 638The event could not be found to be modified or deleted. 639.It Bq Er ENOMEM 640No memory was available to register the event 641or, in the special case of a timer, the maximum number of 642timers has been exceeded. 643This maximum is configurable via the 644.Va kern.kq_calloutmax 645sysctl. 646.It Bq Er ESRCH 647The specified process to attach to does not exist. 648.El |
649.Pp 650When 651.Fn kevent 652call fails with 653.Er EINTR 654error, all changes in the 655.Fa changelist 656have been applied. |
|
637.Sh SEE ALSO 638.Xr aio_error 2 , 639.Xr aio_read 2 , 640.Xr aio_return 2 , 641.Xr poll 2 , 642.Xr read 2 , 643.Xr select 2 , 644.Xr sigaction 2 , 645.Xr write 2 , | 657.Sh SEE ALSO 658.Xr aio_error 2 , 659.Xr aio_read 2 , 660.Xr aio_return 2 , 661.Xr poll 2 , 662.Xr read 2 , 663.Xr select 2 , 664.Xr sigaction 2 , 665.Xr write 2 , |
666.Xr pthread_setcancelstate 3 , |
|
646.Xr signal 3 647.Sh HISTORY 648The 649.Fn kqueue 650and 651.Fn kevent 652system calls first appeared in 653.Fx 4.1 . 654.Sh AUTHORS 655The 656.Fn kqueue 657system and this manual page were written by 658.An Jonathan Lemon Aq Mt jlemon@FreeBSD.org . 659.Sh BUGS 660The 661.Fa timeout 662value is limited to 24 hours; longer timeouts will be silently 663reinterpreted as 24 hours. | 667.Xr signal 3 668.Sh HISTORY 669The 670.Fn kqueue 671and 672.Fn kevent 673system calls first appeared in 674.Fx 4.1 . 675.Sh AUTHORS 676The 677.Fn kqueue 678system and this manual page were written by 679.An Jonathan Lemon Aq Mt jlemon@FreeBSD.org . 680.Sh BUGS 681The 682.Fa timeout 683value is limited to 24 hours; longer timeouts will be silently 684reinterpreted as 24 hours. |