| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: uipc_syscalls.c,v 1.136 2009/04/04 10:12:51 ad Exp $ */ | | 1 | /* $NetBSD: uipc_syscalls.c,v 1.137 2009/12/09 21:33:00 dsl Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 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 Andrew Doran. | | 8 | * 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. |
| @@ -51,27 +51,27 @@ | | | @@ -51,27 +51,27 @@ |
51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
58 | * SUCH DAMAGE. | | 58 | * SUCH DAMAGE. |
59 | * | | 59 | * |
60 | * @(#)uipc_syscalls.c 8.6 (Berkeley) 2/14/95 | | 60 | * @(#)uipc_syscalls.c 8.6 (Berkeley) 2/14/95 |
61 | */ | | 61 | */ |
62 | | | 62 | |
63 | #include <sys/cdefs.h> | | 63 | #include <sys/cdefs.h> |
64 | __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.136 2009/04/04 10:12:51 ad Exp $"); | | 64 | __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.137 2009/12/09 21:33:00 dsl Exp $"); |
65 | | | 65 | |
66 | #include "opt_pipe.h" | | 66 | #include "opt_pipe.h" |
67 | | | 67 | |
68 | #include <sys/param.h> | | 68 | #include <sys/param.h> |
69 | #include <sys/systm.h> | | 69 | #include <sys/systm.h> |
70 | #include <sys/filedesc.h> | | 70 | #include <sys/filedesc.h> |
71 | #include <sys/proc.h> | | 71 | #include <sys/proc.h> |
72 | #include <sys/file.h> | | 72 | #include <sys/file.h> |
73 | #include <sys/buf.h> | | 73 | #include <sys/buf.h> |
74 | #include <sys/malloc.h> | | 74 | #include <sys/malloc.h> |
75 | #include <sys/mbuf.h> | | 75 | #include <sys/mbuf.h> |
76 | #include <sys/protosw.h> | | 76 | #include <sys/protosw.h> |
77 | #include <sys/socket.h> | | 77 | #include <sys/socket.h> |
| @@ -307,27 +307,27 @@ do_sys_connect(struct lwp *l, int fd, st | | | @@ -307,27 +307,27 @@ do_sys_connect(struct lwp *l, int fd, st |
307 | error = EALREADY; | | 307 | error = EALREADY; |
308 | goto out; | | 308 | goto out; |
309 | } | | 309 | } |
310 | | | 310 | |
311 | error = soconnect(so, nam, l); | | 311 | error = soconnect(so, nam, l); |
312 | if (error) | | 312 | if (error) |
313 | goto bad; | | 313 | goto bad; |
314 | if (so->so_nbio && (so->so_state & SS_ISCONNECTING) != 0) { | | 314 | if (so->so_nbio && (so->so_state & SS_ISCONNECTING) != 0) { |
315 | error = EINPROGRESS; | | 315 | error = EINPROGRESS; |
316 | goto out; | | 316 | goto out; |
317 | } | | 317 | } |
318 | while ((so->so_state & SS_ISCONNECTING) != 0 && so->so_error == 0) { | | 318 | while ((so->so_state & SS_ISCONNECTING) != 0 && so->so_error == 0) { |
319 | error = sowait(so, true, 0); | | 319 | error = sowait(so, true, 0); |
320 | if (__predict_false((so->so_state & SS_ISDRAINING) != 0)) { | | 320 | if (__predict_false((so->so_state & SS_ISABORTING) != 0)) { |
321 | error = EPIPE; | | 321 | error = EPIPE; |
322 | interrupted = 1; | | 322 | interrupted = 1; |
323 | break; | | 323 | break; |
324 | } | | 324 | } |
325 | if (error) { | | 325 | if (error) { |
326 | if (error == EINTR || error == ERESTART) | | 326 | if (error == EINTR || error == ERESTART) |
327 | interrupted = 1; | | 327 | interrupted = 1; |
328 | break; | | 328 | break; |
329 | } | | 329 | } |
330 | } | | 330 | } |
331 | if (error == 0) { | | 331 | if (error == 0) { |
332 | error = so->so_error; | | 332 | error = so->so_error; |
333 | so->so_error = 0; | | 333 | so->so_error = 0; |