* Append mbuf chain m to the last record in the socket buffer sb. The * additional space associated the mbuf chain is recorded in sb. Empty mbufs * are discarded and mbufs are compacted where possible. */
| 866 | * are discarded and mbufs are compacted where possible. |
| 867 | */ |
| 868 | void |
| 869 | sbappend_locked(struct sockbuf *sb, struct mbuf *m, int flags) |
| 870 | { |
| 871 | struct mbuf *n; |
| 872 | |
| 873 | SOCKBUF_LOCK_ASSERT(sb); |
| 874 | |
| 875 | if (m == NULL) |
| 876 | return; |
| 877 | sbm_clrprotoflags(m, flags); |
| 878 | SBLASTRECORDCHK(sb); |
| 879 | n = sb->sb_mb; |
| 880 | if (n) { |
| 881 | while (n->m_nextpkt) |
| 882 | n = n->m_nextpkt; |
| 883 | do { |
| 884 | if (n->m_flags & M_EOR) { |
| 885 | sbappendrecord_locked(sb, m); /* XXXXXX!!!! */ |
| 886 | return; |
| 887 | } |
| 888 | } while (n->m_next && (n = n->m_next)); |
| 889 | } else { |
| 890 | /* |
| 891 | * XXX Would like to simply use sb_mbtail here, but |
| 892 | * XXX I need to verify that I won't miss an EOR that |
| 893 | * XXX way. |
| 894 | */ |
| 895 | if ((n = sb->sb_lastrecord) != NULL) { |
| 896 | do { |
| 897 | if (n->m_flags & M_EOR) { |
| 898 | sbappendrecord_locked(sb, m); /* XXXXXX!!!! */ |
| 899 | return; |
| 900 | } |
| 901 | } while (n->m_next && (n = n->m_next)); |
| 902 | } else { |
| 903 | /* |
| 904 | * If this is the first record in the socket buffer, |
| 905 | * it's also the last record. |
| 906 | */ |
| 907 | sb->sb_lastrecord = m; |
| 908 | } |
| 909 | } |
| 910 | sbcompress(sb, m, n); |
| 911 | SBLASTRECORDCHK(sb); |
| 912 | } |
| 913 | |
| 914 | /* |
| 915 | * Append mbuf chain m to the last record in the socket buffer sb. The |
no test coverage detected