version 1.41, 1999/01/20 09:15:41 |
version 1.44.2.1, 1999/06/18 17:14:35 |
Line 100 socreate(dom, aso, type, proto) |
|
Line 100 socreate(dom, aso, type, proto) |
|
so->so_proto = prp; |
so->so_proto = prp; |
so->so_send = sosend; |
so->so_send = sosend; |
so->so_receive = soreceive; |
so->so_receive = soreceive; |
|
if (p != 0) |
|
so->so_uid = p->p_ucred->cr_uid; |
error = (*prp->pr_usrreq)(so, PRU_ATTACH, (struct mbuf *)0, |
error = (*prp->pr_usrreq)(so, PRU_ATTACH, (struct mbuf *)0, |
(struct mbuf *)(long)proto, (struct mbuf *)0, p); |
(struct mbuf *)(long)proto, (struct mbuf *)0, p); |
if (error) { |
if (error) { |
|
|
register struct socket *so; |
register struct socket *so; |
{ |
{ |
|
|
/* |
if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0) |
* We must not decommission a socket that's on the accept(2) queue. |
|
* If we do, then accept(2) may hang even after select(2) indicated |
|
* that the listening socket was ready. |
|
*/ |
|
if (so->so_pcb || so->so_head || (so->so_state & SS_NOFDREF) == 0) |
|
return; |
return; |
|
if (so->so_head) { |
|
/* |
|
* We must not decommission a socket that's on the accept(2) |
|
* queue. If we do, then accept(2) may hang after select(2) |
|
* indicated that the listening socket was ready. |
|
*/ |
|
if (!soqremque(so, 0)) |
|
return; |
|
} |
sbrelease(&so->so_snd); |
sbrelease(&so->so_snd); |
sorflush(so); |
sorflush(so); |
pool_put(&socket_pool, so); |
pool_put(&socket_pool, so); |
|
|
|
|
if (so->so_options & SO_ACCEPTCONN) { |
if (so->so_options & SO_ACCEPTCONN) { |
while ((so2 = so->so_q0.tqh_first) != 0) { |
while ((so2 = so->so_q0.tqh_first) != 0) { |
so2->so_head = 0; |
(void) soqremque(so2, 0); |
(void) soabort(so2); |
(void) soabort(so2); |
} |
} |
while ((so2 = so->so_q.tqh_first) != 0) { |
while ((so2 = so->so_q.tqh_first) != 0) { |
so2->so_head = 0; |
(void) soqremque(so2, 1); |
(void) soabort(so2); |
(void) soabort(so2); |
} |
} |
} |
} |
|
|
s = splsoftnet(); |
s = splsoftnet(); |
if (so->so_state & SS_CANTSENDMORE) |
if (so->so_state & SS_CANTSENDMORE) |
snderr(EPIPE); |
snderr(EPIPE); |
if (so->so_error) |
if (so->so_error) { |
snderr(so->so_error); |
error = so->so_error; |
|
so->so_error = 0; |
|
splx(s); |
|
goto release; |
|
} |
if ((so->so_state & SS_ISCONNECTED) == 0) { |
if ((so->so_state & SS_ISCONNECTED) == 0) { |
if (so->so_proto->pr_flags & PR_CONNREQUIRED) { |
if (so->so_proto->pr_flags & PR_CONNREQUIRED) { |
if ((so->so_state & SS_ISCONFIRMING) == 0 && |
if ((so->so_state & SS_ISCONFIRMING) == 0 && |