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

Function sockbuf_pushsync

freebsd/kern/uipc_socket.c:1864–1889  ·  view source on GitHub ↗

* Following replacement or removal of the first mbuf on the first mbuf chain * of a socket buffer, push necessary state changes back into the socket * buffer so that other consumers see the values consistently. 'nextrecord' * is the callers locally stored value of the original value of * sb->sb_mb->m_nextpkt which must be restored when the lead mbuf changes. * NOTE: 'nextrecord' may be NULL.

Source from the content-addressed store, hash-verified

1862 * NOTE: 'nextrecord' may be NULL.
1863 */
1864static __inline void
1865sockbuf_pushsync(struct sockbuf *sb, struct mbuf *nextrecord)
1866{
1867
1868 SOCKBUF_LOCK_ASSERT(sb);
1869 /*
1870 * First, update for the new value of nextrecord. If necessary, make
1871 * it the first record.
1872 */
1873 if (sb->sb_mb != NULL)
1874 sb->sb_mb->m_nextpkt = nextrecord;
1875 else
1876 sb->sb_mb = nextrecord;
1877
1878 /*
1879 * Now update any dependent socket buffer fields to reflect the new
1880 * state. This is an expanded inline of SB_EMPTY_FIXUP(), with the
1881 * addition of a second clause that takes care of the case where
1882 * sb_mb has been updated, but remains the last record.
1883 */
1884 if (sb->sb_mb == NULL) {
1885 sb->sb_mbtail = NULL;
1886 sb->sb_lastrecord = NULL;
1887 } else if (sb->sb_mb->m_nextpkt == NULL)
1888 sb->sb_lastrecord = sb->sb_mb;
1889}
1890
1891/*
1892 * Implement receive operations on a socket. We depend on the way that

Callers 2

uipc_socket.cFile · 0.85
soreceive_dgramFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected