summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2010-09-18 11:18:42 +0000
committerrwatson <rwatson@FreeBSD.org>2010-09-18 11:18:42 +0000
commitb9d3291981a5e5a3fccba50333b2a4cdbe6486ac (patch)
treee4be35f12120ced317f8f104e33af91168f44699 /sys/kern/uipc_socket.c
parent6fb9e576740e5fb3845382d57096b085069d3dff (diff)
downloadFreeBSD-src-b9d3291981a5e5a3fccba50333b2a4cdbe6486ac.zip
FreeBSD-src-b9d3291981a5e5a3fccba50333b2a4cdbe6486ac.tar.gz
With reworking of the socket life cycle in 7.x, the need for a "sotryfree()"
was eliminated: all references to sockets are explicitly managed by sorele() and the protocols. As such, garbage collect sotryfree(), and update sofree() comments to make the new world order more clear. MFC after: 3 days Reported by: Anuranjan Shukla <anshukla at juniper dot net>
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index d3aa490..d6c9854 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -559,9 +559,12 @@ solisten_proto(struct socket *so, int backlog)
}
/*
- * Attempt to free a socket. This should really be sotryfree().
+ * Evaluate the reference count and named references on a socket; if no
+ * references remain, free it. This should be called whenever a reference is
+ * released, such as in sorele(), but also when named reference flags are
+ * cleared in socket or protocol code.
*
- * sofree() will succeed if:
+ * sofree() will free the socket if:
*
* - There are no outstanding file descriptor references or related consumers
* (so_count == 0).
@@ -574,9 +577,6 @@ solisten_proto(struct socket *so, int backlog)
* - The socket is not in a completed connection queue, so a process has been
* notified that it is present. If it is removed, the user process may
* block in accept() despite select() saying the socket was ready.
- *
- * Otherwise, it will quietly abort so that a future call to sofree(), when
- * conditions are right, can succeed.
*/
void
sofree(struct socket *so)
OpenPOWER on IntegriCloud