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>
This commit is contained in:
parent
19b8a6dbc1
commit
adb6aa9ab9
@ -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)
|
||||
|
@ -234,17 +234,6 @@ struct xsocket {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define sotryfree(so) do { \
|
||||
ACCEPT_LOCK_ASSERT(); \
|
||||
SOCK_LOCK_ASSERT(so); \
|
||||
if ((so)->so_count == 0) \
|
||||
sofree(so); \
|
||||
else { \
|
||||
SOCK_UNLOCK(so); \
|
||||
ACCEPT_UNLOCK(); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* In sorwakeup() and sowwakeup(), acquire the socket buffer lock to
|
||||
* avoid a non-atomic test-and-wakeup. However, sowakeup is
|
||||
|
Loading…
x
Reference in New Issue
Block a user