| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: sys_epoll.c,v 1.1 2023/07/28 18:19:01 christos Exp $ */ | | 1 | /* $NetBSD: sys_epoll.c,v 1.2 2023/07/29 04:06:32 pgoyette Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * SPDX-License-Identifier: BSD-2-Clause | | 4 | * SPDX-License-Identifier: BSD-2-Clause |
5 | * | | 5 | * |
6 | * Copyright (c) 2007 Roman Divacky | | 6 | * Copyright (c) 2007 Roman Divacky |
7 | * Copyright (c) 2014 Dmitry Chagin <dchagin@FreeBSD.org> | | 7 | * Copyright (c) 2014 Dmitry Chagin <dchagin@FreeBSD.org> |
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 |
| @@ -18,27 +18,27 @@ | | | @@ -18,27 +18,27 @@ |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | * SUCH DAMAGE. | | 28 | * SUCH DAMAGE. |
29 | */ | | 29 | */ |
30 | #include <sys/cdefs.h> | | 30 | #include <sys/cdefs.h> |
31 | __KERNEL_RCSID(0, "$NetBSD: sys_epoll.c,v 1.1 2023/07/28 18:19:01 christos Exp $"); | | 31 | __KERNEL_RCSID(0, "$NetBSD: sys_epoll.c,v 1.2 2023/07/29 04:06:32 pgoyette Exp $"); |
32 | | | 32 | |
33 | | | 33 | |
34 | #include <sys/param.h> | | 34 | #include <sys/param.h> |
35 | #include <sys/types.h> | | 35 | #include <sys/types.h> |
36 | #include <sys/bitops.h> | | 36 | #include <sys/bitops.h> |
37 | #include <sys/epoll.h> | | 37 | #include <sys/epoll.h> |
38 | #include <sys/event.h> | | 38 | #include <sys/event.h> |
39 | #include <sys/eventvar.h> | | 39 | #include <sys/eventvar.h> |
40 | #include <sys/errno.h> | | 40 | #include <sys/errno.h> |
41 | #include <sys/file.h> | | 41 | #include <sys/file.h> |
42 | #include <sys/filedesc.h> | | 42 | #include <sys/filedesc.h> |
43 | #include <sys/fcntl.h> | | 43 | #include <sys/fcntl.h> |
44 | #include <sys/proc.h> | | 44 | #include <sys/proc.h> |
| @@ -315,27 +315,27 @@ epoll_ctl_common(struct lwp *l, register | | | @@ -315,27 +315,27 @@ epoll_ctl_common(struct lwp *l, register |
315 | case EPOLL_CTL_ADD: | | 315 | case EPOLL_CTL_ADD: |
316 | if (epoll_fd_registered(retval, epfd, fd)) | | 316 | if (epoll_fd_registered(retval, epfd, fd)) |
317 | return EEXIST; | | 317 | return EEXIST; |
318 | error = epoll_check_loop_and_depth(l, epfd, fd); | | 318 | error = epoll_check_loop_and_depth(l, epfd, fd); |
319 | if (error != 0) | | 319 | if (error != 0) |
320 | return error; | | 320 | return error; |
321 | break; | | 321 | break; |
322 | | | 322 | |
323 | case EPOLL_CTL_DEL: | | 323 | case EPOLL_CTL_DEL: |
324 | /* CTL_DEL means unregister this fd with this epoll */ | | 324 | /* CTL_DEL means unregister this fd with this epoll */ |
325 | return epoll_delete_all_events(retval, epfd, fd); | | 325 | return epoll_delete_all_events(retval, epfd, fd); |
326 | | | 326 | |
327 | default: | | 327 | default: |
328 | DPRINTF(("%s: invalid op %d\n", ___func__, op)); | | 328 | DPRINTF(("%s: invalid op %d\n", __func__, op)); |
329 | return EINVAL; | | 329 | return EINVAL; |
330 | } | | 330 | } |
331 | | | 331 | |
332 | error = kevent1(retval, epfd, kev, nchanges, NULL, 0, NULL, &k_ops); | | 332 | error = kevent1(retval, epfd, kev, nchanges, NULL, 0, NULL, &k_ops); |
333 | | | 333 | |
334 | if (error == EOPNOTSUPP) { | | 334 | if (error == EOPNOTSUPP) { |
335 | error = EPERM; | | 335 | error = EPERM; |
336 | } | | 336 | } |
337 | | | 337 | |
338 | return error; | | 338 | return error; |
339 | } | | 339 | } |
340 | | | 340 | |
341 | /* | | 341 | /* |