| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: kfilter_register.9,v 1.10 2008/04/30 13:10:58 martin Exp $ | | 1 | .\" $NetBSD: kfilter_register.9,v 1.11 2020/10/31 16:03:01 christos Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. | | 3 | .\" Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" This documentation is derived from text contributed by | | 6 | .\" This documentation is derived from text contributed by |
7 | .\" Luke Mewburn. | | 7 | .\" Luke Mewburn. |
8 | .\" | | 8 | .\" |
9 | .\" Redistribution and use in source and binary forms, with or without | | 9 | .\" Redistribution and use in source and binary forms, with or without |
10 | .\" modification, are permitted provided that the following conditions | | 10 | .\" modification, are permitted provided that the following conditions |
11 | .\" are met: | | 11 | .\" are met: |
12 | .\" 1. Redistributions of source code must retain the above copyright | | 12 | .\" 1. Redistributions of source code must retain the above copyright |
13 | .\" notice, this list of conditions and the following disclaimer. | | 13 | .\" notice, this list of conditions and the following disclaimer. |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 14 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | .\" | | 17 | .\" |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | .\" POSSIBILITY OF SUCH DAMAGE. | | 28 | .\" POSSIBILITY OF SUCH DAMAGE. |
29 | .\" | | 29 | .\" |
30 | .Dd October 23, 2002 | | 30 | .Dd October 31, 2020 |
31 | .Dt KFILTER_REGISTER 9 | | 31 | .Dt KFILTER_REGISTER 9 |
32 | .Os | | 32 | .Os |
33 | .Sh NAME | | 33 | .Sh NAME |
34 | .Nm kfilter_register , | | 34 | .Nm kfilter_register , |
35 | .Nm kfilter_unregister | | 35 | .Nm kfilter_unregister |
36 | .Nd add or remove kernel event filters | | 36 | .Nd add or remove kernel event filters |
37 | .Sh SYNOPSIS | | 37 | .Sh SYNOPSIS |
38 | .In sys/event.h | | 38 | .In sys/event.h |
39 | .Ft int | | 39 | .Ft int |
40 | .Fn kfilter_register "const char *name" "struct filterops *filtops" "int *retfilter" | | 40 | .Fn kfilter_register "const char *name" "struct filterops *filtops" "int *retfilter" |
41 | .Ft int | | 41 | .Ft int |
42 | .Fn kfilter_unregister "const char *name" | | 42 | .Fn kfilter_unregister "const char *name" |
43 | .Sh DESCRIPTION | | 43 | .Sh DESCRIPTION |
| @@ -87,26 +87,31 @@ and are documented in | | | @@ -87,26 +87,31 @@ and are documented in |
87 | .Pp | | 87 | .Pp |
88 | The | | 88 | The |
89 | .Va filterops | | 89 | .Va filterops |
90 | structure is defined as follows: | | 90 | structure is defined as follows: |
91 | .Bd -literal -offset indent | | 91 | .Bd -literal -offset indent |
92 | struct filterops { | | 92 | struct filterops { |
93 | int f_isfd; /* true if ident == filedescriptor */ | | 93 | int f_isfd; /* true if ident == filedescriptor */ |
94 | int (*f_attach)(struct knote *kn); | | 94 | int (*f_attach)(struct knote *kn); |
95 | /* called when knote is ADDed */ | | 95 | /* called when knote is ADDed */ |
96 | void (*f_detach)(struct knote *kn); | | 96 | void (*f_detach)(struct knote *kn); |
97 | /* called when knote is DELETEd */ | | 97 | /* called when knote is DELETEd */ |
98 | int (*f_event)(struct knote *kn, long hint); | | 98 | int (*f_event)(struct knote *kn, long hint); |
99 | /* called when event is triggered */ | | 99 | /* called when event is triggered */ |
| | | 100 | void (*f_touch)(struct knote *kn, struct kevent *kev, long hint); |
| | | 101 | /* called during registration and event |
| | | 102 | * processing to provide custom handling |
| | | 103 | * of event fflags and data |
| | | 104 | */ |
100 | }; | | 105 | }; |
101 | .Ed | | 106 | .Ed |
102 | .Pp | | 107 | .Pp |
103 | If the filter operation is for a file descriptor, | | 108 | If the filter operation is for a file descriptor, |
104 | .Va f_isfd | | 109 | .Va f_isfd |
105 | should be non-zero, otherwise it should be zero. | | 110 | should be non-zero, otherwise it should be zero. |
106 | This controls where the | | 111 | This controls where the |
107 | .Xr kqueue 2 | | 112 | .Xr kqueue 2 |
108 | system stores the knotes for an object. | | 113 | system stores the knotes for an object. |
109 | .Sh RETURN VALUES | | 114 | .Sh RETURN VALUES |
110 | .Fn kfilter_register | | 115 | .Fn kfilter_register |
111 | returns 0 on success, | | 116 | returns 0 on success, |
112 | .Er EINVAL | | 117 | .Er EINVAL |