-/* $OpenBSD: kern_sysctl.c,v 1.410 2023/01/21 11:23:23 mvs Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.411 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
}
kf->so_type = so->so_type;
- kf->so_state = so->so_state | so->so_snd.sb_state;
+ kf->so_state = so->so_state | so->so_snd.sb_state |
+ so->so_rcv.sb_state;
if (show_pointers)
kf->so_pcb = PTRTOINT64(so->so_pcb);
else
-/* $OpenBSD: sys_socket.c,v 1.59 2023/01/21 11:23:23 mvs Exp $ */
+/* $OpenBSD: sys_socket.c,v 1.60 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */
/*
break;
case SIOCATMARK:
- *(int *)data = (so->so_state&SS_RCVATMARK) != 0;
+ *(int *)data = (so->so_rcv.sb_state & SS_RCVATMARK) != 0;
break;
default:
memset(ub, 0, sizeof (*ub));
ub->st_mode = S_IFSOCK;
solock(so);
- if ((so->so_state & SS_CANTRCVMORE) == 0 || so->so_rcv.sb_cc != 0)
+ if ((so->so_rcv.sb_state & SS_CANTRCVMORE) == 0 ||
+ so->so_rcv.sb_cc != 0)
ub->st_mode |= S_IRUSR | S_IRGRP | S_IROTH;
if ((so->so_snd.sb_state & SS_CANTSENDMORE) == 0)
ub->st_mode |= S_IWUSR | S_IWGRP | S_IWOTH;
-/* $OpenBSD: uipc_socket.c,v 1.294 2023/01/21 11:23:23 mvs Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.295 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
so->so_error = 0;
goto release;
}
- if (so->so_state & SS_CANTRCVMORE) {
+ if (so->so_rcv.sb_state & SS_CANTRCVMORE) {
if (m)
goto dontblock;
else if (so->so_rcv.sb_cc == 0)
so, so->so_type, m, m->m_type);
#endif
}
- so->so_state &= ~SS_RCVATMARK;
+ so->so_rcv.sb_state &= ~SS_RCVATMARK;
len = uio->uio_resid;
if (so->so_oobmark && len > so->so_oobmark - offset)
len = so->so_oobmark - offset;
if ((flags & MSG_PEEK) == 0) {
so->so_oobmark -= len;
if (so->so_oobmark == 0) {
- so->so_state |= SS_RCVATMARK;
+ so->so_rcv.sb_state |= SS_RCVATMARK;
break;
}
} else {
*/
while (flags & MSG_WAITALL && m == NULL && uio->uio_resid > 0 &&
!sosendallatonce(so) && !nextrecord) {
- if (so->so_error || so->so_state & SS_CANTRCVMORE)
+ if (so->so_rcv.sb_state & SS_CANTRCVMORE ||
+ so->so_error)
break;
SBLASTRECORDCHK(&so->so_rcv, "soreceive sbwait 2");
SBLASTMBUFCHK(&so->so_rcv, "soreceive sbwait 2");
pru_rcvd(so);
}
if (orig_resid == uio->uio_resid && orig_resid &&
- (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) {
+ (flags & MSG_EOR) == 0 &&
+ (so->so_rcv.sb_state & SS_CANTRCVMORE) == 0) {
sbunlock(so, &so->so_rcv);
goto restart;
}
pru_rcvd(so);
/* Receive buffer did shrink by len bytes, adjust oob. */
- state = so->so_state;
- so->so_state &= ~SS_RCVATMARK;
+ state = so->so_rcv.sb_state;
+ so->so_rcv.sb_state &= ~SS_RCVATMARK;
oobmark = so->so_oobmark;
so->so_oobmark = oobmark > len ? oobmark - len : 0;
if (oobmark) {
if (oobmark == len)
- so->so_state |= SS_RCVATMARK;
+ so->so_rcv.sb_state |= SS_RCVATMARK;
if (oobmark >= len)
oobmark = 0;
}
error = EFBIG;
if (error)
so->so_error = error;
- if (((so->so_state & SS_CANTRCVMORE) && so->so_rcv.sb_cc == 0) ||
+ if (((so->so_rcv.sb_state & SS_CANTRCVMORE) &&
+ so->so_rcv.sb_cc == 0) ||
(sosp->so_snd.sb_state & SS_CANTSENDMORE) ||
maxreached || error) {
sounsplice(so, sosp, 0);
break;
case SO_RCVBUF:
- if (so->so_state & SS_CANTRCVMORE)
+ if (so->so_rcv.sb_state & SS_CANTRCVMORE)
return (EINVAL);
if (sbcheckreserve(cnt, so->so_rcv.sb_wat) ||
sbreserve(so, &so->so_rcv, cnt))
rv = 0;
} else
#endif /* SOCKET_SPLICE */
- if (so->so_state & SS_CANTRCVMORE) {
+ if (so->so_rcv.sb_state & SS_CANTRCVMORE) {
kn->kn_flags |= EV_EOF;
if (kn->kn_flags & __EV_POLL) {
if (so->so_state & SS_ISDISCONNECTED)
} else
#endif /* SOCKET_SPLICE */
if (kn->kn_sfflags & NOTE_OOB) {
- if (so->so_oobmark || (so->so_state & SS_RCVATMARK)) {
+ if (so->so_oobmark || (so->so_rcv.sb_state & SS_RCVATMARK)) {
kn->kn_fflags |= NOTE_OOB;
kn->kn_data -= so->so_oobmark;
rv = 1;
-/* $OpenBSD: uipc_socket2.c,v 1.132 2023/01/21 11:23:23 mvs Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.133 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
{
soassertlocked(so);
so->so_state &= ~SS_ISCONNECTING;
- so->so_state |= (SS_ISDISCONNECTING|SS_CANTRCVMORE);
+ so->so_state |= SS_ISDISCONNECTING;
+ so->so_rcv.sb_state |= SS_CANTRCVMORE;
so->so_snd.sb_state |= SS_CANTSENDMORE;
wakeup(&so->so_timeo);
sowwakeup(so);
{
soassertlocked(so);
so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
- so->so_state |= (SS_CANTRCVMORE|SS_ISDISCONNECTED);
+ so->so_state |= SS_ISDISCONNECTED;
+ so->so_rcv.sb_state |= SS_CANTRCVMORE;
so->so_snd.sb_state |= SS_CANTSENDMORE;
wakeup(&so->so_timeo);
sowwakeup(so);
socantrcvmore(struct socket *so)
{
soassertlocked(so);
- so->so_state |= SS_CANTRCVMORE;
+ so->so_rcv.sb_state |= SS_CANTRCVMORE;
sorwakeup(so);
}
-/* $OpenBSD: uipc_syscalls.c,v 1.208 2023/01/12 10:59:36 mvs Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.209 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
goto out_unlock;
}
if ((headfp->f_flag & FNONBLOCK) && head->so_qlen == 0) {
- if (head->so_state & SS_CANTRCVMORE)
+ if (head->so_rcv.sb_state & SS_CANTRCVMORE)
error = ECONNABORTED;
else
error = EWOULDBLOCK;
goto out_unlock;
}
while (head->so_qlen == 0 && head->so_error == 0) {
- if (head->so_state & SS_CANTRCVMORE) {
+ if (head->so_rcv.sb_state & SS_CANTRCVMORE) {
head->so_error = ECONNABORTED;
break;
}
-/* $OpenBSD: fifo_vnops.c,v 1.99 2023/01/21 11:23:23 mvs Exp $ */
+/* $OpenBSD: fifo_vnops.c,v 1.100 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */
/*
}
if (fip->fi_writers == 1) {
solock(rso);
- rso->so_state &= ~(SS_CANTRCVMORE|SS_ISDISCONNECTED);
+ rso->so_state &= ~SS_ISDISCONNECTED;
+ rso->so_rcv.sb_state &= ~SS_CANTRCVMORE;
sounlock(rso);
if (fip->fi_readers > 0)
wakeup(&fip->fi_readers);
soassertlocked(so);
kn->kn_data = so->so_rcv.sb_cc;
- if (so->so_state & SS_CANTRCVMORE) {
+ if (so->so_rcv.sb_state & SS_CANTRCVMORE) {
kn->kn_flags |= EV_EOF;
if (kn->kn_flags & __EV_POLL) {
if (so->so_state & SS_ISDISCONNECTED)
-/* $OpenBSD: rtsock.c,v 1.358 2022/10/17 14:49:02 mvs Exp $ */
+/* $OpenBSD: rtsock.c,v 1.359 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
* timeout(9), otherwise timeout_del_barrier(9) can't help us.
*/
if ((so->so_state & SS_ISCONNECTED) == 0 ||
- (so->so_state & SS_CANTRCVMORE))
+ (so->so_rcv.sb_state & SS_CANTRCVMORE))
return;
/* If we are in a DESYNC state, try to send a RTM_DESYNC packet */
*/
if ((so0 == so && !(so0->so_options & SO_USELOOPBACK)) ||
!(so->so_state & SS_ISCONNECTED) ||
- (so->so_state & SS_CANTRCVMORE))
+ (so->so_rcv.sb_state & SS_CANTRCVMORE))
goto next;
/* filter messages that the process does not want */
-/* $OpenBSD: raw_ip.c,v 1.150 2022/10/17 14:49:02 mvs Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.151 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
rw_enter_write(&rawcbtable.inpt_notify);
mtx_enter(&rawcbtable.inpt_mtx);
TAILQ_FOREACH(inp, &rawcbtable.inpt_queue, inp_queue) {
- if (inp->inp_socket->so_state & SS_CANTRCVMORE)
+ if (inp->inp_socket->so_rcv.sb_state & SS_CANTRCVMORE)
continue;
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
-/* $OpenBSD: tcp_input.c,v 1.385 2023/01/12 13:09:47 bluhm Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.386 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
nq = TAILQ_NEXT(q, tcpqe_q);
TAILQ_REMOVE(&tp->t_segq, q, tcpqe_q);
ND6_HINT(tp);
- if (so->so_state & SS_CANTRCVMORE)
+ if (so->so_rcv.sb_state & SS_CANTRCVMORE)
m_freem(q->tcpqe_m);
else
sbappendstream(so, &so->so_rcv, q->tcpqe_m);
* Drop TCP, IP headers and TCP options then add data
* to socket buffer.
*/
- if (so->so_state & SS_CANTRCVMORE)
+ if (so->so_rcv.sb_state & SS_CANTRCVMORE)
m_freem(m);
else {
if (tp->t_srtt != 0 && tp->rfbuf_ts != 0 &&
* specification, but if we don't get a FIN
* we'll hang forever.
*/
- if (so->so_state & SS_CANTRCVMORE) {
+ if (so->so_rcv.sb_state & SS_CANTRCVMORE) {
tp->t_flags |= TF_BLOCKOUTPUT;
soisdisconnected(so);
tp->t_flags &= ~TF_BLOCKOUTPUT;
so->so_oobmark = so->so_rcv.sb_cc +
(tp->rcv_up - tp->rcv_nxt) - 1;
if (so->so_oobmark == 0)
- so->so_state |= SS_RCVATMARK;
+ so->so_rcv.sb_state |= SS_RCVATMARK;
sohasoutofband(so);
tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA);
}
tiflags = th->th_flags & TH_FIN;
tcpstat_pkt(tcps_rcvpack, tcps_rcvbyte, tlen);
ND6_HINT(tp);
- if (so->so_state & SS_CANTRCVMORE)
+ if (so->so_rcv.sb_state & SS_CANTRCVMORE)
m_freem(m);
else {
m_adj(m, hdroptlen);
-/* $OpenBSD: tcp_usrreq.c,v 1.215 2023/01/21 11:23:24 mvs Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.216 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
return (error);
if ((so->so_oobmark == 0 &&
- (so->so_state & SS_RCVATMARK) == 0) ||
+ (so->so_rcv.sb_state & SS_RCVATMARK) == 0) ||
so->so_options & SO_OOBINLINE ||
tp->t_oobflags & TCPOOB_HADDATA) {
error = EINVAL;
-/* $OpenBSD: udp_usrreq.c,v 1.304 2022/10/17 14:49:02 mvs Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.305 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
rw_enter_write(&udbtable.inpt_notify);
mtx_enter(&udbtable.inpt_mtx);
TAILQ_FOREACH(inp, &udbtable.inpt_queue, inp_queue) {
- if (inp->inp_socket->so_state & SS_CANTRCVMORE)
+ if (inp->inp_socket->so_rcv.sb_state & SS_CANTRCVMORE)
continue;
#ifdef INET6
/* don't accept it if AF does not match */
-/* $OpenBSD: raw_ip6.c,v 1.171 2022/10/17 14:49:02 mvs Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.172 2023/01/22 12:05:44 mvs Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
rw_enter_write(&rawin6pcbtable.inpt_notify);
mtx_enter(&rawin6pcbtable.inpt_mtx);
TAILQ_FOREACH(in6p, &rawin6pcbtable.inpt_queue, inp_queue) {
- if (in6p->inp_socket->so_state & SS_CANTRCVMORE)
+ if (in6p->inp_socket->so_rcv.sb_state & SS_CANTRCVMORE)
continue;
if (rtable_l2(in6p->inp_rtableid) !=
rtable_l2(m->m_pkthdr.ph_rtableid))
-/* $OpenBSD: socketvar.h,v 1.115 2023/01/21 11:23:24 mvs Exp $ */
+/* $OpenBSD: socketvar.h,v 1.116 2023/01/22 12:05:44 mvs Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
/*-
* buffer `sb_state' only:
*
* SS_CANTSENDMORE with `so_snd'
+ * SS_CANTRCVMORE with `so_rcv'
+ * SS_RCVATMARK with `so_rcv'
*/
#define SS_NOFDREF 0x001 /* no file table ref any more */
soassertlocked(so);
if (isspliced(so))
return 0;
- return (so->so_state & SS_CANTRCVMORE) || so->so_qlen || so->so_error ||
- so->so_rcv.sb_cc >= so->so_rcv.sb_lowat;
+ return (so->so_rcv.sb_state & SS_CANTRCVMORE) || so->so_qlen ||
+ so->so_error || so->so_rcv.sb_cc >= so->so_rcv.sb_lowat;
}
/* can we write something to so? */