aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/sockbuf.h
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2014-03-07 23:30:48 +0000
committerAlan Somers <asomers@FreeBSD.org>2014-03-07 23:30:48 +0000
commit6a2ae0eb1662c056052c7ce92c2fcb3a5395d0f9 (patch)
treeb99eaae61526b694cc2f189a88e8e28109b9c6bd /sys/sys/sockbuf.h
parent2d7c8761fc8753d0a2dc8ef034113d42becfc5a9 (diff)
downloadsrc-6a2ae0eb1662c056052c7ce92c2fcb3a5395d0f9.tar.gz
src-6a2ae0eb1662c056052c7ce92c2fcb3a5395d0f9.zip
sbin/devd/devd.8
sbin/devd/devd.cc Add a -q flag to devd that will suppress syslog logging at LOG_NOTICE or below. Requested by: ian@ and imp@ MFC after: 3 weeks Sponsored by: Spectra Logic Corporation
Notes
Notes: svn path=/head/; revision=262914
Diffstat (limited to 'sys/sys/sockbuf.h')
-rw-r--r--sys/sys/sockbuf.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h
index 6994fd3fd60f..877b5307ee2e 100644
--- a/sys/sys/sockbuf.h
+++ b/sys/sys/sockbuf.h
@@ -52,6 +52,7 @@
#define SB_NOCOALESCE 0x200 /* don't coalesce new data into existing mbufs */
#define SB_IN_TOE 0x400 /* socket buffer is in the middle of an operation */
#define SB_AUTOSIZE 0x800 /* automatically size socket buffer */
+#define SB_STOP 0x1000 /* backpressure indicator */
#define SBS_CANTSENDMORE 0x0010 /* can't send more data to peer */
#define SBS_CANTRCVMORE 0x0020 /* can't receive more data from peer */
@@ -168,9 +169,19 @@ void sbunlock(struct sockbuf *sb);
* still be negative (cc > hiwat or mbcnt > mbmax). Should detect
* overflow and return 0. Should use "lmin" but it doesn't exist now.
*/
-#define sbspace(sb) \
- ((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \
- (int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))
+static __inline
+long
+sbspace(struct sockbuf *sb)
+{
+ long bleft;
+ long mleft;
+
+ if (sb->sb_flags & SB_STOP)
+ return(0);
+ bleft = sb->sb_hiwat - sb->sb_cc;
+ mleft = sb->sb_mbmax - sb->sb_mbcnt;
+ return((bleft < mleft) ? bleft : mleft);
+}
/* adjust counters in sb reflecting allocation of m */
#define sballoc(sb, m) { \