* How much space is there in a socket buffer (so->so_snd or so->so_rcv)? * This is problematical if the fields are unsigned, as the space might * still be negative (ccc > hiwat or mbcnt > mbmax). */
| 225 | * still be negative (ccc > hiwat or mbcnt > mbmax). |
| 226 | */ |
| 227 | static inline long |
| 228 | sbspace(struct sockbuf *sb) |
| 229 | { |
| 230 | int bleft, mleft; /* size should match sockbuf fields */ |
| 231 | |
| 232 | #if 0 |
| 233 | SOCKBUF_LOCK_ASSERT(sb); |
| 234 | #endif |
| 235 | |
| 236 | if (sb->sb_flags & SB_STOP) |
| 237 | return(0); |
| 238 | |
| 239 | bleft = sb->sb_hiwat - sb->sb_ccc; |
| 240 | mleft = sb->sb_mbmax - sb->sb_mbcnt; |
| 241 | |
| 242 | return ((bleft < mleft) ? bleft : mleft); |
| 243 | } |
| 244 | |
| 245 | #define SB_EMPTY_FIXUP(sb) do { \ |
| 246 | if ((sb)->sb_mb == NULL) { \ |
no outgoing calls
no test coverage detected