Page MenuHomeFreeBSD

Check for SS_NBIO in so->so_state instead of sb->sb_flags.
ClosedPublic

Authored by jhb on Dec 12 2014, 4:16 PM.
Tags
None
Referenced Files
F122363819: D1299.id.diff
Fri, Jul 4, 4:43 PM
Unknown Object (File)
Sat, Jun 28, 8:53 PM
Unknown Object (File)
Fri, Jun 27, 7:21 AM
Unknown Object (File)
Wed, Jun 18, 7:17 AM
Unknown Object (File)
May 25 2025, 9:22 AM
Unknown Object (File)
May 18 2025, 10:14 AM
Unknown Object (File)
May 15 2025, 1:25 PM
Unknown Object (File)
Mar 26 2025, 1:21 AM
Subscribers

Details

Summary

I noticed this while code reading. I think the only case it would affect
is if you called read() on a non-blocking socket where 0 < sb_cc < sb_lowat
(and the buffer size (uio_resid) was > sb_cc). In that case, you would
block in sbwait() instead of returning a short read.

Test Plan

I have not yet written a test case for this. It would perhaps not be hard
to use TCP_NODELAY on the sender to send 1 byte after the receiver has
raised sb_lowat to 2.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

jhb retitled this revision from to Check for SS_NBIO in so->so_state instead of sb->sb_flags..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
bz added a reviewer: bz.
bz added a subscriber: bz.

Seems correct to me. It's only been like that since 2009 ;-(

This revision is now accepted and ready to land.Dec 12 2014, 5:11 PM
gnn added a reviewer: gnn.
gnn added a subscriber: gnn.

Nice catch.

jhb updated this revision to Diff 2750.

Closed by commit rS275808 (authored by @jhb).