Extending sbufs with a drain, take 2

mdf at FreeBSD.org mdf at FreeBSD.org
Thu Sep 9 17:46:03 UTC 2010


Thank you very much for your continued input.  I have incorporated all
these ideas and I am committing the patches as I update them and test
them.

On Thu, Sep 9, 2010 at 12:26 AM, Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:
>>Replace sbuf_overflowed() with sbuf_error(), which returns any error
>>code associated with overflow or with the drain function.
>>
>>http://people.freebsd.org/~mdf/0006-Replace-sbuf_overflowed-with-sbuf_error-which-return.patch
>
> Now that sbuf_finish() returns the error, most applications should
> not need to sbuf_finish()/sbuf_error() at all.

Right.  There were 16 uses in the entire tree (all in the kernel).
Several of these were in error; that is checking sbuf_overflowed()
after an sbuf_finish().  These uses I fixed to check the return code
from sbuf_finish().  I believe 5 were used to determine if the static
buffer for sysctl was too small; these uses are removed in my patch.
The remaining uses are to check that the data fits in the static sized
buffer, e.g. MAXPATHLEN for audit, 1024 bytes for some ioctls, etc.

Again, thanks for all your help.

One question about the printf expanded args in xprintf.c:

Does the extension framework allow for multiple character conversion
specifiers?  I.e. I see that you added a sample %V and %H and %T in
the original version.  Could this framework allow a %{} specifier or
is it assumed that conversions are a single character (possibly with
modifiers)?

Thanks,
matthew


More information about the freebsd-arch mailing list