so->so_uid = head->so_uid;
so->so_usecount = 1;
+#ifdef __APPLE__
+ so->so_rcv.sb_flags |= SB_RECV; /* XXX */
+ so->so_rcv.sb_so = so->so_snd.sb_so = so;
+ TAILQ_INIT(&so->so_evlist);
+#endif
+
if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat)) {
sflt_termsock(so);
sodealloc(so);
head->so_incqlen++;
}
head->so_qlen++;
-#ifdef __APPLE__
- so->so_rcv.sb_flags |= SB_RECV; /* XXX */
- so->so_rcv.sb_so = so->so_snd.sb_so = so;
- TAILQ_INIT(&so->so_evlist);
+#ifdef __APPLE__
/* Attach socket filters for this protocol */
sflt_initsock(so);
#endif
int
sblock(struct sockbuf *sb, int wf)
{
- return(sb->sb_flags & SB_LOCK ?
- ((wf == M_WAIT) ? sb_lock(sb) : EWOULDBLOCK) :
- (sb->sb_flags |= SB_LOCK), 0);
+ int error = 0;
+
+ if (sb->sb_flags & SB_LOCK)
+ error = (wf == M_WAIT) ? sb_lock(sb) : EWOULDBLOCK;
+ else
+ sb->sb_flags |= SB_LOCK;
+
+ return (error);
}
/* release lock on sockbuf sb */