diff options
author | tanimura <tanimura@FreeBSD.org> | 2002-05-31 11:52:35 +0000 |
---|---|---|
committer | tanimura <tanimura@FreeBSD.org> | 2002-05-31 11:52:35 +0000 |
commit | e6fa9b9e922913444c2e6b2b58bf3de5eaed868d (patch) | |
tree | 9d5f24794525313566896ab89aa860515db344a6 /sys/kern/uipc_usrreq.c | |
parent | 1ea6cbb8c29088e04528460633798a6c131ca1ba (diff) | |
download | FreeBSD-src-e6fa9b9e922913444c2e6b2b58bf3de5eaed868d.zip FreeBSD-src-e6fa9b9e922913444c2e6b2b58bf3de5eaed868d.tar.gz |
Back out my lats commit of locking down a socket, it conflicts with hsu's work.
Requested by: hsu
Diffstat (limited to 'sys/kern/uipc_usrreq.c')
-rw-r--r-- | sys/kern/uipc_usrreq.c | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 55e7c45..04d670c 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -104,7 +104,6 @@ uipc_abort(struct socket *so) return EINVAL; unp_drop(unp, ECONNABORTED); unp_detach(unp); - SOCK_LOCK(so); sotryfree(so); return 0; } @@ -250,9 +249,7 @@ uipc_rcvd(struct socket *so, int flags) (void)chgsbsize(so2->so_cred->cr_uidinfo, &so2->so_snd.sb_hiwat, newhiwat, RLIM_INFINITY); unp->unp_cc = so->so_rcv.sb_cc; - SOCK_LOCK(so2); sowwakeup(so2); - SOCK_UNLOCK(so2); break; default: @@ -309,9 +306,7 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, else from = &sun_noname; if (sbappendaddr(&so2->so_rcv, from, m, control)) { - SOCK_LOCK(so2); sorwakeup(so2); - SOCK_UNLOCK(so2); m = 0; control = 0; } else @@ -327,9 +322,7 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, * Note: A better implementation would complain * if not equal to the peer's address. */ - SOCK_LOCK(so); if ((so->so_state & SS_ISCONNECTED) == 0) { - SOCK_UNLOCK(so); if (nam) { error = unp_connect(so, nam, td); if (error) @@ -341,11 +334,9 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, } if (so->so_state & SS_CANTSENDMORE) { - SOCK_UNLOCK(so); error = EPIPE; break; } - SOCK_UNLOCK(so); if (unp->unp_conn == 0) panic("uipc_send connected but no connection?"); so2 = unp->unp_conn->unp_socket; @@ -367,9 +358,7 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, (void)chgsbsize(so->so_cred->cr_uidinfo, &so->so_snd.sb_hiwat, newhiwat, RLIM_INFINITY); unp->unp_conn->unp_cc = so2->so_rcv.sb_cc; - SOCK_LOCK(so2); sorwakeup(so2); - SOCK_UNLOCK(so2); m = 0; break; @@ -574,9 +563,7 @@ unp_detach(unp) unp_disconnect(unp); while (!LIST_EMPTY(&unp->unp_refs)) unp_drop(LIST_FIRST(&unp->unp_refs), ECONNRESET); - SOCK_LOCK(unp->unp_socket); soisdisconnected(unp->unp_socket); - SOCK_UNLOCK(unp->unp_socket); unp->unp_socket->so_pcb = 0; if (unp_rights) { /* @@ -710,14 +697,8 @@ unp_connect(so, nam, td) goto bad; } if (so->so_proto->pr_flags & PR_CONNREQUIRED) { - SOCK_LOCK(so2); - if ((so2->so_options & SO_ACCEPTCONN) == 0) { - SOCK_UNLOCK(so2); - error = ECONNREFUSED; - goto bad; - } - SOCK_UNLOCK(so2); - if ((so3 = sonewconn(so2, 0)) == 0) { + if ((so2->so_options & SO_ACCEPTCONN) == 0 || + (so3 = sonewconn(so2, 0)) == 0) { error = ECONNREFUSED; goto bad; } @@ -775,19 +756,13 @@ unp_connect2(so, so2) case SOCK_DGRAM: LIST_INSERT_HEAD(&unp2->unp_refs, unp, unp_reflink); - SOCK_LOCK(so); soisconnected(so); - SOCK_UNLOCK(so); break; case SOCK_STREAM: unp2->unp_conn = unp; - SOCK_LOCK(so); soisconnected(so); - SOCK_UNLOCK(so); - SOCK_LOCK(so2); soisconnected(so2); - SOCK_UNLOCK(so2); break; default: @@ -809,19 +784,13 @@ unp_disconnect(unp) case SOCK_DGRAM: LIST_REMOVE(unp, unp_reflink); - SOCK_LOCK(unp->unp_socket); unp->unp_socket->so_state &= ~SS_ISCONNECTED; - SOCK_UNLOCK(unp->unp_socket); break; case SOCK_STREAM: - SOCK_LOCK(unp->unp_socket); soisdisconnected(unp->unp_socket); - SOCK_UNLOCK(unp->unp_socket); - SOCK_LOCK(unp2->unp_socket); unp2->unp_conn = 0; soisdisconnected(unp2->unp_socket); - SOCK_UNLOCK(unp2->unp_socket); break; } } |