aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2006-07-21 17:11:15 +0000
committerRobert Watson <rwatson@FreeBSD.org>2006-07-21 17:11:15 +0000
commita152f8a36128ce99cc252941396d7db06ec7084e (patch)
treec584d49beb0289bc5110816075b0f48383df5bfd /sys/kern
parent05a7329cbad79bc2d72b63eee9badbdb4deff62d (diff)
Notes
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_socket.c11
-rw-r--r--sys/kern/uipc_usrreq.c19
2 files changed, 22 insertions, 8 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 4d5936a7c4d9..6e203d1d3e60 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -589,6 +589,8 @@ sofree(so)
sorflush(so);
knlist_destroy(&so->so_rcv.sb_sel.si_note);
knlist_destroy(&so->so_snd.sb_sel.si_note);
+ if (so->so_proto->pr_usrreqs->pru_detach != NULL)
+ (*so->so_proto->pr_usrreqs->pru_detach)(so);
sodealloc(so);
}
@@ -653,8 +655,8 @@ soclose(so)
}
drop:
- if (*so->so_proto->pr_usrreqs->pru_detach != NULL)
- (*so->so_proto->pr_usrreqs->pru_detach)(so);
+ if (so->so_proto->pr_usrreqs->pru_close != NULL)
+ (*so->so_proto->pr_usrreqs->pru_close)(so);
ACCEPT_LOCK();
SOCK_LOCK(so);
KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF"));
@@ -676,9 +678,6 @@ drop:
* with any socket locks held. Protocols do call it while holding their own
* recursible protocol mutexes, but this is something that should be subject
* to review in the future.
- *
- * XXXRW: Why do we maintain a distinction between pru_abort() and
- * pru_detach()?
*/
void
soabort(so)
@@ -697,7 +696,7 @@ soabort(so)
KASSERT((so->so_state & SQ_COMP) == 0, ("soabort: SQ_COMP"));
KASSERT((so->so_state & SQ_INCOMP) == 0, ("soabort: SQ_INCOMP"));
- if (*so->so_proto->pr_usrreqs->pru_abort != NULL)
+ if (so->so_proto->pr_usrreqs->pru_abort != NULL)
(*so->so_proto->pr_usrreqs->pru_abort)(so);
ACCEPT_LOCK();
SOCK_LOCK(so);
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 2c7222398cb6..02b641a89725 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -149,8 +149,7 @@ uipc_abort(struct socket *so)
KASSERT(unp != NULL, ("uipc_abort: unp == NULL"));
UNP_LOCK();
unp_drop(unp, ECONNABORTED);
- unp_detach(unp);
- UNP_UNLOCK_ASSERT();
+ UNP_UNLOCK();
}
static int
@@ -210,6 +209,21 @@ uipc_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
return (error);
}
+/*
+ * XXXRW: Should also unbind?
+ */
+static void
+uipc_close(struct socket *so)
+{
+ struct unpcb *unp;
+
+ unp = sotounpcb(so);
+ KASSERT(unp != NULL, ("uipc_close: unp == NULL"));
+ UNP_LOCK();
+ unp_disconnect(unp);
+ UNP_UNLOCK();
+}
+
int
uipc_connect2(struct socket *so1, struct socket *so2)
{
@@ -565,6 +579,7 @@ struct pr_usrreqs uipc_usrreqs = {
.pru_sosend = sosend,
.pru_soreceive = soreceive,
.pru_sopoll = sopoll,
+ .pru_close = uipc_close,
};
int