MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sbappend_locked

Function sbappend_locked

freebsd/kern/uipc_sockbuf.c:868–912  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

866 * are discarded and mbufs are compacted where possible.
867 */
868void
869sbappend_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

Callers 2

sbappendFunction · 0.85
uipc_sendFunction · 0.85

Calls 3

sbm_clrprotoflagsFunction · 0.85
sbappendrecord_lockedFunction · 0.85
sbcompressFunction · 0.85

Tested by

no test coverage detected