| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: uipc_socket.c,v 1.177.4.2 2009/04/04 23:36:27 snj Exp $ */ | | 1 | /* $NetBSD: uipc_socket.c,v 1.177.4.2.2.1 2009/05/03 13:26:34 bouyer Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of Wasabi Systems, Inc, and by Andrew Doran. | | 8 | * by Jason R. Thorpe of Wasabi Systems, Inc, and by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -53,27 +53,27 @@ | | | @@ -53,27 +53,27 @@ |
53 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 53 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
54 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 54 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
55 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 55 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
56 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 56 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
57 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 57 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
58 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 58 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
59 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 59 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
60 | * SUCH DAMAGE. | | 60 | * SUCH DAMAGE. |
61 | * | | 61 | * |
62 | * @(#)uipc_socket.c 8.6 (Berkeley) 5/2/95 | | 62 | * @(#)uipc_socket.c 8.6 (Berkeley) 5/2/95 |
63 | */ | | 63 | */ |
64 | | | 64 | |
65 | #include <sys/cdefs.h> | | 65 | #include <sys/cdefs.h> |
66 | __KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.177.4.2 2009/04/04 23:36:27 snj Exp $"); | | 66 | __KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.177.4.2.2.1 2009/05/03 13:26:34 bouyer Exp $"); |
67 | | | 67 | |
68 | #include "opt_sock_counters.h" | | 68 | #include "opt_sock_counters.h" |
69 | #include "opt_sosend_loan.h" | | 69 | #include "opt_sosend_loan.h" |
70 | #include "opt_mbuftrace.h" | | 70 | #include "opt_mbuftrace.h" |
71 | #include "opt_somaxkva.h" | | 71 | #include "opt_somaxkva.h" |
72 | #include "opt_multiprocessor.h" /* XXX */ | | 72 | #include "opt_multiprocessor.h" /* XXX */ |
73 | | | 73 | |
74 | #include <sys/param.h> | | 74 | #include <sys/param.h> |
75 | #include <sys/systm.h> | | 75 | #include <sys/systm.h> |
76 | #include <sys/proc.h> | | 76 | #include <sys/proc.h> |
77 | #include <sys/file.h> | | 77 | #include <sys/file.h> |
78 | #include <sys/filedesc.h> | | 78 | #include <sys/filedesc.h> |
79 | #include <sys/kmem.h> | | 79 | #include <sys/kmem.h> |
| @@ -2033,27 +2033,27 @@ sockopt_getmbuf(const struct sockopt *so | | | @@ -2033,27 +2033,27 @@ sockopt_getmbuf(const struct sockopt *so |
2033 | } | | 2033 | } |
2034 | | | 2034 | |
2035 | memcpy(mtod(m, void *), sopt->sopt_data, sopt->sopt_size); | | 2035 | memcpy(mtod(m, void *), sopt->sopt_data, sopt->sopt_size); |
2036 | m->m_len = sopt->sopt_size; | | 2036 | m->m_len = sopt->sopt_size; |
2037 | | | 2037 | |
2038 | return m; | | 2038 | return m; |
2039 | } | | 2039 | } |
2040 | | | 2040 | |
2041 | void | | 2041 | void |
2042 | sohasoutofband(struct socket *so) | | 2042 | sohasoutofband(struct socket *so) |
2043 | { | | 2043 | { |
2044 | | | 2044 | |
2045 | fownsignal(so->so_pgid, SIGURG, POLL_PRI, POLLPRI|POLLRDBAND, so); | | 2045 | fownsignal(so->so_pgid, SIGURG, POLL_PRI, POLLPRI|POLLRDBAND, so); |
2046 | selnotify(&so->so_rcv.sb_sel, POLLPRI | POLLRDBAND, 0); | | 2046 | selnotify(&so->so_rcv.sb_sel, POLLPRI | POLLRDBAND, NOTE_SUBMIT); |
2047 | } | | 2047 | } |
2048 | | | 2048 | |
2049 | static void | | 2049 | static void |
2050 | filt_sordetach(struct knote *kn) | | 2050 | filt_sordetach(struct knote *kn) |
2051 | { | | 2051 | { |
2052 | struct socket *so; | | 2052 | struct socket *so; |
2053 | | | 2053 | |
2054 | so = ((file_t *)kn->kn_obj)->f_data; | | 2054 | so = ((file_t *)kn->kn_obj)->f_data; |
2055 | solock(so); | | 2055 | solock(so); |
2056 | SLIST_REMOVE(&so->so_rcv.sb_sel.sel_klist, kn, knote, kn_selnext); | | 2056 | SLIST_REMOVE(&so->so_rcv.sb_sel.sel_klist, kn, knote, kn_selnext); |
2057 | if (SLIST_EMPTY(&so->so_rcv.sb_sel.sel_klist)) | | 2057 | if (SLIST_EMPTY(&so->so_rcv.sb_sel.sel_klist)) |
2058 | so->so_rcv.sb_flags &= ~SB_KNOTE; | | 2058 | so->so_rcv.sb_flags &= ~SB_KNOTE; |
2059 | sounlock(so); | | 2059 | sounlock(so); |