On Wednesday, June 15, 2016 09:08:51 PM John Baldwin wrote: > Author: jhb > Date: Wed Jun 15 21:08:51 2016 > New Revision: 301932 > URL: https://svnweb.freebsd.org/changeset/base/301932 > > Log: > Use sbused() instead of sbspace() to avoid signed issues. > > Inserting a full mbuf with an external cluster into the socket buffer > resulted in sbspace() returning -MLEN. However, since sb_hiwat is > unsigned, the -MLEN value was converted to unsigned in comparisons. As a > result, the socket buffer was never autosized. Note that sb_lowat is signed > to permit direct comparisons with sbspace(), but sb_hiwat is unsigned. > Follow suit with what tcp_output() does and compare the value of sbused() > with sb_hiwat instead. > > Approved by: re (gjb) > Sponsored by: Chelsio Communications
Amusingly (or not), sb_lowat used to be signed as well. Mike Karels changed it to signed in this commit to BSD: https://svnweb.freebsd.org/csrg/sys/sys/socketvar.h?revision=43896 The log reads: add SB_ASYNC in sockbuf, add SB_NOTIFY, SB_NOINTR; make lowat signed for comparison with sbspace (should probably give up and make all fields signed -- John Baldwin _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"