-/* $OpenBSD: uipc_socket.c,v 1.192 2017/07/04 12:58:32 mpi Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.193 2017/07/08 09:19:02 mpi Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
filt_sowrite(struct knote *kn, long hint)
{
struct socket *so = kn->kn_fp->f_data;
- int s, rv;
+ int rv;
- if (!(hint & NOTE_SUBMIT))
- s = solock(so);
kn->kn_data = sbspace(so, &so->so_snd);
if (so->so_state & SS_CANTSENDMORE) {
kn->kn_flags |= EV_EOF;
} else {
rv = (kn->kn_data >= so->so_snd.sb_lowat);
}
- if (!(hint & NOTE_SUBMIT))
- sounlock(s);
return (rv);
}
filt_solisten(struct knote *kn, long hint)
{
struct socket *so = kn->kn_fp->f_data;
- int s;
- if (!(hint & NOTE_SUBMIT))
- s = solock(so);
kn->kn_data = so->so_qlen;
- if (!(hint & NOTE_SUBMIT))
- sounlock(s);
return (kn->kn_data != 0);
}
-/* $OpenBSD: fifo_vnops.c,v 1.56 2017/07/03 08:31:39 mpi Exp $ */
+/* $OpenBSD: fifo_vnops.c,v 1.57 2017/07/08 09:19:02 mpi Exp $ */
/* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */
/*
filt_fiforead(struct knote *kn, long hint)
{
struct socket *so = (struct socket *)kn->kn_hook;
- int s, rv;
+ int rv;
- if (!(hint & NOTE_SUBMIT))
- s = solock(so);
kn->kn_data = so->so_rcv.sb_cc;
if (so->so_state & SS_CANTRCVMORE) {
kn->kn_flags |= EV_EOF;
kn->kn_flags &= ~EV_EOF;
rv = (kn->kn_data > 0);
}
- if (!(hint & NOTE_SUBMIT))
- sounlock(s);
return (rv);
}
filt_fifowrite(struct knote *kn, long hint)
{
struct socket *so = (struct socket *)kn->kn_hook;
- int s, rv;
+ int rv;
- if (!(hint & NOTE_SUBMIT))
- s = solock(so);
kn->kn_data = sbspace(so, &so->so_snd);
if (so->so_state & SS_CANTSENDMORE) {
kn->kn_flags |= EV_EOF;
kn->kn_flags &= ~EV_EOF;
rv = (kn->kn_data >= so->so_snd.sb_lowat);
}
- if (!(hint & NOTE_SUBMIT))
- sounlock(s);
return (rv);
}
-/* $OpenBSD: socketvar.h,v 1.72 2017/07/04 12:58:32 mpi Exp $ */
+/* $OpenBSD: socketvar.h,v 1.73 2017/07/08 09:19:02 mpi Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
/*-
sbspace(struct socket *so, struct sockbuf *sb)
{
KASSERT(sb == &so->so_rcv || sb == &so->so_snd);
+#if 0
+ /* XXXSMP kqueue_scan() calling filt_sowrite() cannot sleep. */
soassertlocked(so);
+#endif
return lmin(sb->sb_hiwat - sb->sb_cc, sb->sb_mbmax - sb->sb_mbcnt);
}