aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/ng_ksocket.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2004-06-14 18:16:22 +0000
committerRobert Watson <rwatson@FreeBSD.org>2004-06-14 18:16:22 +0000
commitc0b99ffa021c0be74d6ab90a6eccfe511be8bb19 (patch)
tree38ab74987dd7d2d27fad4ea4e4772c7d36baf7d4 /sys/netgraph/ng_ksocket.c
parentfb6dad913a34b899ddff899af697c0fc3176942e (diff)
downloadsrc-c0b99ffa021c0be74d6ab90a6eccfe511be8bb19.tar.gz
src-c0b99ffa021c0be74d6ab90a6eccfe511be8bb19.zip
The socket field so_state is used to hold a variety of socket related
flags relating to several aspects of socket functionality. This change breaks out several bits relating to send and receive operation into a new per-socket buffer field, sb_state, in order to facilitate locking. This is required because, in order to provide more granular locking of sockets, different state fields have different locking properties. The following fields are moved to sb_state: SS_CANTRCVMORE (so_state) SS_CANTSENDMORE (so_state) SS_RCVATMARK (so_state) Rename respectively to: SBS_CANTRCVMORE (so_rcv.sb_state) SBS_CANTSENDMORE (so_snd.sb_state) SBS_RCVATMARK (so_rcv.sb_state) This facilitates locking by isolating fields to be located with other identically locked fields, and permits greater granularity in socket locking by avoiding storing fields with different locking semantics in the same short (avoiding locking conflicts). In the future, we may wish to coallesce sb_state and sb_flags; for the time being I leave them separate and there is no additional memory overhead due to the packing/alignment of shorts in the socket buffer structure.
Notes
Notes: svn path=/head/; revision=130480
Diffstat (limited to 'sys/netgraph/ng_ksocket.c')
-rw-r--r--sys/netgraph/ng_ksocket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netgraph/ng_ksocket.c b/sys/netgraph/ng_ksocket.c
index badc69ccb102..f24331889e32 100644
--- a/sys/netgraph/ng_ksocket.c
+++ b/sys/netgraph/ng_ksocket.c
@@ -1144,7 +1144,7 @@ sendit: /* Forward data with optional peer sockaddr as meta info */
* If the peer has closed the connection, forward a 0-length mbuf
* to indicate end-of-file.
*/
- if (so->so_state & SS_CANTRCVMORE && !(priv->flags & KSF_EOFSEEN)) {
+ if (so->so_rcv.sb_state & SBS_CANTRCVMORE && !(priv->flags & KSF_EOFSEEN)) {
MGETHDR(m, waitflag, MT_DATA);
if (m != NULL) {
m->m_len = m->m_pkthdr.len = 0;
@@ -1171,7 +1171,7 @@ ng_ksocket_check_accept(priv_p priv)
}
/* Unlocked read. */
if (TAILQ_EMPTY(&head->so_comp)) {
- if (head->so_state & SS_CANTRCVMORE)
+ if (head->so_rcv.sb_state & SBS_CANTRCVMORE)
return ECONNABORTED;
return EWOULDBLOCK;
}