Subject: Re: Socket buffer optimization tweak
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Jason R Thorpe <>
List: tech-net
Date: 10/18/2001 12:26:48
On Thu, Oct 18, 2001 at 11:47:28AM -0700, Jonathan Stone wrote:

 > Skimming the code: sbappend_simple() is just syntactic sugar for
 > sbcompress(). Why not just call sbcompress() directly (or via an
 > inline/macro)? Or at least call it sbcompresstail() or sbappendtail()
 > -- which is what it does, after all?

It's "syntactic sugar" only in that sbcompress() really isn't meant
to be called except for inside the socket code, as far as I am aware :-)

I suppose I could rename it to sbappend_stream(), since that's what it
is for -- stream protocols (where the socket buffer effectively has
one record that simply changes size).

In order to make this work for datagram protocols, or anything else
where the record boundaries are preserved, you'd need another tail
pointer in the socket buffer -- sb_lastrecord or something, that
pointed to the first mbuf of the last record in the chain (so you can
link up m_nextpkt properly).

        -- Jason R. Thorpe <>