summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-06-01 02:42:56 +0000
committerrwatson <rwatson@FreeBSD.org>2004-06-01 02:42:56 +0000
commitbddadcf71a191234c652f1a57c52259d99eac58d (patch)
treeb3cf202f784daea532f82c3a671eb807b9874cb0 /sys
parent7a915f30a709eb7c2e2d7f4f5f9ce5ad30818fa8 (diff)
downloadFreeBSD-src-bddadcf71a191234c652f1a57c52259d99eac58d.zip
FreeBSD-src-bddadcf71a191234c652f1a57c52259d99eac58d.tar.gz
The SS_COMP and SS_INCOMP flags in the so_state field indicate whether
the socket is on an accept queue of a listen socket. This change renames the flags to SQ_COMP and SQ_INCOMP, and moves them to a new state field on the socket, so_qstate, as the locking for these flags is substantially different for the locking on the remainder of the flags in so_state.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_sockbuf.c10
-rw-r--r--sys/kern/uipc_socket.c8
-rw-r--r--sys/kern/uipc_socket2.c10
-rw-r--r--sys/kern/uipc_syscalls.c2
-rw-r--r--sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c2
-rw-r--r--sys/netgraph/ng_ksocket.c2
-rw-r--r--sys/sys/socketvar.h9
7 files changed, 24 insertions, 19 deletions
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index a404d69..36a90ed 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -117,7 +117,7 @@ soisconnected(so)
so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);
so->so_state |= SS_ISCONNECTED;
- if (head && (so->so_state & SS_INCOMP)) {
+ if (head && (so->so_qstate & SQ_INCOMP)) {
if ((so->so_options & SO_ACCEPTFILTER) != 0) {
so->so_upcall = head->so_accf->so_accept_filter->accf_callback;
so->so_upcallarg = head->so_accf->so_accept_filter_arg;
@@ -128,10 +128,10 @@ soisconnected(so)
}
TAILQ_REMOVE(&head->so_incomp, so, so_list);
head->so_incqlen--;
- so->so_state &= ~SS_INCOMP;
+ so->so_qstate &= ~SQ_INCOMP;
TAILQ_INSERT_TAIL(&head->so_comp, so, so_list);
head->so_qlen++;
- so->so_state |= SS_COMP;
+ so->so_qstate |= SQ_COMP;
sorwakeup(head);
wakeup_one(&head->so_timeo);
} else {
@@ -209,7 +209,7 @@ sonewconn(head, connstatus)
if (connstatus) {
TAILQ_INSERT_TAIL(&head->so_comp, so, so_list);
- so->so_state |= SS_COMP;
+ so->so_qstate |= SQ_COMP;
head->so_qlen++;
} else {
if (head->so_incqlen > head->so_qlimit) {
@@ -218,7 +218,7 @@ sonewconn(head, connstatus)
(void) soabort(sp);
}
TAILQ_INSERT_TAIL(&head->so_incomp, so, so_list);
- so->so_state |= SS_INCOMP;
+ so->so_qstate |= SQ_INCOMP;
head->so_incqlen++;
}
if (connstatus) {
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index ece519b..706167e 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -288,10 +288,10 @@ sofree(so)
return;
if (so->so_head != NULL) {
head = so->so_head;
- if (so->so_state & SS_INCOMP) {
+ if (so->so_qstate & SQ_INCOMP) {
TAILQ_REMOVE(&head->so_incomp, so, so_list);
head->so_incqlen--;
- } else if (so->so_state & SS_COMP) {
+ } else if (so->so_qstate & SQ_COMP) {
/*
* We must not decommission a socket that's
* on the accept(2) queue. If we do, then
@@ -302,7 +302,7 @@ sofree(so)
} else {
panic("sofree: not queued");
}
- so->so_state &= ~SS_INCOMP;
+ so->so_qstate &= ~SQ_INCOMP;
so->so_head = NULL;
}
so->so_snd.sb_flags |= SB_NOINTR;
@@ -346,7 +346,7 @@ soclose(so)
/* Dequeue from so_comp since sofree() won't do it */
TAILQ_REMOVE(&so->so_comp, sp, so_list);
so->so_qlen--;
- sp->so_state &= ~SS_COMP;
+ sp->so_qstate &= ~SQ_COMP;
sp->so_head = NULL;
(void) soabort(sp);
}
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index a404d69..36a90ed 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -117,7 +117,7 @@ soisconnected(so)
so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);
so->so_state |= SS_ISCONNECTED;
- if (head && (so->so_state & SS_INCOMP)) {
+ if (head && (so->so_qstate & SQ_INCOMP)) {
if ((so->so_options & SO_ACCEPTFILTER) != 0) {
so->so_upcall = head->so_accf->so_accept_filter->accf_callback;
so->so_upcallarg = head->so_accf->so_accept_filter_arg;
@@ -128,10 +128,10 @@ soisconnected(so)
}
TAILQ_REMOVE(&head->so_incomp, so, so_list);
head->so_incqlen--;
- so->so_state &= ~SS_INCOMP;
+ so->so_qstate &= ~SQ_INCOMP;
TAILQ_INSERT_TAIL(&head->so_comp, so, so_list);
head->so_qlen++;
- so->so_state |= SS_COMP;
+ so->so_qstate |= SQ_COMP;
sorwakeup(head);
wakeup_one(&head->so_timeo);
} else {
@@ -209,7 +209,7 @@ sonewconn(head, connstatus)
if (connstatus) {
TAILQ_INSERT_TAIL(&head->so_comp, so, so_list);
- so->so_state |= SS_COMP;
+ so->so_qstate |= SQ_COMP;
head->so_qlen++;
} else {
if (head->so_incqlen > head->so_qlimit) {
@@ -218,7 +218,7 @@ sonewconn(head, connstatus)
(void) soabort(sp);
}
TAILQ_INSERT_TAIL(&head->so_incomp, so, so_list);
- so->so_state |= SS_INCOMP;
+ so->so_qstate |= SQ_INCOMP;
head->so_incqlen++;
}
if (connstatus) {
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 978c30e..cc8c6ff 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -336,7 +336,7 @@ accept1(td, uap, compat)
/* connection has been removed from the listen queue */
KNOTE(&head->so_rcv.sb_sel.si_note, 0);
- so->so_state &= ~SS_COMP;
+ so->so_qstate &= ~SQ_COMP;
so->so_head = NULL;
pgid = fgetown(&head->so_sigio);
if (pgid != 0)
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
index 437b604..e521dd9 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
@@ -1369,7 +1369,7 @@ ng_btsocket_rfcomm_session_accept(ng_btsocket_rfcomm_session_p s0)
s0->l2so->so_qlen --;
soref(l2so);
- l2so->so_state &= ~SS_COMP;
+ l2so->so_qstate &= ~SQ_COMP;
l2so->so_state |= SS_NBIO;
l2so->so_head = NULL;
diff --git a/sys/netgraph/ng_ksocket.c b/sys/netgraph/ng_ksocket.c
index 8b9263d..ee10eff 100644
--- a/sys/netgraph/ng_ksocket.c
+++ b/sys/netgraph/ng_ksocket.c
@@ -1204,7 +1204,7 @@ ng_ksocket_finish_accept(priv_p priv)
soref(so);
- so->so_state &= ~SS_COMP;
+ so->so_qstate &= ~SQ_COMP;
so->so_state |= SS_NBIO;
so->so_head = NULL;
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index c5b60559..fd1258f 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -63,6 +63,7 @@ struct socket {
short so_options; /* from socket call, see socket.h */
short so_linger; /* time to linger while closing */
short so_state; /* internal state flags SS_*, below */
+ int so_qstate; /* internal state flags SQ_* */
void *so_pcb; /* protocol control block */
struct protosw *so_proto; /* protocol handle */
/*
@@ -157,11 +158,15 @@ struct socket {
#define SS_ASYNC 0x0200 /* async i/o notify */
#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */
-#define SS_INCOMP 0x0800 /* unaccepted, incomplete connection */
-#define SS_COMP 0x1000 /* unaccepted, complete connection */
#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
/*
+ * Socket state bits stored in so_qstate.
+ */
+#define SQ_INCOMP 0x0800 /* unaccepted, incomplete connection */
+#define SQ_COMP 0x1000 /* unaccepted, complete connection */
+
+/*
* Externalized form of struct socket used by the sysctl(3) interface.
*/
struct xsocket {
OpenPOWER on IntegriCloud