]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r279992,r280149,r280193,r288223,r288484,r321109:
authorngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 18 Jul 2017 08:15:02 +0000 (08:15 +0000)
committerngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 18 Jul 2017 08:15:02 +0000 (08:15 +0000)
commitaff08024017d7dd73b64d51b3503de7026c395b0
treec945395db5b500babb8919fd9cda50ab96aa8a3f
parent7e0b192cf09f1a3ae7c07068e31a77adfd6a0ce6
MFC r279992,r280149,r280193,r288223,r288484,r321109:

r279992 (by ian):

Add a new flag, SBUF_INCLUDENUL, and new get/set/clear functions for flags.

The SBUF_INCLUDENUL flag causes the nulterm byte at the end of the string
to be counted in the length of the data.  If copying the data using the
sbuf_data() and sbuf_len() functions, or if writing it automatically with
a drain function, the net effect is that the nulterm byte is copied along
with the rest of the data.

r280149 (by ian):

Update an sbuf assertion to allow for the new SBUF_INCLUDENUL flag.  If
INCLUDENUL is set and sbuf_finish() has been called, the length has been
incremented to count the nulterm byte, and in that case current length is
allowed to be equal to buffer size, otherwise it must be less than.

Add a predicate macro to test for SBUF_INCLUDENUL, and use it in tests, to
be consistant with the style in the rest of this file.

r280193 (by ian):

The minimum sbuf buffer size is 2 bytes (a byte plus a nulterm), assert that.

Values smaller than two lead to strange asserts that have nothing to do
with the actual problem (in the case of size=0), or to writing beyond the
end of the allocated buffer in sbuf_finish() (in the case of size=1).

r288223 (by cem):

sbuf: Process more than one char at a time

Revamp sbuf_put_byte() to sbuf_put_bytes() in the obvious fashion and
fixup callers.

Add a thin shim around sbuf_put_bytes() with the old ABI to avoid ugly
changes to some callers.

Obtained from: Dan Sledz

r288484 (by phk):

Fail the sbuf if vsnprintf(3) fails.

r321109:

Fix whitespace regression accidentally checked in via ^/head@r280149

git-svn-id: svn://svn.freebsd.org/base/stable/10@321112 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
share/man/man9/sbuf.9
sys/kern/subr_sbuf.c
sys/sys/sbuf.h