-/* $OpenBSD: uipc_socket2.c,v 1.80 2017/06/27 12:02:43 mpi Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.81 2017/07/04 12:51:18 mpi Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
void
soqinsque(struct socket *head, struct socket *so, int q)
{
+ soassertlocked(head);
#ifdef DIAGNOSTIC
if (so->so_onq != NULL)
int
soqremque(struct socket *so, int q)
{
- struct socket *head;
+ struct socket *head = so->so_head;
+
+ soassertlocked(head);
- head = so->so_head;
if (q == 0) {
if (so->so_onq != &head->so_q0)
return (0);
-/* $OpenBSD: socketvar.h,v 1.70 2017/06/26 09:32:32 mpi Exp $ */
+/* $OpenBSD: socketvar.h,v 1.71 2017/07/04 12:51:18 mpi Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
/*-
((so)->so_state & SS_ISSENDING)
/* can we read something from so? */
-#define soreadable(so) \
- (!isspliced(so) && \
- ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \
- ((so)->so_state & SS_CANTRCVMORE) || \
- (so)->so_qlen || (so)->so_error))
+static inline int
+soreadable(struct socket *so)
+{
+ 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;
+}
/* can we write something to so? */
#define sowriteable(so) \